Skip to content

Commit

Permalink
openvidu-test-e2e: update crossBrowserTest
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Sep 25, 2024
1 parent bbb70dd commit e4d0448
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void massiveSessionTest() throws Exception {

user.getDriver().findElement(By.id("one2many-btn")).click();

user.getEventManager().waitUntilEventReaches("connectionCreated", NUMBER_OF_USERS * NUMBER_OF_USERS, 20, true);
user.getEventManager().waitUntilEventReaches("connectionCreated", NUMBER_OF_USERS * NUMBER_OF_USERS, 30, true);
user.getEventManager().waitUntilEventReaches("streamCreated", NUMBER_OF_USERS * NUMBER_OF_USERS, 15, true);
user.getEventManager().waitUntilEventReaches("streamPlaying", NUMBER_OF_USERS * NUMBER_OF_USERS, 15, true);
user.getWaiter()
Expand Down Expand Up @@ -436,21 +436,22 @@ public void uncaughtException(Thread th, Throwable ex) {
}
};

final CountDownLatch latch = new CountDownLatch(3);
final int NUMBER_OF_USERS = 3;
final CountDownLatch latch = new CountDownLatch(NUMBER_OF_USERS);

final BiFunction<OpenViduTestappUser, String, Void> browserTest = (user, browserName) -> {

user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.className("join-btn")).click();

try {
user.getEventManager().waitUntilEventReaches("connectionCreated", 3, 100, true);
user.getEventManager().waitUntilEventReaches("connectionCreated", NUMBER_OF_USERS, 100, true);
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
user.getEventManager().waitUntilEventReaches("streamCreated", 3);
user.getEventManager().waitUntilEventReaches("streamPlaying", 3);
user.getEventManager().waitUntilEventReaches("streamCreated", NUMBER_OF_USERS);
user.getEventManager().waitUntilEventReaches("streamPlaying", NUMBER_OF_USERS);

final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
Assertions.assertEquals(3, numberOfVideos, "Wrong number of videos");
Assertions.assertEquals(NUMBER_OF_USERS, numberOfVideos, "Wrong number of videos");
Assertions
.assertTrue(
user.getBrowserUser().assertMediaTracks(
Expand All @@ -477,6 +478,7 @@ public void uncaughtException(Thread th, Throwable ex) {

Thread threadChrome = new Thread(() -> {
try {
Thread.sleep((long)(Math.random() * 2500));
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("chrome"), "Chrome");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
Expand All @@ -487,6 +489,7 @@ public void uncaughtException(Thread th, Throwable ex) {
});
Thread threadFirefox = new Thread(() -> {
try {
//Thread.sleep(3000);
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("firefox"), "Firefox");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
Expand All @@ -497,6 +500,7 @@ public void uncaughtException(Thread th, Throwable ex) {
});
Thread threadEdge = new Thread(() -> {
try {
Thread.sleep((long)(Math.random() * 2500));
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("edge"), "Edge");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
Expand Down

0 comments on commit e4d0448

Please sign in to comment.