mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: add opera test and refactor Jenkinsfile
parent
f695a13c88
commit
1c21a154cd
|
@ -1,171 +1,176 @@
|
||||||
node('container') {
|
node('container') {
|
||||||
sh 'docker rm -f chrome firefox e2e || true'
|
sh 'docker rm -f e2e chrome firefox opera || true'
|
||||||
|
sh 'rm -rf /opt/openvidu/* || true'
|
||||||
|
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/barcode.y4m -P /opt/openvidu'
|
||||||
|
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/fakeaudio.wav -P /opt/openvidu'
|
||||||
|
sh 'wget --directory-prefix=/opt/openvidu/test-layouts/layout1 https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-test-e2e/docker/my-custom-layout/index.html'
|
||||||
|
docker.image('openvidu/openvidu-test-e2e:$DISTRO').pull()
|
||||||
docker.image('selenium/standalone-chrome:latest').pull()
|
docker.image('selenium/standalone-chrome:latest').pull()
|
||||||
docker.image('selenium/standalone-firefox:latest').pull()
|
docker.image('selenium/standalone-firefox:latest').pull()
|
||||||
docker.image('selenium/standalone-chrome:latest').withRun('-p 6666:4444 --name chrome --shm-size=1g -v /opt/openvidu:/opt/openvidu') { c ->
|
docker.image('selenium/standalone-opera:latest').pull()
|
||||||
sh 'rm -rf /opt/openvidu/* || true'
|
|
||||||
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/barcode.y4m -P /opt/openvidu'
|
|
||||||
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/fakeaudio.wav -P /opt/openvidu'
|
|
||||||
sh 'wget --directory-prefix=/opt/openvidu/test-layouts/layout1 https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-test-e2e/docker/my-custom-layout/index.html'
|
|
||||||
docker.image('selenium/standalone-firefox:latest').withRun('-p 6667:4444 --name firefox --shm-size=1g') { d ->
|
|
||||||
def mycontainer = docker.image('openvidu/openvidu-test-e2e:$DISTRO')
|
|
||||||
mycontainer.pull()
|
|
||||||
mycontainer.inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm -v /opt/openvidu:/opt/openvidu --privileged') {
|
|
||||||
|
|
||||||
stage('Preparation') {
|
docker.image('openvidu/openvidu-test-e2e:$DISTRO').inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm -v /opt/openvidu:/opt/openvidu --privileged') {
|
||||||
sh 'rm -rf ~/.m2 || true'
|
|
||||||
sh 'rm -rf openvidu || true'
|
|
||||||
sh 'rm -rf kurento-java || true'
|
|
||||||
sh 'git clone https://github.com/OpenVidu/openvidu.git'
|
|
||||||
sh 'cd openvidu && git fetch --all && git checkout $OPENVIDU_COMMIT'
|
|
||||||
sh(script: '''#!/bin/bash -xe
|
|
||||||
if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then
|
|
||||||
git clone https://github.com/Kurento/kurento-java.git
|
|
||||||
cd kurento-java
|
|
||||||
git checkout -f $KURENTO_JAVA_COMMIT
|
|
||||||
mvn clean install
|
|
||||||
fi
|
|
||||||
'''.stripIndent())
|
|
||||||
sh(script: '''#!/bin/bash -xe
|
|
||||||
if $KURENTO_MEDIA_SERVER_DEV ; then
|
|
||||||
echo "Upgrading KMS to dev version"
|
|
||||||
sudo apt-get update && sudo apt-get install -y aptitude
|
|
||||||
sudo aptitude remove -y kurento-media-server
|
|
||||||
DISTRO=`lsb_release --codename | cut -f2`
|
|
||||||
sudo echo "deb [arch=amd64] http://ubuntu.openvidu.io/dev $DISTRO kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
|
|
||||||
sudo apt-get update && sudo apt-get --yes -o Dpkg::Options::="--force-confnew" install kurento-media-server
|
|
||||||
fi
|
|
||||||
'''.stripIndent())
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('OpenVidu Browser build') {
|
stage('Preparation') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh 'rm -rf ~/.m2 || true'
|
||||||
cd openvidu
|
sh 'rm -rf openvidu || true'
|
||||||
if [[ $OPENVIDU_BROWSER_COMMIT != "default" ]]; then
|
sh 'rm -rf kurento-java || true'
|
||||||
git checkout -f $OPENVIDU_BROWSER_COMMIT
|
sh 'git clone https://github.com/OpenVidu/openvidu.git'
|
||||||
fi
|
sh 'cd openvidu && git fetch --all && git checkout $OPENVIDU_COMMIT'
|
||||||
cd openvidu-browser
|
sh(script: '''#!/bin/bash -xe
|
||||||
npm install --unsafe-perm && npm run build && npm pack
|
if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then
|
||||||
cp openvidu-browser-*.tgz /opt/openvidu
|
git clone https://github.com/Kurento/kurento-java.git
|
||||||
cd ..
|
cd kurento-java
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
git checkout -f $KURENTO_JAVA_COMMIT
|
||||||
'''.stripIndent())
|
mvn clean install
|
||||||
}
|
fi
|
||||||
|
'''.stripIndent())
|
||||||
|
sh(script: '''#!/bin/bash -xe
|
||||||
|
if $KURENTO_MEDIA_SERVER_DEV ; then
|
||||||
|
echo "Upgrading KMS to dev version"
|
||||||
|
sudo apt-get update && sudo apt-get install -y aptitude
|
||||||
|
sudo aptitude remove -y kurento-media-server
|
||||||
|
DISTRO=`lsb_release --codename | cut -f2`
|
||||||
|
sudo echo "deb [arch=amd64] http://ubuntu.openvidu.io/dev $DISTRO kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
|
||||||
|
sudo apt-get update && sudo apt-get --yes -o Dpkg::Options::="--force-confnew" install kurento-media-server
|
||||||
|
fi
|
||||||
|
'''.stripIndent())
|
||||||
|
}
|
||||||
|
|
||||||
stage('OpenVidu Node Client build') {
|
stage('OpenVidu Browser build') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh(script: '''#!/bin/bash -xe
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_NODE_CLIENT_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_BROWSER_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_NODE_CLIENT_COMMIT
|
git checkout -f $OPENVIDU_BROWSER_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-node-client
|
cd openvidu-browser
|
||||||
npm install --unsafe-perm && npm run build && npm pack
|
npm install --unsafe-perm && npm run build && npm pack
|
||||||
cp openvidu-node-client-*.tgz /opt/openvidu
|
cp openvidu-browser-*.tgz /opt/openvidu
|
||||||
cd ..
|
cd ..
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('OpenVidu TestApp build') {
|
stage('OpenVidu Node Client build') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh(script: '''#!/bin/bash -xe
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_TESTAPP_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_NODE_CLIENT_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_TESTAPP_COMMIT
|
git checkout -f $OPENVIDU_NODE_CLIENT_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-testapp
|
cd openvidu-node-client
|
||||||
npm install --unsafe-perm
|
npm install --unsafe-perm && npm run build && npm pack
|
||||||
npm install /opt/openvidu/openvidu-browser-*.tgz
|
cp openvidu-node-client-*.tgz /opt/openvidu
|
||||||
npm install /opt/openvidu/openvidu-node-client-*.tgz
|
cd ..
|
||||||
export NG_CLI_ANALYTICS="false" && ./node_modules/@angular/cli/bin/ng build --prod --output-path=/opt/openvidu/testapp
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
cd ..
|
'''.stripIndent())
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
}
|
||||||
'''.stripIndent())
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('OpenVidu Java Client build') {
|
stage('OpenVidu TestApp build') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh(script: '''#!/bin/bash -xe
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_JAVA_CLIENT_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_TESTAPP_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_JAVA_CLIENT_COMMIT
|
git checkout -f $OPENVIDU_TESTAPP_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-java-client
|
cd openvidu-testapp
|
||||||
mvn --batch-mode versions:set -DnewVersion=TEST
|
npm install --unsafe-perm
|
||||||
mvn clean compile package
|
npm install /opt/openvidu/openvidu-browser-*.tgz
|
||||||
mvn install:install-file -Dfile=target/openvidu-java-client-TEST.jar -DgroupId=io.openvidu -DartifactId=openvidu-java-client -Dversion=TEST -Dpackaging=jar
|
npm install /opt/openvidu/openvidu-node-client-*.tgz
|
||||||
cd ..
|
export NG_CLI_ANALYTICS="false" && ./node_modules/@angular/cli/bin/ng build --prod --output-path=/opt/openvidu/testapp
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
cd ..
|
||||||
'''.stripIndent())
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
}
|
'''.stripIndent())
|
||||||
|
}
|
||||||
|
|
||||||
stage('OpenVidu parent build') {
|
stage('OpenVidu Java Client build') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh(script: '''#!/bin/bash -xe
|
||||||
if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then
|
cd openvidu
|
||||||
cd kurento-java && MVN_VERSION=$(mvn --batch-mode -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
if [[ $OPENVIDU_JAVA_CLIENT_COMMIT != "default" ]]; then
|
||||||
cd ../openvidu && mvn --batch-mode versions:set-property -Dproperty=version.kurento -DnewVersion=$MVN_VERSION
|
git checkout -f $OPENVIDU_JAVA_CLIENT_COMMIT
|
||||||
fi
|
fi
|
||||||
'''.stripIndent())
|
cd openvidu-java-client
|
||||||
sh 'cd openvidu && mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST'
|
mvn --batch-mode versions:set -DnewVersion=TEST
|
||||||
sh 'cd openvidu && mvn --batch-mode -DskipTests=true clean install'
|
mvn clean compile package
|
||||||
}
|
mvn install:install-file -Dfile=target/openvidu-java-client-TEST.jar -DgroupId=io.openvidu -DartifactId=openvidu-java-client -Dversion=TEST -Dpackaging=jar
|
||||||
|
cd ..
|
||||||
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
|
'''.stripIndent())
|
||||||
|
}
|
||||||
|
|
||||||
stage('OpenVidu Server unit tests') {
|
stage('OpenVidu parent build') {
|
||||||
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.unit.*Test test'
|
sh(script: '''#!/bin/bash -xe
|
||||||
}
|
if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then
|
||||||
|
cd kurento-java && MVN_VERSION=$(mvn --batch-mode -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
||||||
|
cd ../openvidu && mvn --batch-mode versions:set-property -Dproperty=version.kurento -DnewVersion=$MVN_VERSION
|
||||||
|
fi
|
||||||
|
'''.stripIndent())
|
||||||
|
sh 'cd openvidu && mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST'
|
||||||
|
sh 'cd openvidu && mvn --batch-mode -DskipTests=true clean install'
|
||||||
|
}
|
||||||
|
|
||||||
stage('OpenVidu Server integration tests') {
|
stage('OpenVidu Server unit tests') {
|
||||||
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.integration.*Test test'
|
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.unit.*Test test'
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('OpenVidu Server build') {
|
stage('OpenVidu Server integration tests') {
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.integration.*Test test'
|
||||||
cd openvidu/openvidu-server/src/dashboard && npm install --unsafe-perm && npm install /opt/openvidu/openvidu-browser-*.tgz && export NG_CLI_ANALYTICS="false" && npm run build-prod
|
}
|
||||||
cd ../..
|
|
||||||
mvn --batch-mode package
|
|
||||||
cp target/openvidu-server*.jar /opt/openvidu
|
|
||||||
'''.stripIndent())
|
|
||||||
}
|
|
||||||
|
|
||||||
stage ('Environment Launch') {
|
stage('OpenVidu Server build') {
|
||||||
sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem'
|
sh(script: '''#!/bin/bash -xe
|
||||||
sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &'
|
cd openvidu/openvidu-server/src/dashboard && npm install --unsafe-perm && npm install /opt/openvidu/openvidu-browser-*.tgz && export NG_CLI_ANALYTICS="false" && npm run build-prod
|
||||||
sh '/usr/bin/kurento-media-server &> /kms.log &'
|
cd ../..
|
||||||
sh 'until $(curl --insecure --output /dev/null --silent http://127.0.0.1:8888/kurento); do echo "Waiting for KMS..."; sleep 1; done'
|
mvn --batch-mode package
|
||||||
sh(script: '''#!/bin/bash -xe
|
cp target/openvidu-server*.jar /opt/openvidu
|
||||||
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
|
'''.stripIndent())
|
||||||
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
|
}
|
||||||
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
|
||||||
else
|
|
||||||
echo "Using default openvidu-recording tag"
|
|
||||||
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
|
||||||
fi
|
|
||||||
'''.stripIndent())
|
|
||||||
sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage ('OpenVidu E2E tests') {
|
stage ('Environment Launch') {
|
||||||
try {
|
sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem'
|
||||||
sh(script: '''#!/bin/bash -xe
|
sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &'
|
||||||
cd openvidu
|
sh '/usr/bin/kurento-media-server &> /kms.log &'
|
||||||
if [[ $OPENVIDU_TESTE2E_COMMIT != "default" ]]; then
|
sh 'until $(curl --insecure --output /dev/null --silent http://127.0.0.1:8888/kurento); do echo "Waiting for KMS..."; sleep 1; done'
|
||||||
git checkout -f $OPENVIDU_TESTE2E_COMMIT
|
sh(script: '''#!/bin/bash -xe
|
||||||
fi
|
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
|
||||||
cd openvidu-test-browsers
|
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
|
||||||
mvn --batch-mode versions:set -DnewVersion=TEST && mvn clean install
|
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
||||||
cd ..
|
else
|
||||||
mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST
|
echo "Using default openvidu-recording tag"
|
||||||
mvn --batch-mode versions:set-property -Dproperty=version.openvidu.test.browsers -DnewVersion=TEST
|
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
||||||
cd openvidu-test-e2e
|
fi
|
||||||
mvn -DskipTests=true clean install
|
'''.stripIndent())
|
||||||
sudo mvn --batch-mode -Dtest=OpenViduTestAppE2eTest -DAPP_URL=https://172.17.0.1:4200/ -DOPENVIDU_URL=https://172.17.0.1:4443/ -DREMOTE_URL_CHROME=http://172.17.0.1:6666/wd/hub/ -DREMOTE_URL_FIREFOX=http://172.17.0.1:6667/wd/hub/ -DEXTERNAL_CUSTOM_LAYOUT_URL=http://172.17.0.1:5555 -DEXTERNAL_CUSTOM_LAYOUT_PARAMS=sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET test
|
sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done'
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
}
|
||||||
'''.stripIndent())
|
|
||||||
}
|
docker.image('selenium/standalone-chrome:latest').withRun('-p 6666:4444 --name chrome --shm-size=1g -v /opt/openvidu:/opt/openvidu') { a ->
|
||||||
finally {
|
docker.image('selenium/standalone-firefox:latest').withRun('-p 6667:4444 --name firefox --shm-size=1g') { b ->
|
||||||
junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml'
|
docker.image('selenium/standalone-opera:latest').withRun('-p 6668:4444 --name opera --shm-size=1g') { c ->
|
||||||
archiveArtifacts artifacts: '**/openvidu-server.log'
|
|
||||||
|
stage ('OpenVidu E2E tests') {
|
||||||
|
try {
|
||||||
|
sh(script: '''#!/bin/bash -xe
|
||||||
|
cd openvidu
|
||||||
|
if [[ $OPENVIDU_TESTE2E_COMMIT != "default" ]]; then
|
||||||
|
git checkout -f $OPENVIDU_TESTE2E_COMMIT
|
||||||
|
fi
|
||||||
|
cd openvidu-test-browsers
|
||||||
|
mvn --batch-mode versions:set -DnewVersion=TEST && mvn clean install
|
||||||
|
cd ..
|
||||||
|
mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST
|
||||||
|
mvn --batch-mode versions:set-property -Dproperty=version.openvidu.test.browsers -DnewVersion=TEST
|
||||||
|
cd openvidu-test-e2e
|
||||||
|
mvn -DskipTests=true clean install
|
||||||
|
sudo mvn --batch-mode -Dtest=OpenViduTestAppE2eTest -DAPP_URL=https://172.17.0.1:4200/ -DOPENVIDU_URL=https://172.17.0.1:4443/ -DREMOTE_URL_CHROME=http://172.17.0.1:6666/wd/hub/ -DREMOTE_URL_FIREFOX=http://172.17.0.1:6667/wd/hub/ -DREMOTE_URL_OPERA=http://172.17.0.1:6668/wd/hub/ -DEXTERNAL_CUSTOM_LAYOUT_URL=http://172.17.0.1:5555 -DEXTERNAL_CUSTOM_LAYOUT_PARAMS=sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET test
|
||||||
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
|
'''.stripIndent())
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml'
|
||||||
|
archiveArtifacts artifacts: '**/openvidu-server.log'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -102,6 +102,7 @@ public class AbstractOpenViduTestAppE2eTest {
|
||||||
protected static void setupBrowserDrivers() {
|
protected static void setupBrowserDrivers() {
|
||||||
WebDriverManager.chromedriver().setup();
|
WebDriverManager.chromedriver().setup();
|
||||||
WebDriverManager.firefoxdriver().setup();
|
WebDriverManager.firefoxdriver().setup();
|
||||||
|
WebDriverManager.operadriver().setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void cleanFoldersAndSetUpOpenViduJavaClient() {
|
protected static void cleanFoldersAndSetUpOpenViduJavaClient() {
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
package io.openvidu.test.e2e;
|
||||||
|
|
||||||
|
import static org.openqa.selenium.OutputType.BASE64;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.Platform;
|
||||||
|
import org.openqa.selenium.TakesScreenshot;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.chrome.ChromeOptions;
|
||||||
|
import org.openqa.selenium.remote.BrowserType;
|
||||||
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
|
||||||
|
import io.appium.java_client.AppiumDriver;
|
||||||
|
import io.appium.java_client.MobileElement;
|
||||||
|
import io.appium.java_client.android.AndroidDriver;
|
||||||
|
import io.appium.java_client.remote.MobileCapabilityType;
|
||||||
|
|
||||||
|
public class OpenViduTestAppE2eAndroidTest {
|
||||||
|
|
||||||
|
protected static String OPENVIDU_SECRET = "MY_SECRET";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void android() throws Exception {
|
||||||
|
|
||||||
|
/* CHROME */
|
||||||
|
// Create object of DesiredCapabilities class and specify android platform
|
||||||
|
DesiredCapabilities capabilities = DesiredCapabilities.android();
|
||||||
|
// set the capability to execute test in chrome browser
|
||||||
|
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
|
||||||
|
// set the capability to execute our test in Android Platform
|
||||||
|
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
|
||||||
|
// we need to define platform name
|
||||||
|
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
|
||||||
|
// Set the device name as well (you can give any name)
|
||||||
|
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "my phone");
|
||||||
|
// set the android version as well
|
||||||
|
capabilities.setCapability(MobileCapabilityType.VERSION, "10.0");
|
||||||
|
ChromeOptions chromeOptions = new ChromeOptions();
|
||||||
|
// This flag avoids to grant the user media
|
||||||
|
chromeOptions.addArguments("--use-fake-ui-for-media-stream");
|
||||||
|
// This flag fakes user media with synthetic video
|
||||||
|
chromeOptions.addArguments("--use-fake-device-for-media-stream");
|
||||||
|
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
|
||||||
|
/* CHROME */
|
||||||
|
|
||||||
|
/* FIREFOX */
|
||||||
|
// DesiredCapabilities capabilities = DesiredCapabilities.android();
|
||||||
|
// capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "MozillaFirefox");
|
||||||
|
// capabilities.setCapability("automationName", "Gecko");
|
||||||
|
// capabilities.setCapability("platformName", "linux");
|
||||||
|
//
|
||||||
|
// FirefoxOptions options = new FirefoxOptions();
|
||||||
|
// options.addPreference("androidPackage", "org.mozilla.firefox");
|
||||||
|
// options.addPreference("androidDeviceSerial", "emulator-5554");
|
||||||
|
//// capabilities.setCapability("moz:firefoxOptions",
|
||||||
|
//// "{\"androidPackage\":\"org.mozilla.firefox\",\"androidDeviceSerial\":\"emulator-5554\"}");
|
||||||
|
// // capabilities.setCapability("moz:firefoxOptions", value);
|
||||||
|
// capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS,
|
||||||
|
// "{\"androidPackage\":\"org.mozilla.firefox\",\"androidDeviceSerial\":\"emulator-5554\"}");
|
||||||
|
/* FIREFOX */
|
||||||
|
|
||||||
|
// Create object of URL class and specify the appium server address
|
||||||
|
URL url = new URL("http://172.19.0.3:4723/wd/hub");
|
||||||
|
|
||||||
|
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(url, capabilities);
|
||||||
|
|
||||||
|
// Open url
|
||||||
|
driver.get("https://172.19.0.1:4200");
|
||||||
|
|
||||||
|
OpenViduEventManager eventManager = new OpenViduEventManager(driver, 50);
|
||||||
|
eventManager.startPolling();
|
||||||
|
|
||||||
|
// print the title
|
||||||
|
System.out.println("Title " + driver.getTitle());
|
||||||
|
|
||||||
|
WebElement urlInput = driver.findElement(By.id("openvidu-url"));
|
||||||
|
urlInput.clear();
|
||||||
|
urlInput.sendKeys("https://172.19.0.1:4443/");
|
||||||
|
WebElement secretInput = driver.findElement(By.id("openvidu-secret"));
|
||||||
|
secretInput.clear();
|
||||||
|
secretInput.sendKeys(OPENVIDU_SECRET);
|
||||||
|
|
||||||
|
driver.findElement(By.id("auto-join-checkbox")).click();
|
||||||
|
driver.findElement(By.id("one2one-btn")).click();
|
||||||
|
|
||||||
|
eventManager.waitUntilEventReaches("connectionCreated", 4);
|
||||||
|
eventManager.waitUntilEventReaches("accessAllowed", 2);
|
||||||
|
eventManager.waitUntilEventReaches("streamCreated", 4);
|
||||||
|
eventManager.waitUntilEventReaches("streamPlaying", 4);
|
||||||
|
|
||||||
|
System.out.println("data:image/png;base64," + ((TakesScreenshot) driver).getScreenshotAs(BASE64));
|
||||||
|
|
||||||
|
// close the browser
|
||||||
|
driver.quit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -117,6 +117,54 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
||||||
gracefullyLeaveParticipants(2);
|
gracefullyLeaveParticipants(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("One2One Firefox [Video + Audio]")
|
||||||
|
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
||||||
|
|
||||||
|
setupBrowser("firefox");
|
||||||
|
|
||||||
|
log.info("One2One Firefox [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);
|
||||||
|
|
||||||
|
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
|
||||||
|
Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
|
||||||
|
Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
|
||||||
|
.assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
|
||||||
|
|
||||||
|
gracefullyLeaveParticipants(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("One2One Opera [Video + Audio]")
|
||||||
|
void oneToOneVideoAudioSessionOpera() throws Exception {
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
|
||||||
|
Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
|
||||||
|
Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
|
||||||
|
.assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
|
||||||
|
|
||||||
|
gracefullyLeaveParticipants(2);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("One2One [Audio]")
|
@DisplayName("One2One [Audio]")
|
||||||
void oneToOneAudioSession() throws Exception {
|
void oneToOneAudioSession() throws Exception {
|
||||||
|
@ -299,30 +347,6 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
||||||
gracefullyLeaveParticipants(4);
|
gracefullyLeaveParticipants(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("One2One Firefox [Video + Audio]")
|
|
||||||
void oneToOneVideoAudioSessionFirefox() throws Exception {
|
|
||||||
|
|
||||||
setupBrowser("firefox");
|
|
||||||
|
|
||||||
log.info("One2One Firefox [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);
|
|
||||||
|
|
||||||
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
|
|
||||||
Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
|
|
||||||
Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
|
|
||||||
.assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
|
|
||||||
|
|
||||||
gracefullyLeaveParticipants(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Cross-Browser test")
|
@DisplayName("Cross-Browser test")
|
||||||
void crossBrowserTest() throws Exception {
|
void crossBrowserTest() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue