Skip to content

Commit

Permalink
openvidu-test-e2e: update manyToMany test
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Oct 10, 2024
1 parent f19432a commit c273ae0
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,32 +236,34 @@ void manyToManyVideoAudioSession() throws Exception {

log.info("Many2Many [Video + Audio]");

final int USERS = 4;

WebElement addUser = user.getDriver().findElement(By.id("add-user-btn"));
for (int i = 0; i < 4; i++) {
for (int i = 0; i < USERS; i++) {
addUser.click();
}

user.getDriver().findElements(By.className("connect-btn")).forEach(el -> el.sendKeys(Keys.ENTER));

user.getEventManager().waitUntilEventReaches("signalConnected", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("connected", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("localTrackPublished", "RoomEvent", 8);
user.getEventManager().waitUntilEventReaches("localTrackSubscribed", "RoomEvent", 8);
user.getEventManager().waitUntilEventReaches("trackSubscribed", "RoomEvent", 24);
user.getEventManager().waitUntilEventReaches("signalConnected", "RoomEvent", USERS);
user.getEventManager().waitUntilEventReaches("connected", "RoomEvent", USERS);
user.getEventManager().waitUntilEventReaches("localTrackPublished", "RoomEvent", USERS * 2);
user.getEventManager().waitUntilEventReaches("localTrackSubscribed", "RoomEvent", USERS * 2);
user.getEventManager().waitUntilEventReaches("trackSubscribed", "RoomEvent", (USERS * (USERS - 1) * 2));

user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 16));
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("audio"), 16));
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), USERS * USERS));
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("audio"), USERS * USERS));
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
final int numberOfAudios = user.getDriver().findElements(By.tagName("audio")).size();
Assertions.assertEquals(16, numberOfVideos, "Wrong number of videos");
Assertions.assertEquals(16, numberOfAudios, "Wrong number of audios");
Assertions.assertEquals(USERS * USERS, numberOfVideos, "Wrong number of videos");
Assertions.assertEquals(USERS * USERS, numberOfAudios, "Wrong number of audios");

Assertions.assertTrue(user.getBrowserUser().assertAllElementsHaveTracks("video", false, true),
"HTMLVideoElements were expected to have only one video track");
Assertions.assertTrue(user.getBrowserUser().assertAllElementsHaveTracks("audio.remote", true, false),
"HTMLAudioElements were expected to have only one audio track");

gracefullyLeaveParticipants(user, 4);
gracefullyLeaveParticipants(user, USERS);
}

@Test
Expand Down

0 comments on commit c273ae0

Please sign in to comment.