Skip to content

Commit

Permalink
feat: Adds rename breakout room tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Jun 7, 2024
1 parent 66647b8 commit e5049c1
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 16 deletions.
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);
}
}
12 changes: 8 additions & 4 deletions src/test/java/org/jitsi/meet/test/SubjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
*/
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.*;

Expand Down Expand Up @@ -59,8 +61,8 @@ public void changeSubjectAndCheck()

if (participant1.isModerator())
{
checkSubject(participant1);
checkSubject(getParticipant2());
checkSubject(participant1, MY_TEST_SUBJECT);
checkSubject(getParticipant2(), MY_TEST_SUBJECT);
}
else
{
Expand All @@ -69,7 +71,7 @@ public void changeSubjectAndCheck()
}
}

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

Expand All @@ -80,6 +82,8 @@ private void checkSubject(WebParticipant participant)

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

assertTrue(txt.startsWith(MY_TEST_SUBJECT), "Subject does not match for " + participant.getName());
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

0 comments on commit e5049c1

Please sign in to comment.