-
Notifications
You must be signed in to change notification settings - Fork 32
/
runTests.sh
executable file
·44 lines (33 loc) · 928 Bytes
/
runTests.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
#!/usr/bin/env bash
if [ ! -f ./node_modules/.bin/nightwatch ]; then
echo "Nightwatch not installed. This is necessary for running tests"
echo "Run `npm install` to install it locally"
exit 1
fi
NIGHTWATCH_ENV=${NIGHTWATCH_ENV:-default}
#Run background jobs
echo "Starting mockserver..."
java -Droot.logLevel=OFF -Dmockserver.logLevel=OFF -jar tests/mockserver-netty-3.9.17-jar-with-dependencies.jar -serverPort 9999 > /dev/null 2>&1 &
MOCKSERVER_PID=$!
sleep 3
trap ctrl_c INT
function ctrl_c() {
echo "Killing mockserver..."
kill $MOCKSERVER_PID > /dev/null 2>&1
wait
exit 1
}
cd tests
#Set the urls of the mockserver
echo "Creating mocks..."
node setMocks.js
#Run tests
../node_modules/.bin/nightwatch --test --env "$NIGHTWATCH_ENV"
status_nightwatch=$?
cd ..
echo "Killing mockserver..."
kill $MOCKSERVER_PID > /dev/null 2>&1
wait
if [[ ${status_nightwatch} != 0 ]] ; then
exit ${status_nightwatch}
fi