mirror of https://github.com/OpenVidu/openvidu.git
e2e test environment refactoring
parent
8bea39fc91
commit
2f6d3db99d
|
@ -1,25 +1,61 @@
|
||||||
FROM elastest/ci-docker-e2e
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
MAINTAINER openvidu@gmail.com
|
MAINTAINER openvidu@gmail.com
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
RUN apt-get update && apt-get -y install sudo
|
RUN apt-get update && apt-get -y upgrade
|
||||||
|
|
||||||
|
RUN apt-get install -y software-properties-common && apt-get install -y --no-install-recommends apt-utils
|
||||||
|
|
||||||
# Install Kurento Media Server (KMS)
|
# Install Kurento Media Server (KMS)
|
||||||
RUN echo "deb http://ubuntu.kurento.org xenial kms6" | tee /etc/apt/sources.list.d/kurento.list \
|
RUN echo "deb http://ubuntu.kurento.org xenial kms6" | tee /etc/apt/sources.list.d/kurento.list \
|
||||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv 2F819BC0 \
|
&& apt-key adv --keyserver keyserver.ubuntu.com --recv 2F819BC0 \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get -y dist-upgrade \
|
&& apt-get -y dist-upgrade \
|
||||||
&& apt-get -y install kurento-media-server-6.0 \
|
&& apt-get -y install kurento-media-server-6.0
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install Node
|
# Install Node
|
||||||
RUN sudo curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - && sudo apt-get install -y nodejs
|
RUN apt-get update && apt-get install -y curl
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs
|
||||||
|
|
||||||
# Install angular-cli
|
# Java
|
||||||
RUN sudo npm install -g @angular/cli
|
RUN apt-get install -y default-jdk
|
||||||
|
|
||||||
# Install http-server
|
# Maven
|
||||||
RUN sudo npm install -g http-server
|
RUN apt-get install -y maven
|
||||||
|
|
||||||
CMD ["sleep","10"]
|
# git
|
||||||
|
RUN apt-get install -y git
|
||||||
|
|
||||||
|
# angular-cli
|
||||||
|
RUN npm install -g @angular/cli
|
||||||
|
|
||||||
|
# http-server
|
||||||
|
RUN npm install -g http-server
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
#RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||||
|
#RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||||
|
#RUN apt-get update
|
||||||
|
#RUN apt-get -y install docker-ce
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
RUN apt-get -y install sudo
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN apt-get autoremove --purge -y
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN ["chmod", "+x", "/entrypoint.sh"]
|
||||||
|
|
||||||
|
# Jenkins user
|
||||||
|
#RUN useradd -ms /bin/bash jenkins &&\
|
||||||
|
# echo "jenkins:jenkins" | chpasswd
|
||||||
|
#RUN usermod -aG docker jenkins
|
||||||
|
#ENV WORKSPACE /home/jenkins
|
||||||
|
#USER jenkins
|
||||||
|
#WORKDIR ${WORKSPACE}
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -1,105 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
|
sleep 100000000
|
||||||
|
|
||||||
git clone https://github.com/OpenVidu/openvidu.git
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "cd openvidu"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd openvidu
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "mvn compile && mvn install"
|
|
||||||
echo
|
|
||||||
|
|
||||||
mvn -DskipTests=true compile && mvn -DskipTests=true install
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "cd openvidu-browser"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd openvidu-browser
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "npm install"
|
|
||||||
echo
|
|
||||||
|
|
||||||
npm install --unsafe-perm
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "npm link"
|
|
||||||
echo
|
|
||||||
|
|
||||||
npm link --unsafe-perm
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "cd ../openvidu-testapp"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd ../openvidu-testapp
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "npm install"
|
|
||||||
echo
|
|
||||||
|
|
||||||
npm install
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "npm link openvidu-browser"
|
|
||||||
echo
|
|
||||||
|
|
||||||
npm link openvidu-browser
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "ng build"
|
|
||||||
echo
|
|
||||||
|
|
||||||
ng build
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "http-server dist/"
|
|
||||||
echo
|
|
||||||
|
|
||||||
http-server -p 4200 ./dist &> testapp.log &
|
|
||||||
|
|
||||||
until $(curl --output /dev/null --silent --head --fail http://localhost:4200/); do
|
|
||||||
echo 'waiting for openvidu-testapp...'
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "cd ../openvidu-server"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd ../openvidu-server
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "service kurento-media-server-6.0 start"
|
|
||||||
echo
|
|
||||||
|
|
||||||
service kurento-media-server-6.0 start
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "mvn clean compile package exec:java"
|
|
||||||
echo
|
|
||||||
|
|
||||||
mvn -DskipTests=true clean compile package exec:java &> openvidu-server.log &
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "cd ../openvidu-test-e2e"
|
|
||||||
echo
|
|
||||||
|
|
||||||
cd ../openvidu-test-e2e
|
|
||||||
|
|
||||||
until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:8443/); do
|
|
||||||
echo 'waiting for openvidu-server...'
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "mvn test"
|
|
||||||
echo
|
|
||||||
|
|
||||||
mvn test
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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.slf4j.LoggerFactory.getLogger;
|
||||||
import static java.lang.System.getProperty;
|
|
||||||
|
|
||||||
import static org.openqa.selenium.OutputType.BASE64;
|
import static org.openqa.selenium.OutputType.BASE64;
|
||||||
|
|
||||||
|
@ -77,19 +76,19 @@ public class OpenViduTestAppE2eTest {
|
||||||
ChromeDriverManager.getInstance().setup();
|
ChromeDriverManager.getInstance().setup();
|
||||||
FirefoxDriverManager.getInstance().setup();
|
FirefoxDriverManager.getInstance().setup();
|
||||||
|
|
||||||
String appUrl = getProperty("app.url");
|
String appUrl = System.getProperty("APP_URL");
|
||||||
if (appUrl != null) {
|
if (appUrl != null) {
|
||||||
APP_URL = appUrl;
|
APP_URL = appUrl;
|
||||||
}
|
}
|
||||||
log.info("Using URL {} to connect to openvidu-testapp", APP_URL);
|
log.info("Using URL {} to connect to openvidu-testapp", APP_URL);
|
||||||
|
|
||||||
String openviduUrl = getProperty("openvidu.url");
|
String openviduUrl = System.getProperty("OPENVIDU_URL");
|
||||||
if (openviduUrl != null) {
|
if (openviduUrl != null) {
|
||||||
OPENVIDU_URL = openviduUrl;
|
OPENVIDU_URL = openviduUrl;
|
||||||
}
|
}
|
||||||
log.info("Using URL {} to connect to openvidu-server", OPENVIDU_URL);
|
log.info("Using URL {} to connect to openvidu-server", OPENVIDU_URL);
|
||||||
|
|
||||||
String openvidusecret = getProperty("openvidu.secret");
|
String openvidusecret = System.getProperty("OPENVIDU_SECRET");
|
||||||
if (openvidusecret != null) {
|
if (openvidusecret != null) {
|
||||||
OPENVIDU_SECRET = openvidusecret;
|
OPENVIDU_SECRET = openvidusecret;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +457,6 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
|
||||||
@DisplayName("One2One Firefox [Video + Audio]")
|
@DisplayName("One2One Firefox [Video + Audio]")
|
||||||
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
||||||
|
|
||||||
|
@ -493,7 +491,6 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
|
||||||
@DisplayName("Cross-Browser test")
|
@DisplayName("Cross-Browser test")
|
||||||
void crossBrowserTest() throws Exception {
|
void crossBrowserTest() throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,19 @@
|
||||||
|
|
||||||
package io.openvidu.test.e2e.browser;
|
package io.openvidu.test.e2e.browser;
|
||||||
|
|
||||||
|
import static java.lang.invoke.MethodHandles.lookup;
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import io.openvidu.test.e2e.OpenViduEventManager;
|
import io.openvidu.test.e2e.OpenViduEventManager;
|
||||||
|
|
||||||
public class BrowserUser {
|
public class BrowserUser {
|
||||||
|
|
||||||
|
final static Logger log = getLogger(lookup().lookupClass());
|
||||||
|
|
||||||
protected WebDriver driver;
|
protected WebDriver driver;
|
||||||
protected WebDriverWait waiter;
|
protected WebDriverWait waiter;
|
||||||
protected String clientData;
|
protected String clientData;
|
||||||
|
|
|
@ -18,9 +18,13 @@
|
||||||
package io.openvidu.test.e2e.browser;
|
package io.openvidu.test.e2e.browser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
import org.openqa.selenium.chrome.ChromeDriver;
|
||||||
import org.openqa.selenium.chrome.ChromeOptions;
|
import org.openqa.selenium.chrome.ChromeOptions;
|
||||||
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
public class ChromeUser extends BrowserUser {
|
public class ChromeUser extends BrowserUser {
|
||||||
|
@ -28,6 +32,9 @@ public class ChromeUser extends BrowserUser {
|
||||||
public ChromeUser(String userName, int timeOfWaitInSeconds) {
|
public ChromeUser(String userName, int timeOfWaitInSeconds) {
|
||||||
super(userName, timeOfWaitInSeconds);
|
super(userName, timeOfWaitInSeconds);
|
||||||
|
|
||||||
|
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
|
||||||
|
capabilities.setAcceptInsecureCerts(true);
|
||||||
|
|
||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
// This flag avoids to grant the user media
|
// This flag avoids to grant the user media
|
||||||
options.addArguments("--use-fake-ui-for-media-stream");
|
options.addArguments("--use-fake-ui-for-media-stream");
|
||||||
|
@ -43,9 +50,22 @@ public class ChromeUser extends BrowserUser {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.driver = new ChromeDriver(options);
|
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
|
||||||
this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
|
String REMOTE_URL = System.getProperty("REMOTE_URL_CHROME");
|
||||||
|
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 ChromeDriver(capabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
|
||||||
this.configureDriver();
|
this.configureDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,28 +17,42 @@
|
||||||
|
|
||||||
package io.openvidu.test.e2e.browser;
|
package io.openvidu.test.e2e.browser;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
import org.openqa.selenium.firefox.FirefoxProfile;
|
import org.openqa.selenium.firefox.FirefoxProfile;
|
||||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||||
|
|
||||||
public class FirefoxUser extends BrowserUser {
|
public class FirefoxUser extends BrowserUser {
|
||||||
|
|
||||||
public FirefoxUser(String userName, int timeOfWaitInSeconds) {
|
public FirefoxUser(String userName, int timeOfWaitInSeconds) {
|
||||||
super(userName, timeOfWaitInSeconds);
|
super(userName, timeOfWaitInSeconds);
|
||||||
|
|
||||||
DesiredCapabilities capabilities = new DesiredCapabilities();
|
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
|
||||||
capabilities.setCapability("acceptInsecureCerts", true);
|
capabilities.setAcceptInsecureCerts(true);
|
||||||
FirefoxProfile profile = new FirefoxProfile();
|
FirefoxProfile profile = new FirefoxProfile();
|
||||||
|
|
||||||
// This flag avoids granting the access to the camera
|
// This flag avoids granting the access to the camera
|
||||||
profile.setPreference("media.navigator.permission.disabled", true);
|
profile.setPreference("media.navigator.permission.disabled", true);
|
||||||
// This flag force to use fake user media (synthetic video of multiple
|
// This flag force to use fake user media (synthetic video of multiple color)
|
||||||
// color)
|
|
||||||
profile.setPreference("media.navigator.streams.fake", true);
|
profile.setPreference("media.navigator.streams.fake", true);
|
||||||
|
|
||||||
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
|
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
|
||||||
|
|
||||||
|
String REMOTE_URL = System.getProperty("REMOTE_URL_FIREFOX");
|
||||||
|
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 FirefoxDriver(capabilities);
|
this.driver = new FirefoxDriver(capabilities);
|
||||||
|
}
|
||||||
|
|
||||||
this.configureDriver();
|
this.configureDriver();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue