diff --git a/src/test/java/org/jitsi/meet/test/BreakoutRoomsTest.java b/src/test/java/org/jitsi/meet/test/BreakoutRoomsTest.java index 7c357082a..4fb9d3f97 100644 --- a/src/test/java/org/jitsi/meet/test/BreakoutRoomsTest.java +++ b/src/test/java/org/jitsi/meet/test/BreakoutRoomsTest.java @@ -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. @@ -346,4 +344,52 @@ public void testCollapseRoom() TestUtils.waitForCondition(participant1.getDriver(), 5, (ExpectedCondition) 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) 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) d -> { + List 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) d -> { + List rooms = roomsList.getRooms(); + return rooms.size() == 1 + && rooms.get(0).getParticipantsCount() == 1; + }); + + SubjectTest.checkSubject(participant2, myNewRoomName); + } } diff --git a/src/test/java/org/jitsi/meet/test/SubjectTest.java b/src/test/java/org/jitsi/meet/test/SubjectTest.java new file mode 100644 index 000000000..5c90db28e --- /dev/null +++ b/src/test/java/org/jitsi/meet/test/SubjectTest.java @@ -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) d -> + d.findElement(By.xpath(SUBJECT_XPATH)).getText().startsWith(subject)); + } +} diff --git a/src/test/java/org/jitsi/meet/test/pageobjects/web/BreakoutRoomsList.java b/src/test/java/org/jitsi/meet/test/pageobjects/web/BreakoutRoomsList.java index be83dd411..2e08e26f8 100644 --- a/src/test/java/org/jitsi/meet/test/pageobjects/web/BreakoutRoomsList.java +++ b/src/test/java/org/jitsi/meet/test/pageobjects/web/BreakoutRoomsList.java @@ -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(); diff --git a/src/test/resources/desktop/testng.xml b/src/test/resources/desktop/testng.xml index dabcb94b9..316bc5477 100644 --- a/src/test/resources/desktop/testng.xml +++ b/src/test/resources/desktop/testng.xml @@ -218,6 +218,11 @@ + + + + +