forked from fabric8-ui/fabric8-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_functional_tests.sh
executable file
·48 lines (40 loc) · 1.49 KB
/
run_functional_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
#!/usr/bin/env bash
LOGFILE=$(pwd)/functional_tests.log
echo Using logfile $LOGFILE
# For the functional tests, we are mocking the core
export NODE_ENV=inmemory
# Download dependencies
echo -n Updating Webdriver and Selenium...
node_modules/protractor/bin/webdriver-manager update --versions.chrome 2.30
# Start selenium server just for this test run
echo -n Starting Webdriver and Selenium...
(node_modules/protractor/bin/webdriver-manager --versions.chrome 2.30 start >>$LOGFILE 2>&1 &)
# Wait for port 4444 to be listening connections
while ! (ncat -w 1 127.0.0.1 4444 </dev/null >/dev/null 2>&1); do sleep 1; done
echo done.
# Start the web app
echo -n Starting Almighty development server...
(node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --progress --host 0.0.0.0 --port 8088 >>$LOGFILE 2>&1 &)
# Wait for port 8088 to be listening connections
while ! (ncat -w 1 127.0.0.1 8088 </dev/null >/dev/null 2>&1); do sleep 1; done
echo done.
# Retrieve index.html to trigger webpack to build the source
echo -n Building source...
# Wait for the build to finish (index.html is delivered)
curl http://localhost:8088/ -o /dev/null -s
echo done.
# Finally run protractor
echo Running tests...
node_modules/protractor/bin/protractor protractor.config.js
TEST_RESULT=$?
# Cleanup webdriver-manager and web app processes
fuser -k -n tcp 4444
fuser -k -n tcp 8088
# Return test result
if [ $TEST_RESULT -eq 0 ]; then
echo 'Functional tests OK'
exit 0
else
echo 'Functional tests FAIL'
exit 1
fi