forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-beta.sh
executable file
·60 lines (47 loc) · 1.32 KB
/
test-beta.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
#!/usr/bin/env bash
DEBUG=''
if [ -z "$VERSION" ]; then
VERSION='2.48.2'
fi
if [ -n "$1" ] && [ $1 == 'debug' ]; then
DEBUG='-debug'
fi
echo Building test container image
docker build -t selenium/test:local ./Test
echo 'Starting Selenium Hub Container...'
HUB=$(docker run -d selenium/hub:$VERSION)
HUB_NAME=$(docker inspect -f '{{ .Name }}' $HUB | sed s:/::)
echo 'Waiting for Hub to come online...'
docker logs -f $HUB &
sleep 2
echo 'Starting Selenium Chrome node...'
NODE_CHROME=$(docker run -d --link $HUB_NAME:hub kurento/node-chrome-beta$DEBUG:$VERSION)
docker logs -f $NODE_CHROME &
echo 'Waiting for nodes to register and come online...'
sleep 2
function test_node {
BROWSER=$1
echo Running $BROWSER test...
TEST_CMD="node smoke-$BROWSER.js"
docker run -it --link $HUB_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 Removing the test container
docker rm $TEST_CONTAINER
fi
}
test_node chrome $DEBUG
if [ ! "$CIRCLECI" == "true" ]; then
echo Tearing down Selenium Chrome Beta Node container
docker stop $NODE_CHROME
docker rm $NODE_CHROME
echo Tearing down Selenium Hub container
docker stop $HUB
docker rm $HUB
fi
echo Done