openvidu-test-e2e: minor adjustments in frontend events

pull/900/head
pabloFuente 2026-05-26 14:30:49 +02:00
parent f037f31da1
commit d04d086918
1 changed files with 134 additions and 127 deletions

View File

@ -136,19 +136,21 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getDriver().findElement(By.id("one2one-btn")).click();
user.getEventManager().waitUntilEventReaches("signalConnected", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("connected", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("participantConnected", "RoomEvent", 1);
user.getEventManager().waitUntilEventReaches("participantActive", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("connectionStateChanged", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("active", "ParticipantEvent", 4);
user.getEventManager().waitUntilEventReaches("connectionStateChanged", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("localTrackPublished", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("localTrackPublished", "ParticipantEvent", 4);
user.getEventManager().waitUntilEventReaches("trackPublished", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("trackPublished", "ParticipantEvent", 4);
user.getEventManager().waitUntilEventReaches("localTrackSubscribed", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("localTrackSubscribed", "ParticipantEvent", 4);
user.getEventManager().waitUntilEventReaches("trackSubscribed", "RoomEvent", 4);
user.getEventManager().waitUntilEventReaches("trackSubscribed", "ParticipantEvent", 4);
user.getEventManager().waitUntilEventReaches("trackSubscriptionStatusChanged", "RoomEvent", 8);
// user.getEventManager().waitUntilEventReaches("trackStreamStateChanged",
// "RoomEvent", 2);
// user.getEventManager().waitUntilEventReaches("trackStreamStateChanged",
// "ParticipantEvent", 2);
user.getEventManager().waitUntilEventReaches("trackSubscriptionStatusChanged", "ParticipantEvent", 8);
user.getEventManager().waitUntilEventReaches("visibilityChanged", "TrackEvent", 2);
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 4));
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("audio"), 4));
@ -405,7 +407,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Participant 0 publishes a data track
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .add-data-track-btn")).click();
// Wait for localDataTrackPublished on participant 0 and dataTrackPublished on participant 1
// Wait for localDataTrackPublished on participant 0 and dataTrackPublished on
// participant 1
user.getEventManager().waitUntilEventReaches(0, "localDataTrackPublished", "RoomEvent", 1);
user.getEventManager().waitUntilEventReaches(1, "dataTrackPublished", "RoomEvent", 1);
@ -454,7 +457,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getEventManager().clearAllCurrentEvents();
// Now participant 1 publishes a data track with custom name (bidirectional test)
// Now participant 1 publishes a data track with custom name (bidirectional
// test)
String customTrackName = "my_custom_data_track";
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .options-data-track-btn")).click();
Thread.sleep(500);
@ -655,12 +659,14 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Thread.sleep(1000);
// Sample packetsSent at 1-second intervals for 12 seconds.
// The 10-second WAV pattern (tone-silence) starts from Chrome's capture beginning.
// The 10-second WAV pattern (tone-silence) starts from Chrome's capture
// beginning.
// We sample enough to capture at least one full silence period.
int sampleCount = 12;
long[] packetsP0 = new long[sampleCount];
long[] packetsP1 = new long[sampleCount];
// Subscriber side: P0 subscribes to P1's audio (DTX disabled), P1 subscribes to P0's audio (DTX enabled)
// Subscriber side: P0 subscribes to P1's audio (DTX disabled), P1 subscribes to
// P0's audio (DTX enabled)
long[] recvP0 = new long[sampleCount];
long[] recvP1 = new long[sampleCount];
@ -698,7 +704,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
"var callback = arguments[arguments.length - 1];"
+ "var room = window['room_0'];"
+ "var mgr = room.localParticipant.engine.pcManager;"
+ "var pc = (mgr.subscriber || mgr.publisher)._pc;" // subscriber is undefined in single-PC mode (pion)
+ "var pc = (mgr.subscriber || mgr.publisher)._pc;" // subscriber is undefined in single-PC
// mode (pion)
+ "pc.getStats().then(function(stats) {"
+ " var packets = 0;"
+ " stats.forEach(function(report) {"
@ -712,7 +719,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
"var callback = arguments[arguments.length - 1];"
+ "var room = window['room_1'];"
+ "var mgr = room.localParticipant.engine.pcManager;"
+ "var pc = (mgr.subscriber || mgr.publisher)._pc;" // subscriber is undefined in single-PC mode (pion)
+ "var pc = (mgr.subscriber || mgr.publisher)._pc;" // subscriber is undefined in single-PC
// mode (pion)
+ "pc.getStats().then(function(stats) {"
+ " var packets = 0;"
+ " stats.forEach(function(report) {"
@ -1004,8 +1012,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getEventManager().waitUntilEventReaches("localTrackPublished", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("localTrackSubscribed", "RoomEvent", 2);
user.getEventManager().waitUntilEventReaches("trackSubscribed", "RoomEvent", 4);
// user.getEventManager().waitUntilEventReaches("trackStreamStateChanged",
// "RoomEvent", 2);
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("video"), 3));
user.getWaiter().until(ExpectedConditions.numberOfElementsToBe(By.tagName("audio"), 3));
@ -1554,6 +1560,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getDriver().findElement(By.id("room-events-btn-" + n)).sendKeys(Keys.ENTER);
Thread.sleep(300);
user.getDriver().findElement(By.cssSelector("button[name='activeSpeakersChanged']")).sendKeys(Keys.ENTER);
user.getDriver().findElement(By.cssSelector("button[name='isSpeakingChanged']")).sendKeys(Keys.ENTER);
user.getDriver().findElement(By.id("close-dialog-btn")).sendKeys(Keys.ENTER);
Thread.sleep(300);
}