forked from zalando/zalenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_integration_tests.sh
executable file
·72 lines (68 loc) · 3.92 KB
/
run_integration_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
# Exit on failure
set -e
INTEGRATION_TO_TEST=$1
VIDEOS_FOLDER=$(pwd)/target/videos
echo ${VIDEOS_FOLDER}
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ -n "${TRAVIS_TAG}" ] && [ "${TRAVIS_TAG}" != "latest" ]; then
echo "TRAVIS_TAG=${TRAVIS_TAG}"
echo "Not running integration tests when a TAG is set, we assume they already ran in the PR."
else
# If the environment var exists, then we run the integration tests. This is to allow external PRs ro tun
if [ "$INTEGRATION_TO_TEST" = sauceLabs ]; then
if [ -n "${SAUCE_USERNAME}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -DintegrationToTest=${INTEGRATION_TO_TEST}
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/saucelabs*.mp4 || (echo "No Sauce Labs videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
fi
fi
if [ "$INTEGRATION_TO_TEST" = browserStack ]; then
if [ -n "${BROWSER_STACK_USER}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -DintegrationToTest=${INTEGRATION_TO_TEST}
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/browserstack*.mp4 || (echo "No BrowserStack videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
fi
fi
if [ "$INTEGRATION_TO_TEST" = testingBot ]; then
if [ -n "${TESTINGBOT_KEY}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -DintegrationToTest=${INTEGRATION_TO_TEST}
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/testingbot*.mp4 || (echo "No TestingBot videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
fi
fi
if [ "$INTEGRATION_TO_TEST" = crossBrowserTesting ]; then
if [ -n "${CBT_USERNAME}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -DintegrationToTest=${INTEGRATION_TO_TEST}
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/crossbrowsertesting*.mp4 || (echo "No CBT videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
fi
fi
if [ "$INTEGRATION_TO_TEST" = dockerCompose ]; then
if [ -n "${SAUCE_USERNAME}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean package -Pbuild-docker-image -DskipTests=true
mkdir -p "${VIDEOS_FOLDER}"
chmod +x target/zalenium_in_docker_compose.sh
target/zalenium_in_docker_compose.sh start
mvn verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -Dskip.failsafe.setup=true -DintegrationToTest=sauceLabs
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/saucelabs*.mp4 || (echo "No Sauce Labs videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
target/zalenium_in_docker_compose.sh stop
fi
fi
if [ "$INTEGRATION_TO_TEST" = minikube ]; then
MINIKUBE_IP=$(minikube ip)
export ZALENIUM_GRID_PORT=$(kubectl get svc zalenium --namespace zalenium -o go-template='{{ index (index .spec.ports 0) "nodePort" }}{{ "\n" }}')
export ZALENIUM_GRID_HOST=$MINIKUBE_IP
mvn verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -Dskip.failsafe.setup=true -Dgroups=minikube
fi
fi