-
Notifications
You must be signed in to change notification settings - Fork 15
/
run_tests.sh
executable file
·92 lines (75 loc) · 2 KB
/
run_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#exit on errors
set -e
if [ "$#" -ge 1 ]
then
if [ "$#" -ge 2 ]
then
logname="${2:8:-3}_"
else
logname="${1:8:-3}_"
fi
else
logname=""
fi
mkdir -p -- "logs"
#run server
echo "Starting server..."
node httpwsd.js --log=HTTP > "./logs/${logname}node.log" 2>&1 &
serverpid=$!
sleep 3
#check if server is dead
if ! kill -0 "$serverpid"; then
wait $serverpid
server_status=$?
echo "model transformation server failed to start" >> "./logs/${logname}node.log"
exit $server_status
fi
#run mt script
echo "Starting model transformation script..."
python3 mt/main.py > "./logs/${logname}python.log" 2>&1 &
mtpid=$!
sleep 3
ps
#check if model transformer is dead
if ! kill -0 "${mtpid}"; then
wait ${mtpid}
mt_status=$?
echo "model transformation server failed to start" >> "./logs/${logname}python.log"
exit $mt_status
fi
#echo "Starting Selenium server."
#java -jar "./node_modules/selenium-server/lib/runner/selenium-server-standalone-3.141.59.jar" &
#seleniumpid=$!
#sleep 3
#check if selenium server is dead
#if ! kill -0 "$seleniumpid"; then
# wait seleniumpid
# se_status=$?
# exit $se_status
#fi
echo "Starting tests..."
#if we have test arguments process arguments else run full suit of tests as default
if [ "$#" -ge 1 ]
then
#if first argument is headless run tests headless else run the specified test because we have at least one argument
if [ "$1" == "headless" ]
then
#if we dont have a second argument run all tests headless else run the test specified in second argument headless
if [ -z "$2" ]
then
./node_modules/nightwatch/bin/nightwatch -e run_headless
else
./node_modules/nightwatch/bin/nightwatch -e run_headless $2
fi
else
./node_modules/nightwatch/bin/nightwatch $1
fi
else
./node_modules/nightwatch/bin/nightwatch
fi
echo "Stopping server and mt script..."
kill "$serverpid"
kill "$mtpid"
#kill "$seleniumpid"
echo "Finished!"