forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sa-test.sh
executable file
·40 lines (31 loc) · 963 Bytes
/
sa-test.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
#!/usr/bin/env bash
DEBUG=''
if [ -n "$1" ] && [ $1 == 'debug' ]; then
DEBUG='-debug'
fi
echo Building test container image
docker build -t selenium/test:local ./Test
function test_standalone {
BROWSER=$1
echo Starting Selenium standalone-$BROWSER$DEBUG container
SA=$(docker run -d selenium/standalone-$BROWSER$DEBUG:2.53.1)
SA_NAME=$(docker inspect -f '{{ .Name }}' $SA | sed s:/::)
TEST_CMD="node smoke-$BROWSER.js"
echo Running test container...
docker run -it --link $SA_NAME:hub -e "TEST_CMD=$TEST_CMD" selenium/test:local
STATUS=$?
TEST_CONTAINER=$(docker ps -aq | head -1)
if [ ! $STATUS == 0 ]; then
echo Failed
exit 1
fi
if [ ! "$CIRCLECI" == "true" ]; then
echo Tearing down Selenium standalone-$BROWSER$DEBUG container
docker stop $SA_NAME
docker rm $SA_NAME
echo Removing the test container
docker rm $TEST_CONTAINER
fi
}
test_standalone firefox $DEBUG
test_standalone chrome $DEBUG