Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from jitsi:master #137

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 58 additions & 12 deletions src/test/java/org/jitsi/meet/test/BreakoutRoomsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@
*/
package org.jitsi.meet.test;

import org.jitsi.meet.test.base.JitsiMeetUrl;
import org.jitsi.meet.test.pageobjects.web.BreakoutRoomsList;
import org.jitsi.meet.test.pageobjects.web.ParticipantsPane;
import org.jitsi.meet.test.util.TestUtils;
import org.jitsi.meet.test.web.WebParticipant;
import org.jitsi.meet.test.web.WebTestBase;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.testng.SkipException;
import org.testng.annotations.Test;
import org.jitsi.meet.test.base.*;
import org.jitsi.meet.test.pageobjects.web.*;
import org.jitsi.meet.test.util.*;
import org.jitsi.meet.test.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.*;
import org.openqa.selenium.support.ui.*;
import org.testng.*;
import org.testng.annotations.*;

import java.util.*;
import java.util.logging.*;

import static org.testng.Assert.*;
import static org.jitsi.meet.test.pageobjects.web.ParticipantsPane.PARTICIPANT_ITEM;
import static org.jitsi.meet.test.pageobjects.web.ParticipantsPane.*;

/**
* Tests the Breakout rooms functionality.
Expand Down Expand Up @@ -346,4 +344,52 @@ public void testCollapseRoom()
TestUtils.waitForCondition(participant1.getDriver(), 5,
(ExpectedCondition<Boolean>) d -> roomsList.getRooms().get(0).getParticipantsCount() == 1);
}
@Test(dependsOnMethods = {"testCollapseRoom"})
public void testRenameRoom()
{
BreakoutRoomsList roomsList = participant1.getBreakoutRoomsList();

String myNewRoomName = "breakout-" + generateRandomRoomName();

// let's rename breakout room and see it in local and remote
BreakoutRoomsList.BreakoutRoom room = roomsList.getRooms().get(0);
room.renameRoom(myNewRoomName);

SubjectTest.checkSubject(participant2, myNewRoomName);

TestUtils.waitForCondition(participant1.getDriver(), "Breakout room was not renamed for moderator", 5,
(ExpectedCondition<Boolean>) d -> roomsList.getRooms().get(0).getName().trim().equals(myNewRoomName));

ParticipantsPane pane2 = participant2.getParticipantsPane();
pane2.open();
BreakoutRoomsList roomsList2 = participant2.getBreakoutRoomsList();

// leave room
pane2.leaveBreakoutRoom();

// there should be one empty room
TestUtils.waitForCondition(participant1.getDriver(), 5,
(ExpectedCondition<Boolean>) d -> {
List<BreakoutRoomsList.BreakoutRoom> rooms = roomsList.getRooms();
return rooms.size() == 1
&& rooms.get(0).getParticipantsCount() == 0;
});

assertEquals(roomsList2.getRooms().get(0).getName().trim(), myNewRoomName,
"Participant2 do not see new room name");

// send the second participant to the first breakout room
ParticipantsPane pane = participant1.getParticipantsPane();
pane.sendParticipantToBreakoutRoom(participant2, roomsList.getRooms().get(0).getName().trim());

// there should be one room with one participant
TestUtils.waitForCondition(participant1.getDriver(), 5,
(ExpectedCondition<Boolean>) d -> {
List<BreakoutRoomsList.BreakoutRoom> rooms = roomsList.getRooms();
return rooms.size() == 1
&& rooms.get(0).getParticipantsCount() == 1;
});

SubjectTest.checkSubject(participant2, myNewRoomName);
}
}
89 changes: 89 additions & 0 deletions src/test/java/org/jitsi/meet/test/SubjectTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.meet.test;

import org.jitsi.meet.test.util.*;
import org.jitsi.meet.test.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.*;
import org.openqa.selenium.support.ui.*;
import org.testng.*;
import org.testng.annotations.*;

import java.util.logging.*;

import static org.testng.Assert.*;

/**
* TSets subject via config url hash param and check locally and remote for it.
*
* @author Damian Minkov
*/
public class SubjectTest
extends WebTestBase
{
private static final String MY_TEST_SUBJECT = "My Test Subject";

/**
* The subject xpath.
*/
private final static String SUBJECT_XPATH = "//div[starts-with(@class, 'subject-text')]";

@Override
public void setupClass()
{
super.setupClass();

ensureTwoParticipants(getJitsiMeetUrl().appendConfig("config.subject=\"" + MY_TEST_SUBJECT + "\""), null);
}

/**
* Kick participant2 and checks at participant1 is this is visible.
* and whether participant2 sees a notification that was kicked.
*/
@Test
public void changeSubjectAndCheck()
{
WebParticipant participant1 = getParticipant1();

if (participant1.isModerator())
{
checkSubject(participant1, MY_TEST_SUBJECT);
checkSubject(getParticipant2(), MY_TEST_SUBJECT);
}
else
{
Logger.getGlobal().log(Level.WARNING, "Not testing subject as torture is not moderator.");
throw new SkipException("skip as test's participant cannot be moderator");
}
}

public static void checkSubject(WebParticipant participant, String subject)
{
WebDriver driver = participant.getDriver();

WebElement localTile = driver.findElement(By.xpath(SUBJECT_XPATH));
Actions hoverOnLocalTile = new Actions(driver);
hoverOnLocalTile.moveToElement(localTile);
hoverOnLocalTile.perform();

String txt = driver.findElement(By.xpath(SUBJECT_XPATH)).getText();

TestUtils.waitForCondition(driver, "Subject does not match for " + participant.getName(), 5,
(ExpectedCondition<Boolean>) d ->
d.findElement(By.xpath(SUBJECT_XPATH)).getText().startsWith(subject));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@ public void removeRoom()
removeButton.click();
}

public void renameRoom(String newName)
{
WebDriver driver = participant.getDriver();

openContextMenu();
WebElement removeButton = TestUtils.waitForElementBy(driver, By.id("rename-room-" + id), 2);

removeButton.click();

TestUtils.waitForElementBy(driver, By.xpath("//input[@name='breakoutRoomName']"), 5);

// give time for the dialog to fully load
TestUtils.waitMillis(1000);

WebElement passwordInput = driver.findElement(By.xpath("//input[@name='breakoutRoomName']"));

passwordInput.clear();
passwordInput.sendKeys(newName);

TestUtils.waitMillis(500);

ModalDialogHelper.clickOKButton(driver);
}

public void closeRoom()
{
openContextMenu();
Expand Down
5 changes: 5 additions & 0 deletions src/test/resources/desktop/testng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@
<class name="org.jitsi.meet.test.StopVideoTest" />
</classes>
</test>
<test name="SubjectTest">
<classes>
<class name="org.jitsi.meet.test.SubjectTest" />
</classes>
</test>
<test name="SwitchVideoTest">
<classes>
<class name="org.jitsi.meet.test.SwitchVideoTest" />
Expand Down
Loading