mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: WebDriverManager updated. OperaUser added
parent
c50fc70d33
commit
cd3630d89e
|
@ -76,13 +76,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.bonigarcia</groupId>
|
<groupId>io.github.bonigarcia</groupId>
|
||||||
<artifactId>selenium-jupiter</artifactId>
|
<artifactId>selenium-jupiter</artifactId>
|
||||||
<version>${selenium-jupiter.version}</version>
|
<version>2.2.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.bonigarcia</groupId>
|
<groupId>io.github.bonigarcia</groupId>
|
||||||
<artifactId>webdrivermanager</artifactId>
|
<artifactId>webdrivermanager</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>2.2.4</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,9 @@
|
||||||
package io.openvidu.test.e2e;
|
package io.openvidu.test.e2e;
|
||||||
|
|
||||||
import static java.lang.invoke.MethodHandles.lookup;
|
import static java.lang.invoke.MethodHandles.lookup;
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.openqa.selenium.OutputType.BASE64;
|
import static org.openqa.selenium.OutputType.BASE64;
|
||||||
import org.slf4j.Logger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -32,14 +31,18 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.junit.jupiter.api.*;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.platform.runner.JUnitPlatform;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.junit.platform.runner.JUnitPlatform;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.Keys;
|
import org.openqa.selenium.Keys;
|
||||||
|
@ -48,15 +51,15 @@ import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.ui.ExpectedCondition;
|
import org.openqa.selenium.support.ui.ExpectedCondition;
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import io.github.bonigarcia.SeleniumExtension;
|
import io.github.bonigarcia.SeleniumExtension;
|
||||||
import io.github.bonigarcia.wdm.ChromeDriverManager;
|
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||||
import io.github.bonigarcia.wdm.FirefoxDriverManager;
|
|
||||||
|
|
||||||
import io.openvidu.test.e2e.browser.BrowserUser;
|
import io.openvidu.test.e2e.browser.BrowserUser;
|
||||||
import io.openvidu.test.e2e.browser.ChromeAndroidUser;
|
import io.openvidu.test.e2e.browser.ChromeAndroidUser;
|
||||||
import io.openvidu.test.e2e.browser.ChromeUser;
|
import io.openvidu.test.e2e.browser.ChromeUser;
|
||||||
import io.openvidu.test.e2e.browser.FirefoxUser;
|
import io.openvidu.test.e2e.browser.FirefoxUser;
|
||||||
|
import io.openvidu.test.e2e.browser.OperaUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* E2E tests for openvidu-testapp.
|
* E2E tests for openvidu-testapp.
|
||||||
|
@ -82,8 +85,8 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
@BeforeAll()
|
@BeforeAll()
|
||||||
static void setupAll() {
|
static void setupAll() {
|
||||||
ChromeDriverManager.getInstance().setup();
|
WebDriverManager.chromedriver().setup();
|
||||||
FirefoxDriverManager.getInstance().setup();
|
WebDriverManager.firefoxdriver().setup();
|
||||||
|
|
||||||
String appUrl = System.getProperty("APP_URL");
|
String appUrl = System.getProperty("APP_URL");
|
||||||
if (appUrl != null) {
|
if (appUrl != null) {
|
||||||
|
@ -113,11 +116,15 @@ public class OpenViduTestAppE2eTest {
|
||||||
case "firefox":
|
case "firefox":
|
||||||
this.user = new FirefoxUser("TestUser", 50);
|
this.user = new FirefoxUser("TestUser", 50);
|
||||||
break;
|
break;
|
||||||
|
case "opera":
|
||||||
|
this.user = new OperaUser("TestUser", 50);
|
||||||
|
break;
|
||||||
case "chromeAndroid":
|
case "chromeAndroid":
|
||||||
this.user = new ChromeAndroidUser("TestUser", 50);
|
this.user = new ChromeAndroidUser("TestUser", 50);
|
||||||
break;
|
break;
|
||||||
case "chromeAlternateScreenShare":
|
case "chromeAlternateScreenShare":
|
||||||
this.user = new ChromeUser("TestUser", 50, "OpenVidu TestApp");
|
this.user = new ChromeUser("TestUser", 50, "OpenVidu TestApp");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.user = new ChromeUser("TestUser", 50);
|
this.user = new ChromeUser("TestUser", 50);
|
||||||
}
|
}
|
||||||
|
@ -1062,6 +1069,37 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled
|
||||||
|
@DisplayName("One2One Opera [Video + Audio]")
|
||||||
|
void oneToOneVideoAudioSessionOpera() throws Exception {
|
||||||
|
|
||||||
|
WebDriverManager.operadriver().setup();
|
||||||
|
setupBrowser("opera");
|
||||||
|
|
||||||
|
log.info("One2One Opera [Video + Audio]");
|
||||||
|
|
||||||
|
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
|
||||||
|
user.getDriver().findElement(By.id("one2one-btn")).click();
|
||||||
|
|
||||||
|
user.getEventManager().waitUntilEventReaches("connectionCreated", 4);
|
||||||
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 2);
|
||||||
|
user.getEventManager().waitUntilEventReaches("streamCreated", 4);
|
||||||
|
user.getEventManager().waitUntilEventReaches("streamPlaying", 4);
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.println(getBase64Screenshot(user));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertEquals(user.getDriver().findElements(By.tagName("video")).size(), 4);
|
||||||
|
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")),
|
||||||
|
true, true));
|
||||||
|
|
||||||
|
gracefullyLeaveParticipants(2);
|
||||||
|
}
|
||||||
|
|
||||||
private void listEmptyRecordings() {
|
private void listEmptyRecordings() {
|
||||||
// List existing recordings (empty)
|
// List existing recordings (empty)
|
||||||
user.getDriver().findElement(By.id("list-recording-btn")).click();
|
user.getDriver().findElement(By.id("list-recording-btn")).click();
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package io.openvidu.test.e2e.browser;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.openqa.selenium.opera.OperaDriver;
|
||||||
|
import org.openqa.selenium.opera.OperaOptions;
|
||||||
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||||
|
|
||||||
|
public class OperaUser extends BrowserUser {
|
||||||
|
|
||||||
|
public OperaUser(String userName, int timeOfWaitInSeconds) {
|
||||||
|
super(userName, timeOfWaitInSeconds);
|
||||||
|
|
||||||
|
OperaOptions options = new OperaOptions();
|
||||||
|
options.setBinary("/usr/bin/opera");
|
||||||
|
DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
|
||||||
|
capabilities.setAcceptInsecureCerts(true);
|
||||||
|
|
||||||
|
options.addArguments("--use-fake-ui-for-media-stream");
|
||||||
|
options.addArguments("--use-fake-device-for-media-stream");
|
||||||
|
capabilities.setCapability(OperaOptions.CAPABILITY, options);
|
||||||
|
|
||||||
|
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), capabilities);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("Using local web driver");
|
||||||
|
this.driver = new OperaDriver(capabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
|
||||||
|
this.configureDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue