forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·46 lines (35 loc) · 1023 Bytes
/
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
41
42
43
44
45
46
#!/bin/bash
DEBUG=''
if [ -n "$1" ] && [ $1 == 'debug' ]; then
DEBUG='-debug'
fi
echo Building test container image
docker build -t selenium/test:local ./Test
echo Starting Selenium Container
HUB=$(docker run -d selenium/hub:2.44.0)
HUB_NAME=$(docker inspect -f '{{ .Name }}' $HUB | sed s:/::)
sleep 2
NODE_CHROME=$(docker run -d --link $HUB_NAME:hub selenium/node-chrome$DEBUG:2.44.0)
NODE_FIREFOX=$(docker run -d --link $HUB_NAME:hub selenium/node-firefox$DEBUG:2.44.0)
docker logs -f $HUB &
docker logs -f $NODE_CHROME &
docker logs -f $NODE_FIREFOX &
sleep 2
echo Running test container...
docker run --rm -it --link $HUB_NAME:hub selenium/test:local
STATUS=$?
echo Tearing down Selenium Chrome Node container
docker stop $NODE_CHROME
docker rm $NODE_CHROME
echo Tearing down Selenium Firefox Node container
docker stop $NODE_FIREFOX
docker rm $NODE_FIREFOX
echo Tearing down Selenium Hub container
docker stop $HUB
docker rm $HUB
if [ ! $STATUS == 0 ]; then
stopHub
echo Failed
exit 1
fi
echo Done