mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: openvidu-test-browsers project
parent
163da1759a
commit
d62f2f31eb
|
@ -0,0 +1,149 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-parent</artifactId>
|
||||
<version>1.9.0-beta-1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>openvidu-test-browsers</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>OpenVidu Test Browsers</name>
|
||||
<description>Browser wrapper for OpenVidu e2e testing</description>
|
||||
<url>https://openvidu.io</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<organization>
|
||||
<name>OpenVidu</name>
|
||||
<url>https://openvidu.io</url>
|
||||
</organization>
|
||||
|
||||
<scm>
|
||||
<url>https://github.com/OpenVidu/openvidu.git</url>
|
||||
<connection>scm:git:https://github.com/OpenVidu/openvidu.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/OpenVidu/openvidu.git</developerConnection>
|
||||
<tag>develop</tag>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>openvidu.io</id>
|
||||
<name>-openvidu.io Community</name>
|
||||
<organization>openvidu.io</organization>
|
||||
<organizationUrl>https://openvidu.io</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<!-- Java 8 -->
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
<!-- Encoding -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<!-- Test dependencies version -->
|
||||
<junit.jupiter.version>5.4.0</junit.jupiter.version>
|
||||
<junit.platform.version>1.4.0</junit.platform.version>
|
||||
<org-seleniumhq-selenium.version>3.141.59</org-seleniumhq-selenium.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.26</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>${org-seleniumhq-selenium.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-chrome-driver</artifactId>
|
||||
<version>${org-seleniumhq-selenium.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-firefox-driver</artifactId>
|
||||
<version>${org-seleniumhq-selenium.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -15,27 +15,20 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package io.openvidu.test.e2e.browser;
|
||||
package io.openvidu.test.browsers;
|
||||
|
||||
import static java.lang.invoke.MethodHandles.lookup;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import io.openvidu.test.e2e.OpenViduEventManager;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class BrowserUser {
|
||||
|
||||
final static Logger log = getLogger(lookup().lookupClass());
|
||||
protected static final org.slf4j.Logger log = LoggerFactory.getLogger(BrowserUser.class);
|
||||
|
||||
protected WebDriver driver;
|
||||
protected WebDriverWait waiter;
|
||||
protected String clientData;
|
||||
protected int timeOfWaitInSeconds;
|
||||
protected OpenViduEventManager eventManager;
|
||||
|
||||
public BrowserUser(String clientData, int timeOfWaitInSeconds) {
|
||||
this.clientData = clientData;
|
||||
|
@ -50,10 +43,6 @@ public class BrowserUser {
|
|||
return this.waiter;
|
||||
}
|
||||
|
||||
public OpenViduEventManager getEventManager() {
|
||||
return this.eventManager;
|
||||
}
|
||||
|
||||
public String getClientData() {
|
||||
return this.clientData;
|
||||
}
|
||||
|
@ -68,12 +57,10 @@ public class BrowserUser {
|
|||
|
||||
protected void configureDriver() {
|
||||
this.waiter = new WebDriverWait(this.driver, this.timeOfWaitInSeconds);
|
||||
this.eventManager = new OpenViduEventManager(this.driver, this.timeOfWaitInSeconds);
|
||||
this.driver.manage().window().setSize(new Dimension(1920,1080));
|
||||
this.driver.manage().window().setSize(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
this.eventManager.stopPolling(true);
|
||||
this.driver.quit();
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package io.openvidu.test.e2e.browser;
|
||||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package io.openvidu.test.e2e.browser;
|
||||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package io.openvidu.test.e2e.browser;
|
||||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
|
@ -1,4 +1,4 @@
|
|||
package io.openvidu.test.e2e.browser;
|
||||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
|
@ -161,6 +161,12 @@
|
|||
<version>0.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-test-browsers</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-java-client</artifactId>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package io.openvidu.test.e2e;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import io.openvidu.test.browsers.BrowserUser;
|
||||
|
||||
public class MyUser {
|
||||
|
||||
BrowserUser browserUser;
|
||||
private OpenViduEventManager eventManager;
|
||||
|
||||
public MyUser(BrowserUser browserUser) {
|
||||
this.browserUser = browserUser;
|
||||
this.eventManager = new OpenViduEventManager(this.browserUser.getDriver(), this.browserUser.getTimeOfWait());
|
||||
}
|
||||
|
||||
public WebDriver getDriver() {
|
||||
return this.browserUser.getDriver();
|
||||
}
|
||||
|
||||
public WebDriverWait getWaiter() {
|
||||
return this.browserUser.getWaiter();
|
||||
}
|
||||
|
||||
public OpenViduEventManager getEventManager() {
|
||||
return this.eventManager;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
this.eventManager.stopPolling(true);
|
||||
this.browserUser.dispose();
|
||||
}
|
||||
|
||||
}
|
|
@ -95,11 +95,11 @@ import io.openvidu.java.client.RecordingProperties;
|
|||
import io.openvidu.java.client.Session;
|
||||
import io.openvidu.java.client.SessionProperties;
|
||||
import io.openvidu.java.client.TokenOptions;
|
||||
import io.openvidu.test.e2e.browser.BrowserUser;
|
||||
import io.openvidu.test.e2e.browser.ChromeAndroidUser;
|
||||
import io.openvidu.test.e2e.browser.ChromeUser;
|
||||
import io.openvidu.test.e2e.browser.FirefoxUser;
|
||||
import io.openvidu.test.e2e.browser.OperaUser;
|
||||
import io.openvidu.test.browsers.BrowserUser;
|
||||
import io.openvidu.test.browsers.ChromeAndroidUser;
|
||||
import io.openvidu.test.browsers.ChromeUser;
|
||||
import io.openvidu.test.browsers.FirefoxUser;
|
||||
import io.openvidu.test.browsers.OperaUser;
|
||||
import io.openvidu.test.e2e.utils.CommandLineExecutor;
|
||||
import io.openvidu.test.e2e.utils.CustomHttpClient;
|
||||
import io.openvidu.test.e2e.utils.MultimediaFileMetadata;
|
||||
|
@ -124,8 +124,8 @@ public class OpenViduTestAppE2eTest {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(OpenViduTestAppE2eTest.class);
|
||||
|
||||
BrowserUser user;
|
||||
Collection<BrowserUser> otherUsers = new ArrayList<>();
|
||||
MyUser user;
|
||||
Collection<MyUser> otherUsers = new ArrayList<>();
|
||||
volatile static boolean isRecordingTest;
|
||||
volatile static boolean isKurentoRestartTest;
|
||||
private static OpenVidu OV;
|
||||
|
@ -174,29 +174,33 @@ public class OpenViduTestAppE2eTest {
|
|||
|
||||
void setupBrowser(String browser) {
|
||||
|
||||
BrowserUser browserUser;
|
||||
|
||||
switch (browser) {
|
||||
case "chrome":
|
||||
this.user = new ChromeUser("TestUser", 50, false);
|
||||
browserUser = new ChromeUser("TestUser", 50, false);
|
||||
break;
|
||||
case "firefox":
|
||||
this.user = new FirefoxUser("TestUser", 50);
|
||||
browserUser = new FirefoxUser("TestUser", 50);
|
||||
break;
|
||||
case "opera":
|
||||
this.user = new OperaUser("TestUser", 50);
|
||||
browserUser = new OperaUser("TestUser", 50);
|
||||
break;
|
||||
case "chromeAndroid":
|
||||
this.user = new ChromeAndroidUser("TestUser", 50);
|
||||
browserUser = new ChromeAndroidUser("TestUser", 50);
|
||||
break;
|
||||
case "chromeAlternateScreenShare":
|
||||
this.user = new ChromeUser("TestUser", 50, "OpenVidu TestApp", false);
|
||||
browserUser = new ChromeUser("TestUser", 50, "OpenVidu TestApp", false);
|
||||
break;
|
||||
case "chromeAsRoot":
|
||||
this.user = new ChromeUser("TestUser", 50, true);
|
||||
browserUser = new ChromeUser("TestUser", 50, true);
|
||||
break;
|
||||
default:
|
||||
this.user = new ChromeUser("TestUser", 50, false);
|
||||
browserUser = new ChromeUser("TestUser", 50, false);
|
||||
}
|
||||
|
||||
this.user = new MyUser(browserUser);
|
||||
|
||||
user.getDriver().get(APP_URL);
|
||||
|
||||
WebElement urlInput = user.getDriver().findElement(By.id("openvidu-url"));
|
||||
|
@ -210,7 +214,7 @@ public class OpenViduTestAppE2eTest {
|
|||
}
|
||||
|
||||
void setupChromeWithFakeVideo(Path videoFileLocation) {
|
||||
this.user = new ChromeUser("TestUser", 50, videoFileLocation);
|
||||
this.user = new MyUser(new ChromeUser("TestUser", 50, videoFileLocation));
|
||||
user.getDriver().get(APP_URL);
|
||||
WebElement urlInput = user.getDriver().findElement(By.id("openvidu-url"));
|
||||
urlInput.clear();
|
||||
|
@ -226,9 +230,9 @@ public class OpenViduTestAppE2eTest {
|
|||
if (user != null) {
|
||||
user.dispose();
|
||||
}
|
||||
Iterator<BrowserUser> it = otherUsers.iterator();
|
||||
Iterator<MyUser> it = otherUsers.iterator();
|
||||
while (it.hasNext()) {
|
||||
BrowserUser other = it.next();
|
||||
MyUser other = it.next();
|
||||
other.dispose();
|
||||
it.remove();
|
||||
}
|
||||
|
@ -508,7 +512,7 @@ public class OpenViduTestAppE2eTest {
|
|||
};
|
||||
|
||||
Thread t = new Thread(() -> {
|
||||
BrowserUser user2 = new FirefoxUser("TestUser", 30);
|
||||
MyUser user2 = new MyUser(new FirefoxUser("TestUser", 30));
|
||||
otherUsers.add(user2);
|
||||
user2.getDriver().get(APP_URL);
|
||||
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
||||
|
@ -1350,7 +1354,7 @@ public class OpenViduTestAppE2eTest {
|
|||
};
|
||||
|
||||
Thread t = new Thread(() -> {
|
||||
BrowserUser user2 = new FirefoxUser("FirefoxUser", 30);
|
||||
MyUser user2 = new MyUser(new FirefoxUser("FirefoxUser", 30));
|
||||
otherUsers.add(user2);
|
||||
user2.getDriver().get(APP_URL);
|
||||
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
||||
|
@ -1927,7 +1931,7 @@ public class OpenViduTestAppE2eTest {
|
|||
isRecordingTest = true;
|
||||
|
||||
setupBrowser("chromeAlternateScreenShare");
|
||||
|
||||
|
||||
user.getDriver().manage().window().setSize(new Dimension(1000, 800));
|
||||
|
||||
log.info("openvidu-java-client test");
|
||||
|
@ -2754,7 +2758,7 @@ public class OpenViduTestAppE2eTest {
|
|||
}
|
||||
}
|
||||
|
||||
private String getBase64Screenshot(BrowserUser user) throws Exception {
|
||||
private String getBase64Screenshot(MyUser user) throws Exception {
|
||||
String screenshotBase64 = ((TakesScreenshot) user.getDriver()).getScreenshotAs(BASE64);
|
||||
return "data:image/png;base64," + screenshotBase64;
|
||||
}
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -199,6 +199,7 @@
|
|||
<module>openvidu-client</module>
|
||||
<module>openvidu-test</module>
|
||||
<module>openvidu-test-e2e</module>
|
||||
<module>openvidu-test-browsers</module>
|
||||
<module>openvidu-java-client</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
@ -209,6 +210,7 @@
|
|||
<module>openvidu-client</module>
|
||||
<module>openvidu-test</module>
|
||||
<module>openvidu-test-e2e</module>
|
||||
<module>openvidu-test-browsers</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
@ -289,6 +291,10 @@
|
|||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-test-e2e</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-test-browsers</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.openvidu</groupId>
|
||||
<artifactId>openvidu-java-client</artifactId>
|
||||
|
|
Loading…
Reference in New Issue