e2e test environment refactoring

pull/20/head
pabloFuente 2017-12-06 21:35:38 +01:00
parent 8bea39fc91
commit 2f6d3db99d
6 changed files with 99 additions and 128 deletions

View File

@ -1,25 +1,61 @@
FROM elastest/ci-docker-e2e
FROM ubuntu:16.04
MAINTAINER openvidu@gmail.com
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)
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-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install kurento-media-server-6.0 \
&& rm -rf /var/lib/apt/lists/*
&& apt-get -y install kurento-media-server-6.0
# 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
RUN sudo npm install -g @angular/cli
# Java
RUN apt-get install -y default-jdk
# Install http-server
RUN sudo npm install -g http-server
# Maven
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"]

View File

@ -1,105 +1,3 @@
#!/bin/bash
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
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
sleep 100000000

View File

@ -19,7 +19,6 @@ package io.openvidu.test.e2e;
import static java.lang.invoke.MethodHandles.lookup;
import static org.slf4j.LoggerFactory.getLogger;
import static java.lang.System.getProperty;
import static org.openqa.selenium.OutputType.BASE64;
@ -77,19 +76,19 @@ public class OpenViduTestAppE2eTest {
ChromeDriverManager.getInstance().setup();
FirefoxDriverManager.getInstance().setup();
String appUrl = getProperty("app.url");
String appUrl = System.getProperty("APP_URL");
if (appUrl != null) {
APP_URL = appUrl;
}
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) {
OPENVIDU_URL = openviduUrl;
}
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) {
OPENVIDU_SECRET = openvidusecret;
}
@ -458,7 +457,6 @@ public class OpenViduTestAppE2eTest {
}
@Test
@Disabled
@DisplayName("One2One Firefox [Video + Audio]")
void oneToOneVideoAudioSessionFirefox() throws Exception {
@ -493,7 +491,6 @@ public class OpenViduTestAppE2eTest {
}
@Test
@Disabled
@DisplayName("Cross-Browser test")
void crossBrowserTest() throws Exception {

View File

@ -17,12 +17,18 @@
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.support.ui.WebDriverWait;
import org.slf4j.Logger;
import io.openvidu.test.e2e.OpenViduEventManager;
public class BrowserUser {
final static Logger log = getLogger(lookup().lookupClass());
protected WebDriver driver;
protected WebDriverWait waiter;

View File

@ -18,15 +18,22 @@
package io.openvidu.test.e2e.browser;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.springframework.core.io.ClassPathResource;
public class ChromeUser extends BrowserUser {
public ChromeUser(String userName, int timeOfWaitInSeconds) {
super(userName, timeOfWaitInSeconds);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setAcceptInsecureCerts(true);
ChromeOptions options = new ChromeOptions();
// This flag avoids to grant the user media
@ -42,10 +49,23 @@ public class ChromeUser extends BrowserUser {
} catch (IOException e) {
e.printStackTrace();
}
this.driver = new ChromeDriver(options);
this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
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();
}

View File

@ -17,28 +17,42 @@
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.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class FirefoxUser extends BrowserUser {
public FirefoxUser(String userName, int timeOfWaitInSeconds) {
super(userName, timeOfWaitInSeconds);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("acceptInsecureCerts", true);
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setAcceptInsecureCerts(true);
FirefoxProfile profile = new FirefoxProfile();
// This flag avoids granting the access to the camera
profile.setPreference("media.navigator.permission.disabled", true);
// This flag force to use fake user media (synthetic video of multiple
// color)
// This flag force to use fake user media (synthetic video of multiple color)
profile.setPreference("media.navigator.streams.fake", true);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
this.driver = new FirefoxDriver(capabilities);
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.configureDriver();
}