forked from witheve/Eve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·90 lines (82 loc) · 2.1 KB
/
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
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
#!/bin/bash
mode="CLI"
tests="func/**/*.js"
spookFlags=""
casperFlags=""
outDir="/tmp/test-eve"
taskDir="$outDir"
# Parse arguments without relying on getopt
while [[ $# > 0 ]]; do
key="$1"
case $key in
-o|--out)
outDir="$2"
shift
;;
--taskDir)
taskDir="$2"
shift
;;
-t|--tests)
tests="$2"
shift
;;
--disableCapture)
casperFlags="$casperFlags $1"
;;
-s|--save)
spookFlags="$spookFlags --add \"$2\""
outDir="$taskDir"
shift
;;
-l|--list)
spookFlags="$spookFlags --list-tests"
;;
--serve|--server)
mode="server"
;;
*)
echo "Unknown argument $1"
;;
esac
shift
done
# Ensure dependencies are installed.
printf "* Checking dependencies..."
hash slimerjs 2>/dev/null
if [ $? -ne 0 ]; then
printf "X\n Please install slimerjs with ('npm install -g slimerjs') before continuing.\n"
exit 1
fi
hash casperjs 2>/dev/null
if [ $? -ne 0 ]; then
printf "X\n Please install casperjs with ('npm install -g [email protected]') before continuing.\n"
exit 1
fi
hash spook 2>/dev/null
if [ $? -ne 0 ]; then
printf "X\n Please install spook with ('npm install -g spook') before continuing.\n"
exit 1
fi
hash gm 2>/dev/null
if [ $? -ne 0 ]; then
printf "X\n Please install GraphicsMagick with ('brew install GraphicsMagick' on mac, or from your dist's repo) before continuing.\n"
exit 1
fi
echo "done."
if [[ $mode == "server" ]]; then
result="$(spook --server $spookFlags --out "$outDir" --dbd "$taskDir" -- $casperFlags)"
exit $result
fi
printf "* Checking if runtime server is up..."
ps aux | grep -q '[t]arget/\(debug\|release\)/server'
res="$?"
if [ "$res" -ne 0 ]; then
printf "X\n Please run the runtime server separately and rerun the test suite after it has fully started.\n"
exit 2
fi
echo "done."
echo "* Running integration tests..."
echo "- Output dir is: $outDir"
spook --error-on-fail --out "$outDir" --base "ui/bin/test" --tests "$tests" --includes "ui/bin/test/include/**/*.js" $spookFlags -- --verbose --basePath="`pwd`" --engine=slimerjs $casperFlags
exit $?