Skip to content

Commit

Permalink
e2e: increate delay to setup some browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cruizba committed Dec 10, 2024
1 parent 33bcd91 commit 7e45b02
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ protected static void loadEnvironmentVariables() {
}

protected BrowserUser setupBrowser(String browser) throws Exception {
return setupBrowser(browser, 5000);
}

protected BrowserUser setupBrowser(String browser, long startDelay) throws Exception {

BrowserUser browserUser = null;
GenericContainer<?> container;
Expand All @@ -384,58 +388,58 @@ protected BrowserUser setupBrowser(String browser) throws Exception {
switch (browser) {
case "chrome":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
browserUser = new ChromeUser("TestUser", 50, true);
break;
case "chromeTwoInstances":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 2, true);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
browserUser = new ChromeUser("TestUser", 50, true);
break;
case "chromeAlternateScreenShare":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, false);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
browserUser = new ChromeUser("TestUser", 50, "OpenVidu TestApp");
break;
case "chromeAlternateFakeVideo":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
path = Paths.get("/opt/openvidu/barcode.y4m");
checkMediafilePath(path);
browserUser = new ChromeUser("TestUser", 50, path);
break;
case "chromeFakeAudio":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
path = Paths.get("/opt/openvidu/stt-test.wav");
checkMediafilePath(path);
browserUser = new ChromeUser("TestUser", 50, null, path);
break;
case "chromeVirtualBackgroundFakeVideo":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, false);
setupBrowserAux(BrowserNames.CHROME, container, false);
setupBrowserAux(BrowserNames.CHROME, container, false, startDelay);
path = Paths.get("/opt/openvidu/girl.mjpeg");
checkMediafilePath(path);
browserUser = new ChromeUser("TestUser", 50, path, false);
break;
case "firefox":
container = firefoxContainer("selenium/standalone-firefox:" + FIREFOX_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.FIREFOX, container, false);
setupBrowserAux(BrowserNames.FIREFOX, container, false, startDelay);
browserUser = new FirefoxUser("TestUser", 50, false);
break;
case "firefoxDisabledOpenH264":
container = firefoxContainer("selenium/standalone-firefox:" + FIREFOX_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.FIREFOX, container, false);
setupBrowserAux(BrowserNames.FIREFOX, container, false, startDelay);
browserUser = new FirefoxUser("TestUser", 50, true);
break;
case "opera":
container = operaContainer("selenium/standalone-opera:" + OPERA_VERSION, 2147483648L, 1);
setupBrowserAux(BrowserNames.OPERA, container, false);
setupBrowserAux(BrowserNames.OPERA, container, false, startDelay);
browserUser = new OperaUser("TestUser", 50);
break;
case "edge":
container = edgeContainer("selenium/standalone-edge:" + EDGE_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.EDGE, container, false);
setupBrowserAux(BrowserNames.EDGE, container, false, startDelay);
browserUser = new EdgeUser("TestUser", 50);
break;
case "androidChrome":
Expand All @@ -462,7 +466,7 @@ protected BrowserUser setupBrowser(String browser) throws Exception {
return browserUser;
}

private static boolean setupBrowserAux(BrowserNames browser, GenericContainer<?> container, boolean forceRestart) {
private static boolean setupBrowserAux(BrowserNames browser, GenericContainer<?> container, boolean forceRestart, long startDelay) {
if (isRemote(browser)) {
String dockerImage = container.getDockerImageName();
String ps = commandLine.executeCommand("docker ps | grep " + dockerImage, 30);
Expand All @@ -487,7 +491,7 @@ private static boolean setupBrowserAux(BrowserNames browser, GenericContainer<?>

protected static GenericContainer<?> setupDockerAndroidContainer() throws Exception {
GenericContainer<?> container = androidContainer(DOCKER_ANDROID_IMAGE, 4294967296L);
boolean newContainer = setupBrowserAux(BrowserNames.ANDROID, container, false);
boolean newContainer = setupBrowserAux(BrowserNames.ANDROID, container, false, 5000);
if (!newContainer) {
container = containers.stream().filter(c -> DOCKER_ANDROID_IMAGE.equals(c.getDockerImageName())).findFirst()
.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ private void connectToOpenViduTestApp(OpenViduTestappUser user) {
}

protected OpenViduTestappUser setupBrowserAndConnectToOpenViduTestapp(String browser) throws Exception {
BrowserUser browserUser = this.setupBrowser(browser);
BrowserUser browserUser = this.setupBrowser(browser, 5000);
OpenViduTestappUser testappUser = new OpenViduTestappUser(browserUser);
this.testappUsers.add(testappUser);
this.connectToOpenViduTestApp(testappUser);
return testappUser;
}

protected OpenViduTestappUser setupBrowserAndConnectToOpenViduTestapp(String browser, long startDelay) throws Exception {
BrowserUser browserUser = this.setupBrowser(browser, startDelay);
OpenViduTestappUser testappUser = new OpenViduTestappUser(browserUser);
this.testappUsers.add(testappUser);
this.connectToOpenViduTestApp(testappUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void oneToOneOpera() throws Exception {
@Test
@DisplayName("One2One Edge")
void oneToOneEdge() throws Exception {
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("edge");
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("edge", 20000);

Check failure on line 157 in openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

OpenViduTestAppE2eTest.oneToOneEdge

Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 'ca700415e502', ip: '172.18.0.2'
Raw output
org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'ca700415e502', ip: '172.18.0.2'
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
	at io.openvidu.test.browsers.EdgeUser.<init>(EdgeUser.java:30)
	at io.openvidu.test.e2e.OpenViduTestE2e.setupBrowser(OpenViduTestE2e.java:443)
	at io.openvidu.test.e2e.AbstractOpenViduTestappE2eTest.setupBrowserAndConnectToOpenViduTestapp(AbstractOpenViduTestappE2eTest.java:39)
	at io.openvidu.test.e2e.OpenViduTestAppE2eTest.oneToOneEdge(OpenViduTestAppE2eTest.java:157)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.12.1', revision: '8e34639b11'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.5.0-1025-azure', java.version: '11.0.20.1'
Driver info: driver.version: RemoteWebDriver
	at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:65)
	at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
	at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
	at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:48)
	at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:96)
	at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:54)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:115)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
	at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
	... 78 more
Caused by: java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1886)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2021)
	at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
	at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:59)
	... 89 more
log.info("One2One Edge");
oneToOneAux(user);
}
Expand Down Expand Up @@ -453,7 +453,7 @@ public void uncaughtException(Thread th, Throwable ex) {

Thread threadChrome = new Thread(() -> {
try {
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("chrome"), "Chrome");
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("chrome", 20000), "Chrome");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
System.err.println(errMsg);
Expand All @@ -463,7 +463,7 @@ public void uncaughtException(Thread th, Throwable ex) {
});
Thread threadFirefox = new Thread(() -> {
try {
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("firefox"), "Firefox");
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("firefox", 20000), "Firefox");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
System.err.println(errMsg);
Expand All @@ -473,7 +473,7 @@ public void uncaughtException(Thread th, Throwable ex) {
});
Thread threadEdge = new Thread(() -> {
try {
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("edge"), "Edge");
browserTest.apply(setupBrowserAndConnectToOpenViduTestapp("edge", 20000), "Edge");
} catch (Exception e) {
String errMsg = "Error setting up browser: " + e.getMessage();
System.err.println(errMsg);
Expand Down

0 comments on commit 7e45b02

Please sign in to comment.