Remove opera browser from tests

v2compatibility
pabloFuente 2025-01-24 12:21:17 +01:00
parent a1cf2f471f
commit d8431b4576
4 changed files with 294 additions and 348 deletions

View File

@ -1,46 +0,0 @@
package io.openvidu.test.browsers;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.Browser;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.RemoteWebDriver;
public class OperaUser extends BrowserUser {
public OperaUser(String userName, int timeOfWaitInSeconds) {
super(userName, timeOfWaitInSeconds);
ChromeOptions options = new ChromeOptions();
options.setCapability(CapabilityType.BROWSER_NAME, Browser.OPERA.browserName());
options.setAcceptInsecureCerts(true);
options.addArguments("---allow-elevated-browser");
options.setExperimentalOption("w3c", true);
// This flag avoids to grant the user media
options.addArguments("--use-fake-ui-for-media-stream");
// This flag fakes user media with synthetic video
options.addArguments("--use-fake-device-for-media-stream");
// This flag selects the entire screen as video source when screen sharing
options.addArguments("--auto-select-desktop-capture-source=Entire screen");
String REMOTE_URL = System.getProperty("REMOTE_URL_OPERA");
if (REMOTE_URL != null) {
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
try {
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
log.info("Using local web driver");
// this.driver = new OperaDriver(options);
}
this.driver.manage().timeouts().setScriptTimeout(timeOfWaitInSeconds, TimeUnit.SECONDS);
this.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
}
}

View File

@ -2,6 +2,6 @@ package io.openvidu.test.browsers.utils;
public enum BrowserNames { public enum BrowserNames {
CHROME, FIREFOX, OPERA, EDGE, ANDROID CHROME, FIREFOX, EDGE, ANDROID
} }

View File

@ -36,9 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.AbstractWaitStrategy; import org.testcontainers.containers.wait.strategy.AbstractWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.shaded.org.apache.commons.io.FileUtils; import org.testcontainers.shaded.org.apache.commons.io.FileUtils;
import org.testcontainers.utility.DockerImageName; import org.testcontainers.utility.DockerImageName;
@ -56,7 +54,6 @@ import io.openvidu.test.browsers.BrowserUser;
import io.openvidu.test.browsers.ChromeUser; import io.openvidu.test.browsers.ChromeUser;
import io.openvidu.test.browsers.EdgeUser; import io.openvidu.test.browsers.EdgeUser;
import io.openvidu.test.browsers.FirefoxUser; import io.openvidu.test.browsers.FirefoxUser;
import io.openvidu.test.browsers.OperaUser;
import io.openvidu.test.browsers.utils.BrowserNames; import io.openvidu.test.browsers.utils.BrowserNames;
import io.openvidu.test.browsers.utils.CommandLineExecutor; import io.openvidu.test.browsers.utils.CommandLineExecutor;
import io.openvidu.test.browsers.utils.CustomHttpClient; import io.openvidu.test.browsers.utils.CustomHttpClient;
@ -107,8 +104,6 @@ public class OpenViduTestE2e {
protected static String CHROME_VERSION = "latest"; protected static String CHROME_VERSION = "latest";
// https://hub.docker.com/r/selenium/standalone-firefox/tags // https://hub.docker.com/r/selenium/standalone-firefox/tags
protected static String FIREFOX_VERSION = "latest"; protected static String FIREFOX_VERSION = "latest";
// https://hub.docker.com/r/selenium/standalone-opera/tags
protected static String OPERA_VERSION = "latest";
// https://hub.docker.com/r/selenium/standalone-edge/tags // https://hub.docker.com/r/selenium/standalone-edge/tags
protected static String EDGE_VERSION = "latest"; protected static String EDGE_VERSION = "latest";
@ -163,11 +158,8 @@ public class OpenViduTestE2e {
int vncPort = 8900 + (containers.size()); int vncPort = 8900 + (containers.size());
envVars.put("SE_OPTS", "--port " + port + " --no-vnc-port " + vncPort); envVars.put("SE_OPTS", "--port " + port + " --no-vnc-port " + vncPort);
GenericContainer<?> browser = new GenericContainer<>(DockerImageName.parse(image)) GenericContainer<?> browser = new GenericContainer<>(DockerImageName.parse(image)).withSharedMemorySize(shmSize)
.withSharedMemorySize(shmSize) .withFileSystemBind("/opt/openvidu", "/opt/openvidu").withEnv(envVars).withNetworkMode("host")
.withFileSystemBind("/opt/openvidu", "/opt/openvidu")
.withEnv(envVars)
.withNetworkMode("host")
// .withLogConsumer(new Slf4jLogConsumer(log)) // .withLogConsumer(new Slf4jLogConsumer(log))
// .waitingFor(Wait.forHttp("/wd/hub/status").forStatusCode(200)) // .waitingFor(Wait.forHttp("/wd/hub/status").forStatusCode(200))
.withStartupTimeout(Duration.ofSeconds(60)); .withStartupTimeout(Duration.ofSeconds(60));
@ -182,12 +174,8 @@ public class OpenViduTestE2e {
return this.createBrowserContainer(image, shmSize, maxBrowserSessions, headless, 4445); return this.createBrowserContainer(image, shmSize, maxBrowserSessions, headless, 4445);
} }
private GenericContainer<?> operaContainer(String image, long shmSize, int maxBrowserSessions) {
return this.createBrowserContainer(image, shmSize, maxBrowserSessions, true, 4446);
}
private GenericContainer<?> edgeContainer(String image, long shmSize, int maxBrowserSessions, boolean headless) { private GenericContainer<?> edgeContainer(String image, long shmSize, int maxBrowserSessions, boolean headless) {
return this.createBrowserContainer(image, shmSize, maxBrowserSessions, headless, 4447); return this.createBrowserContainer(image, shmSize, maxBrowserSessions, headless, 4446);
} }
private static GenericContainer<?> androidContainer(String image, long shmSize) { private static GenericContainer<?> androidContainer(String image, long shmSize) {
@ -278,12 +266,6 @@ public class OpenViduTestE2e {
} }
log.info("Using Firefox {}", FIREFOX_VERSION); log.info("Using Firefox {}", FIREFOX_VERSION);
String operaVersion = System.getProperty("OPERA_VERSION");
if (operaVersion != null && !operaVersion.isBlank()) {
OPERA_VERSION = operaVersion;
}
log.info("Using Opera {}", OPERA_VERSION);
String edgeVersion = System.getProperty("EDGE_VERSION"); String edgeVersion = System.getProperty("EDGE_VERSION");
if (edgeVersion != null && !edgeVersion.isBlank()) { if (edgeVersion != null && !edgeVersion.isBlank()) {
EDGE_VERSION = edgeVersion; EDGE_VERSION = edgeVersion;
@ -357,7 +339,7 @@ public class OpenViduTestE2e {
switch (browser) { switch (browser) {
case "chrome": case "chrome":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, true); container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.CHROME, container, false ); setupBrowserAux(BrowserNames.CHROME, container, false);
browserUser = new ChromeUser("TestUser", 50, true); browserUser = new ChromeUser("TestUser", 50, true);
break; break;
case "chromeTwoInstances": case "chromeTwoInstances":
@ -401,11 +383,6 @@ public class OpenViduTestE2e {
setupBrowserAux(BrowserNames.FIREFOX, container, false); setupBrowserAux(BrowserNames.FIREFOX, container, false);
browserUser = new FirefoxUser("TestUser", 50, true); browserUser = new FirefoxUser("TestUser", 50, true);
break; break;
case "opera":
container = operaContainer("selenium/standalone-opera:" + OPERA_VERSION, 2147483648L, 1);
setupBrowserAux(BrowserNames.OPERA, container, false);
browserUser = new OperaUser("TestUser", 50);
break;
case "edge": case "edge":
container = edgeContainer("selenium/standalone-edge:" + EDGE_VERSION, 2147483648L, 1, true); container = edgeContainer("selenium/standalone-edge:" + EDGE_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.EDGE, container, false); setupBrowserAux(BrowserNames.EDGE, container, false);
@ -478,9 +455,6 @@ public class OpenViduTestE2e {
case FIREFOX: case FIREFOX:
remoteUrl = System.getProperty("REMOTE_URL_FIREFOX"); remoteUrl = System.getProperty("REMOTE_URL_FIREFOX");
break; break;
case OPERA:
remoteUrl = System.getProperty("REMOTE_URL_OPERA");
break;
case EDGE: case EDGE:
remoteUrl = System.getProperty("REMOTE_URL_EDGE"); remoteUrl = System.getProperty("REMOTE_URL_EDGE");
break; break;

View File

@ -155,15 +155,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
oneToOneAux(user); oneToOneAux(user);
} }
@Test
@DisplayName("One2One Opera")
@Disabled
void oneToOneOpera() throws Exception {
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("opera");
log.info("One2One Opera");
oneToOneAux(user);
}
@Test @Test
@DisplayName("One2One Edge") @DisplayName("One2One Edge")
void oneToOneEdge() throws Exception { void oneToOneEdge() throws Exception {
@ -395,7 +386,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
log.info("Massive session"); log.info("Massive session");
// Set the maximum number limit of participants in the rom because of the evaluation mode // Set the maximum number limit of participants in the rom because of the
// evaluation mode
final Integer NUMBER_OF_USERS = 8; final Integer NUMBER_OF_USERS = 8;
user.getDriver().findElement(By.id("toolbar-scenarios")).sendKeys(Keys.ENTER); user.getDriver().findElement(By.id("toolbar-scenarios")).sendKeys(Keys.ENTER);
@ -487,7 +479,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Thread threadChrome = new Thread(() -> { Thread threadChrome = new Thread(() -> {
try { try {
Thread.sleep((long)(Math.random() * 2500)); Thread.sleep((long) (Math.random() * 2500));
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("chrome"), "Chrome"); browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("chrome"), "Chrome");
} catch (Exception e) { } catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage(); String errMsg = "Error setting up browser: " + e.getMessage();
@ -498,7 +490,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
}); });
Thread threadFirefox = new Thread(() -> { Thread threadFirefox = new Thread(() -> {
try { try {
//Thread.sleep(3000); // Thread.sleep(3000);
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("firefox"), "Firefox"); browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("firefox"), "Firefox");
} catch (Exception e) { } catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage(); String errMsg = "Error setting up browser: " + e.getMessage();
@ -509,7 +501,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
}); });
Thread threadEdge = new Thread(() -> { Thread threadEdge = new Thread(() -> {
try { try {
Thread.sleep((long)(Math.random() * 2500)); Thread.sleep((long) (Math.random() * 2500));
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("edge"), "Edge"); browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("edge"), "Edge");
} catch (Exception e) { } catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage(); String errMsg = "Error setting up browser: " + e.getMessage();
@ -518,29 +510,16 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
}); });
// Thread threadOpera = new Thread(() -> {
// try {
// browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("opera"), "Opera");
// } catch (Exception e) {
// String errMsg = "Error setting up browser: " + e.getMessage();
// System.err.println(errMsg);
// Assertions.fail(errMsg);
// Thread.currentThread().interrupt();
// }
// });
threadChrome.setUncaughtExceptionHandler(h); threadChrome.setUncaughtExceptionHandler(h);
threadFirefox.setUncaughtExceptionHandler(h); threadFirefox.setUncaughtExceptionHandler(h);
threadEdge.setUncaughtExceptionHandler(h); threadEdge.setUncaughtExceptionHandler(h);
// threadOpera.setUncaughtExceptionHandler(h);
threadChrome.start(); threadChrome.start();
threadFirefox.start(); threadFirefox.start();
threadEdge.start(); threadEdge.start();
// threadOpera.start();
threadChrome.join(); threadChrome.join();
threadFirefox.join(); threadFirefox.join();
threadEdge.join(); threadEdge.join();
// threadOpera.join();
synchronized (lock) { synchronized (lock) {
if (OpenViduTestAppE2eTest.ex != null) { if (OpenViduTestAppE2eTest.ex != null) {
@ -771,7 +750,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click();
user.getEventManager().waitUntilEventReaches("connectionCreated", 1); user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
// Add publisher // Add publisher
user.getDriver().findElement(By.id("add-user-btn")).click(); user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .subscribe-checkbox")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .subscribe-checkbox")).click();
@ -797,7 +775,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click();
user.getEventManager().waitUntilEventReaches("connectionCreated", 1); user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
// Add publisher // Add publisher
user.getDriver().findElement(By.id("add-user-btn")).click(); user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .subscribe-checkbox")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .subscribe-checkbox")).click();
@ -920,8 +897,10 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Add publisher with only video active // Add publisher with only video active
user.getDriver().findElement(By.id("add-user-btn")).click(); user.getDriver().findElement(By.id("add-user-btn")).click();
// user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .subscribe-checkbox")).click(); // user.getDriver().findElement(By.cssSelector("#openvidu-instance-0
// user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .active-video-checkbox")).click(); // .subscribe-checkbox")).click();
// user.getDriver().findElement(By.cssSelector("#openvidu-instance-0
// .active-video-checkbox")).click();
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).click();
user.getEventManager().waitUntilEventReaches("streamPlaying", 1); user.getEventManager().waitUntilEventReaches("streamPlaying", 1);
user.getEventManager().waitUntilEventReaches("streamCreated", 1); user.getEventManager().waitUntilEventReaches("streamCreated", 1);
@ -968,7 +947,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 10); CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 10);
} catch (TimeoutException e) { } catch (TimeoutException e) {
log.error("Timeout: {}", e.getMessage()); log.error("Timeout: {}", e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -1007,7 +985,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
gracefullyLeaveParticipants(user, 1); gracefullyLeaveParticipants(user, 1);
CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 10); CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 10);
} catch (TimeoutException e) { } catch (TimeoutException e) {
log.error("Timeout: {}", e.getMessage()); log.error("Timeout: {}", e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -1018,7 +995,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
} }
} }
@Test @Test
@DisplayName("Change publisher dynamically") @DisplayName("Change publisher dynamically")
void changePublisherTest() throws Exception { void changePublisherTest() throws Exception {
@ -1858,7 +1834,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
user.getEventManager().waitUntilEventReaches("streamPlaying", 4); user.getEventManager().waitUntilEventReaches("streamPlaying", 4);
// checkDockerContainerRunning("openvidu/openvidu-recording", 1); // checkDockerContainerRunning("openvidu/openvidu-recording", 1);
// Disabled corner case test // Disabled corner case test
// OV.fetch(); // OV.fetch();
// session = OV.getActiveSessions().get(0); // session = OV.getActiveSessions().get(0);
@ -1866,14 +1841,16 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // event = CustomWebhook.waitForEvent("recordingStatusChanged", 1);
// if ("stopped".equals(event.get("status").getAsString())) { // if ("stopped".equals(event.get("status").getAsString())) {
// // Recording hasn't had time to start. Should trigger stopped, started, failed // // Recording hasn't had time to start. Should trigger stopped, started,
// failed
// event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // started // event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // started
// Assertions.assertEquals("started", event.get("status").getAsString(), // Assertions.assertEquals("started", event.get("status").getAsString(),
// "Wrong status in recordingStatusChanged event"); // "Wrong status in recordingStatusChanged event");
// event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // failed // event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // failed
// Assertions.assertEquals("failed", event.get("status").getAsString(), // Assertions.assertEquals("failed", event.get("status").getAsString(),
// "Wrong status in recordingStatusChanged event"); // "Wrong status in recordingStatusChanged event");
// Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName + "~2").getStatus(), // Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName
// + "~2").getStatus(),
// "Wrong recording status"); // "Wrong recording status");
// } else { // } else {
// // Recording did have time to start. Should trigger started, stopped, ready // // Recording did have time to start. Should trigger started, stopped, ready
@ -1883,7 +1860,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // failed // event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // failed
// Assertions.assertEquals("ready", event.get("status").getAsString(), // Assertions.assertEquals("ready", event.get("status").getAsString(),
// "Wrong status in recordingStatusChanged event"); // "Wrong status in recordingStatusChanged event");
// Assertions.assertEquals(Recording.Status.ready, OV.getRecording(sessionName + "~2").getStatus(), // Assertions.assertEquals(Recording.Status.ready, OV.getRecording(sessionName +
// "~2").getStatus(),
// "Wrong recording status"); // "Wrong recording status");
// } // }
@ -2190,9 +2168,12 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
String recPath = recordingsPath + SESSION_NAME + "/"; String recPath = recordingsPath + SESSION_NAME + "/";
Recording recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME); Recording recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME);
//Commented because the duration file using ffmpeg probe is not the same as the duration in the Livekit Egress entity // Commented because the duration file using ffmpeg probe is not the same as the
// this.recordingUtils.checkMultimediaFile(new File(recPath + recording.getName() + ".mp4"), false, true, // duration in the Livekit Egress entity
// recording.getDuration(), recording.getResolution(), recording.getFrameRate(), null, "h264", true); // this.recordingUtils.checkMultimediaFile(new File(recPath +
// recording.getName() + ".mp4"), false, true,
// recording.getDuration(), recording.getResolution(), recording.getFrameRate(),
// null, "h264", true);
// Check video-only INDIVIDUAL recording // Check video-only INDIVIDUAL recording
recPath = recordingsPath + SESSION_NAME + "~1/"; recPath = recordingsPath + SESSION_NAME + "~1/";
@ -2202,9 +2183,10 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Check audio-only INDIVIDUAL recording // Check audio-only INDIVIDUAL recording
recPath = recordingsPath + SESSION_NAME + "~2/"; recPath = recordingsPath + SESSION_NAME + "~2/";
recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME + "~2"); recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME + "~2");
// As the recording is audio only and there is only one participant publishing its audio // As the recording is audio only and there is only one participant publishing
// its audio
// The zip file only has 1 file (audio file) // The zip file only has 1 file (audio file)
this.recordingUtils.checkIndividualRecording(recPath, recording, 1, "opus",null, true); this.recordingUtils.checkIndividualRecording(recPath, recording, 1, "opus", null, true);
user.getDriver().findElement(By.id("close-dialog-btn")).click(); user.getDriver().findElement(By.id("close-dialog-btn")).click();
Thread.sleep(500); Thread.sleep(500);
@ -2323,7 +2305,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Thread.sleep(500); Thread.sleep(500);
WebElement customLayoutInput = user.getDriver().findElement(By.id("custom-layout-input")); WebElement customLayoutInput = user.getDriver().findElement(By.id("custom-layout-input"));
customLayoutInput.clear(); customLayoutInput.clear();
// For choose the default custom layout, the customLayout parameter must be empty // For choose the default custom layout, the customLayout parameter must be
// empty
// customLayoutInput.sendKeys("layout1"); // customLayoutInput.sendKeys("layout1");
user.getDriver().findElement(By.id("save-btn")).click(); user.getDriver().findElement(By.id("save-btn")).click();
Thread.sleep(1000); Thread.sleep(1000);
@ -2356,7 +2339,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
String recordingsPath = "/opt/openvidu/recordings/" + SESSION_NAME + "/"; String recordingsPath = "/opt/openvidu/recordings/" + SESSION_NAME + "/";
File file1 = new File(recordingsPath + SESSION_NAME + ".mp4"); File file1 = new File(recordingsPath + SESSION_NAME + ".mp4");
// The video duration using Ffmpeg is almost 1.5s longer than the actual duration provided by REST API (Egress) // The video duration using Ffmpeg is almost 1.5s longer than the actual
// duration provided by REST API (Egress)
// Commented until this issue is fixed // Commented until this issue is fixed
// Assertions.assertTrue( // Assertions.assertTrue(
// this.recordingUtils.recordedRedFileFine(file1, // this.recordingUtils.recordedRedFileFine(file1,
@ -2365,7 +2349,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Thumbnail is not supported by recordings at the moment // Thumbnail is not supported by recordings at the moment
// File file2 = new File(recordingsPath + SESSION_NAME + ".jpg"); // File file2 = new File(recordingsPath + SESSION_NAME + ".jpg");
// Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file2, RecordingUtils::checkVideoAverageRgbRed), // Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file2,
// RecordingUtils::checkVideoAverageRgbRed),
// "Thumbnail " + file2.getAbsolutePath() + " is not fine"); // "Thumbnail " + file2.getAbsolutePath() + " is not fine");
// Custom layout from external URL // Custom layout from external URL
@ -2415,16 +2400,19 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
recordingsPath = "/opt/openvidu/recordings/" + SESSION_NAME + "~1/"; recordingsPath = "/opt/openvidu/recordings/" + SESSION_NAME + "~1/";
file1 = new File(recordingsPath + SESSION_NAME + "~1.mp4"); file1 = new File(recordingsPath + SESSION_NAME + "~1.mp4");
// The video duration using Ffmpeg is almost 1.5s longer than the actual duration provided by REST API (Egress) // The video duration using Ffmpeg is almost 1.5s longer than the actual
// duration provided by REST API (Egress)
// Commented until this issue is fixed // Commented until this issue is fixed
// Assertions.assertTrue( // Assertions.assertTrue(
// this.recordingUtils.recordedRedFileFine(file1, // this.recordingUtils.recordedRedFileFine(file1,
// new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME + "~1")), // new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME +
// "~1")),
// "Recorded file " + file1.getAbsolutePath() + " is not fine"); // "Recorded file " + file1.getAbsolutePath() + " is not fine");
// Thumbnail is not supported by recordings at the moment // Thumbnail is not supported by recordings at the moment
// file2 = new File(recordingsPath + SESSION_NAME + "~1.jpg"); // file2 = new File(recordingsPath + SESSION_NAME + "~1.jpg");
// Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file2, RecordingUtils::checkVideoAverageRgbRed), // Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file2,
// RecordingUtils::checkVideoAverageRgbRed),
// "Thumbnail " + file2.getAbsolutePath() + " is not fine"); // "Thumbnail " + file2.getAbsolutePath() + " is not fine");
} finally { } finally {
@ -2768,10 +2756,11 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
sessions = OV.getActiveSessions(); sessions = OV.getActiveSessions();
Assertions.assertEquals(1, sessions.size(), "Expected 1 active session but found " + sessions.size()); Assertions.assertEquals(1, sessions.size(), "Expected 1 active session but found " + sessions.size());
// KurentoOptions kurentoOptions = new KurentoOptions.Builder().videoMaxRecvBandwidth(250) // KurentoOptions kurentoOptions = new
// KurentoOptions.Builder().videoMaxRecvBandwidth(250)
// .allowedFilters(new String[] { "GStreamerFilter" }).build(); // .allowedFilters(new String[] { "GStreamerFilter" }).build();
ConnectionProperties moderatorConnectionProperties = new ConnectionProperties.Builder() ConnectionProperties moderatorConnectionProperties = new ConnectionProperties.Builder()
.role(OpenViduRole.MODERATOR).data(serverDataModerator)/*.kurentoOptions(kurentoOptions)*/.build(); .role(OpenViduRole.MODERATOR).data(serverDataModerator)/* .kurentoOptions(kurentoOptions) */.build();
Connection connectionModerator = session.createConnection(moderatorConnectionProperties); Connection connectionModerator = session.createConnection(moderatorConnectionProperties);
ConnectionProperties subscriberConnectionProperties = new ConnectionProperties.Builder() ConnectionProperties subscriberConnectionProperties = new ConnectionProperties.Builder()
@ -2885,10 +2874,12 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Assertions.assertEquals(0, connectionModerator.getSubscribers().size(), "Expected 0 subscribers for connection " Assertions.assertEquals(0, connectionModerator.getSubscribers().size(), "Expected 0 subscribers for connection "
+ connectionModerator.getConnectionId() + " but found " + connectionModerator.getSubscribers().size()); + connectionModerator.getConnectionId() + " but found " + connectionModerator.getSubscribers().size());
// Assertions.assertEquals(1, connectionSubscriber.getSubscribers().size(), // Assertions.assertEquals(1, connectionSubscriber.getSubscribers().size(),
// "Expected 1 subscriber for connection " + connectionSubscriber.getConnectionId() + " but found " // "Expected 1 subscriber for connection " +
// connectionSubscriber.getConnectionId() + " but found "
// + connectionSubscriber.getSubscribers().size()); // + connectionSubscriber.getSubscribers().size());
// Assertions.assertEquals(connectionModerator.getPublishers().get(0).getStreamId(), // Assertions.assertEquals(connectionModerator.getPublishers().get(0).getStreamId(),
// connectionSubscriber.getSubscribers().get(0), "Publisher and subscriber should have same streamId"); // connectionSubscriber.getSubscribers().get(0), "Publisher and subscriber
// should have same streamId");
// Verify server and client data // Verify server and client data
Assertions.assertEquals(serverDataModerator, connectionModerator.getServerData(), "Server data doesn't match"); Assertions.assertEquals(serverDataModerator, connectionModerator.getServerData(), "Server data doesn't match");
@ -2908,8 +2899,9 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Assertions.assertTrue(pub.hasAudio()); Assertions.assertTrue(pub.hasAudio());
Assertions.assertFalse(pub.isAudioActive()); Assertions.assertFalse(pub.isAudioActive());
waitUntilFileExistsAndIsBiggerThan("/opt/openvidu/recordings/" + customSessionId + "/" + customSessionId + "/" +customSessionId + ".json" waitUntilFileExistsAndIsBiggerThan(
, 0, 60); "/opt/openvidu/recordings/" + customSessionId + "/" + customSessionId + "/" + customSessionId + ".json",
0, 60);
Assertions.assertFalse(session.fetch(), "Session.fetch() should return false"); Assertions.assertFalse(session.fetch(), "Session.fetch() should return false");
Assertions.assertFalse(OV.fetch(), "OpenVidu.fetch() should return false"); Assertions.assertFalse(OV.fetch(), "OpenVidu.fetch() should return false");
@ -3031,9 +3023,11 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Wait until new stream has been recorded to disk // Wait until new stream has been recorded to disk
session.fetch(); session.fetch();
// String streamId = session.getActiveConnections().stream().filter(c -> c.getPublishers().size() > 0).findFirst() // String streamId = session.getActiveConnections().stream().filter(c ->
// c.getPublishers().size() > 0).findFirst()
// .get().getPublishers().get(0).getStreamId(); // .get().getPublishers().get(0).getStreamId();
// waitUntilFileExistsAndIsBiggerThan("/opt/openvidu/recordings/" + recording.getId() + "/" + streamId + "." // waitUntilFileExistsAndIsBiggerThan("/opt/openvidu/recordings/" +
// recording.getId() + "/" + streamId + "."
// + this.getIndividualRecordingExtension(), 200, 60); // + this.getIndividualRecordingExtension(), 200, 60);
try { try {
@ -3118,7 +3112,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
recording2 = OV.stopRecording(recording2.getId()); recording2 = OV.stopRecording(recording2.getId());
// The v2compat needs time after stop the recording for syncing the files from S3 // The v2compat needs time after stop the recording for syncing the files from
// S3
Thread.sleep(1000); Thread.sleep(1000);
user.getEventManager().waitUntilEventReaches("recordingStopped", 3); user.getEventManager().waitUntilEventReaches("recordingStopped", 3);
@ -3143,9 +3138,11 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Assertions.assertTrue(file3.exists() && file3.length() > 0, // Assertions.assertTrue(file3.exists() && file3.length() > 0,
// "File " + file3.getAbsolutePath() + " does not exist or is empty"); // "File " + file3.getAbsolutePath() + " does not exist or is empty");
// Assertions.assertTrue(this.recordingUtils.recordedGreenFileFine(file1, recording2), // Assertions.assertTrue(this.recordingUtils.recordedGreenFileFine(file1,
// recording2),
// "Recorded file " + file1.getAbsolutePath() + " is not fine"); // "Recorded file " + file1.getAbsolutePath() + " is not fine");
// Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file3, RecordingUtils::checkVideoAverageRgbGreen), // Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(file3,
// RecordingUtils::checkVideoAverageRgbGreen),
// "Thumbnail " + file3.getAbsolutePath() + " is not fine"); // "Thumbnail " + file3.getAbsolutePath() + " is not fine");
try { try {
@ -3215,7 +3212,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
Assertions.assertFalse(session.fetch()); Assertions.assertFalse(session.fetch());
} }
@Test @Test
@OnlyKurento @OnlyKurento
@DisplayName("REST API test") @DisplayName("REST API test")
@ -3817,7 +3813,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// log.info("Media server reconnect active session no streams test"); // log.info("Media server reconnect active session no streams test");
// CountDownLatch initLatch = new CountDownLatch(1); // CountDownLatch initLatch = new CountDownLatch(1);
// io.openvidu.test.browsers.utils.webhook.CustomWebhook.main(new String[0], initLatch); // io.openvidu.test.browsers.utils.webhook.CustomWebhook.main(new String[0],
// initLatch);
// try { // try {
@ -3832,7 +3829,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// // TOTAL DISCONNECTION // // TOTAL DISCONNECTION
// // Session should be destroyed with reason nodeCrashed // // Session should be destroyed with reason nodeCrashed
// user.getDriver().findElement(By.id("add-user-btn")).click(); // user.getDriver().findElement(By.id("add-user-btn")).click();
// user.getDriver().findElements(By.className("publish-checkbox")).forEach(el -> el.click()); // user.getDriver().findElements(By.className("publish-checkbox")).forEach(el ->
// el.click());
// user.getDriver().findElement(By.className("join-btn")).click(); // user.getDriver().findElement(By.className("join-btn")).click();
// user.getEventManager().waitUntilEventReaches("connectionCreated", 1); // user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
@ -3841,19 +3839,23 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// OV.fetch(); // OV.fetch();
// List<Session> sessions = OV.getActiveSessions(); // List<Session> sessions = OV.getActiveSessions();
// Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but found " + sessions.size()); // Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but
// found " + sessions.size());
// Assertions.assertEquals(1, sessions.get(0).getActiveConnections().size(), // Assertions.assertEquals(1, sessions.get(0).getActiveConnections().size(),
// "Expected 1 active connection but found " + sessions.get(0).getActiveConnections().size()); // "Expected 1 active connection but found " +
// sessions.get(0).getActiveConnections().size());
// this.stopMediaServer(true); // this.stopMediaServer(true);
// user.getEventManager().waitUntilEventReaches("sessionDisconnected", 1); // user.getEventManager().waitUntilEventReaches("sessionDisconnected", 1);
// JsonObject event = CustomWebhook.waitForEvent("sessionDestroyed", 2); // JsonObject event = CustomWebhook.waitForEvent("sessionDestroyed", 2);
// Assertions.assertEquals("nodeCrashed", event.get("reason").getAsString(), "Wrong reason in webhook event"); // Assertions.assertEquals("nodeCrashed", event.get("reason").getAsString(),
// "Wrong reason in webhook event");
// OV.fetch(); // OV.fetch();
// sessions = OV.getActiveSessions(); // sessions = OV.getActiveSessions();
// Assertions.assertEquals(0, sessions.size(), "Expected no active sessions but found " + sessions.size()); // Assertions.assertEquals(0, sessions.size(), "Expected no active sessions but
// found " + sessions.size());
// user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER); // user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER);
// // NO MEDIA SERVER // // NO MEDIA SERVER
@ -3866,9 +3868,11 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// try { // try {
// user.getWaiter().until(ExpectedConditions.alertIsPresent()); // user.getWaiter().until(ExpectedConditions.alertIsPresent());
// Alert alert = user.getDriver().switchTo().alert(); // Alert alert = user.getDriver().switchTo().alert();
// final String alertMessage = "Error connecting to the session: There is no available Media Node where to initialize session 'TestSession'. Code: 204"; // final String alertMessage = "Error connecting to the session: There is no
// available Media Node where to initialize session 'TestSession'. Code: 204";
// Assertions.assertTrue(alert.getText().contains(alertMessage), // Assertions.assertTrue(alert.getText().contains(alertMessage),
// "Alert message wrong. Expected to contain: \"" + alertMessage + "\". Actual message: \"" // "Alert message wrong. Expected to contain: \"" + alertMessage + "\". Actual
// message: \""
// + alert.getText() + "\""); // + alert.getText() + "\"");
// alert.accept(); // alert.accept();
// } catch (Exception e) { // } catch (Exception e) {
@ -3879,7 +3883,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// OV.fetch(); // OV.fetch();
// sessions = OV.getActiveSessions(); // sessions = OV.getActiveSessions();
// Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but found " + sessions.size()); // Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but
// found " + sessions.size());
// user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER); // user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER);
// this.closeAllSessions(OV); // this.closeAllSessions(OV);
@ -3887,11 +3892,13 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// // RECONNECTION // // RECONNECTION
// // Nothing should happen as long as there were no streams while reconnecting // // Nothing should happen as long as there were no streams while reconnecting
// // A publisher should be able to publish normally after media server reconnected // // A publisher should be able to publish normally after media server
// reconnected
// this.startMediaServer(true); // this.startMediaServer(true);
// user.getDriver().findElement(By.id("add-user-btn")).click(); // user.getDriver().findElement(By.id("add-user-btn")).click();
// user.getDriver().findElements(By.className("publish-checkbox")).forEach(el -> el.click()); // user.getDriver().findElements(By.className("publish-checkbox")).forEach(el ->
// el.click());
// user.getDriver().findElement(By.className("join-btn")).click(); // user.getDriver().findElement(By.className("join-btn")).click();
// user.getEventManager().waitUntilEventReaches("connectionCreated", 1); // user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
@ -3900,16 +3907,19 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// OV.fetch(); // OV.fetch();
// sessions = OV.getActiveSessions(); // sessions = OV.getActiveSessions();
// Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but found " + sessions.size()); // Assertions.assertEquals(1, sessions.size(), "Expected 1 active sessions but
// found " + sessions.size());
// Assertions.assertEquals(1, sessions.get(0).getActiveConnections().size(), // Assertions.assertEquals(1, sessions.get(0).getActiveConnections().size(),
// "Expected 1 active connection but found " + sessions.get(0).getActiveConnections().size()); // "Expected 1 active connection but found " +
// sessions.get(0).getActiveConnections().size());
// this.stopMediaServer(false); // this.stopMediaServer(false);
// this.startMediaServer(true); // this.startMediaServer(true);
// user.getEventManager().resetEventThread(true); // user.getEventManager().resetEventThread(true);
// user.getDriver().findElement(By.id("add-user-btn")).click(); // user.getDriver().findElement(By.id("add-user-btn")).click();
// user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .join-btn")).click(); // user.getDriver().findElement(By.cssSelector("#openvidu-instance-1
// .join-btn")).click();
// user.getEventManager().waitUntilEventReaches("streamCreated", 2); // user.getEventManager().waitUntilEventReaches("streamCreated", 2);
// user.getEventManager().waitUntilEventReaches("streamPlaying", 2); // user.getEventManager().waitUntilEventReaches("streamPlaying", 2);
@ -4111,7 +4121,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
@DisplayName("Webhook test") @DisplayName("Webhook test")
void webhookTest() throws Exception { void webhookTest() throws Exception {
isRecordingTest = true; isRecordingTest = true;
CountDownLatch initLatch = new CountDownLatch(1); CountDownLatch initLatch = new CountDownLatch(1);
@ -4129,10 +4138,13 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
return; return;
} }
// This test occasionally fails due to leftover events in the queue from previous tests. // This test occasionally fails due to leftover events in the queue from
// previous tests.
// To address this, we clean the queue before starting the test. // To address this, we clean the queue before starting the test.
// The beforeEach method does not handle queue cleanup because the v2 compatibility // The beforeEach method does not handle queue cleanup because the v2
// server requires additional time after stopping a recording before it can be deleted, // compatibility
// server requires additional time after stopping a recording before it can be
// deleted,
// causing the beforeEach logic to be bypassed. // causing the beforeEach logic to be bypassed.
// To ensure stability, we add a delay and perform manual cleanup: // To ensure stability, we add a delay and perform manual cleanup:
Thread.sleep(7000); Thread.sleep(7000);
@ -4271,12 +4283,15 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
"Wrong recording status in webhook event"); "Wrong recording status in webhook event");
Assertions.assertEquals(0, event.get("size").getAsLong(), "Wrong recording outputMode in webhook event"); Assertions.assertEquals(0, event.get("size").getAsLong(), "Wrong recording outputMode in webhook event");
Assertions.assertEquals(0, event.get("duration").getAsLong(), "Wrong recording duration in webhook event"); Assertions.assertEquals(0, event.get("duration").getAsLong(), "Wrong recording duration in webhook event");
// Webhooks don't send the sessionClosedByServer reason, it only sends the recordingStoppedByServer // Webhooks don't send the sessionClosedByServer reason, it only sends the
// Assertions.assertEquals("sessionClosedByServer", event.get("reason").getAsString(), // recordingStoppedByServer
// Assertions.assertEquals("sessionClosedByServer",
// event.get("reason").getAsString(),
// "Wrong recording reason in webhook event"); // "Wrong recording reason in webhook event");
Assertions.assertEquals("recordingStoppedByServer", event.get("reason").getAsString(), Assertions.assertEquals("recordingStoppedByServer", event.get("reason").getAsString(),
"Wrong recording reason in webhook event"); "Wrong recording reason in webhook event");
// Assertions.assertEquals(rec.getCreatedAt(), event.get("startTime").getAsLong(), // Assertions.assertEquals(rec.getCreatedAt(),
// event.get("startTime").getAsLong(),
// "Wrong recording startTime in webhook event"); // "Wrong recording startTime in webhook event");
event = CustomWebhook.waitForEvent("recordingStatusChanged", 2); event = CustomWebhook.waitForEvent("recordingStatusChanged", 2);
@ -4292,13 +4307,16 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
"Wrong recording status in webhook event"); "Wrong recording status in webhook event");
Assertions.assertTrue(event.get("size").getAsLong() > 0, "Wrong recording size in webhook event"); Assertions.assertTrue(event.get("size").getAsLong() > 0, "Wrong recording size in webhook event");
Assertions.assertTrue(event.get("duration").getAsLong() > 0, "Wrong recording duration in webhook event"); Assertions.assertTrue(event.get("duration").getAsLong() > 0, "Wrong recording duration in webhook event");
// Webhooks don't send the sessionClosedByServer reason, it only sends the recordingStoppedByServer // Webhooks don't send the sessionClosedByServer reason, it only sends the
// Assertions.assertEquals("sessionClosedByServer", event.get("reason").getAsString(), // recordingStoppedByServer
// Assertions.assertEquals("sessionClosedByServer",
// event.get("reason").getAsString(),
// "Wrong recording reason in webhook event"); // "Wrong recording reason in webhook event");
Assertions.assertEquals("recordingStoppedByServer", event.get("reason").getAsString(), Assertions.assertEquals("recordingStoppedByServer", event.get("reason").getAsString(),
"Wrong recording reason in webhook event"); "Wrong recording reason in webhook event");
// Assertions.assertEquals(rec.getCreatedAt(), event.get("startTime").getAsLong(), // Assertions.assertEquals(rec.getCreatedAt(),
// event.get("startTime").getAsLong(),
// "Wrong recording startTime in webhook event"); // "Wrong recording startTime in webhook event");
event = CustomWebhook.waitForEvent("sessionDestroyed", 2); event = CustomWebhook.waitForEvent("sessionDestroyed", 2);