forked from Satoshi-Engineering/tipcards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e-tests.sh
executable file
·35 lines (27 loc) · 880 Bytes
/
e2e-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
#/bin/bash
kill_proc () {
kill `descendent_pids $1`
}
descendent_pids() {
pids=$(pgrep -P $1)
echo $pids
for pid in $pids; do
descendent_pids $pid
done
}
echo '' > backend.log
npm run backend-debug -- --envIntegrationTest 2>&1 > backend.log &
BACKEND_PID=$!
echo "Running backend with pid $BACKEND_PID, waiting for startup to finish"
while [ "x`grep 'app running and listening on port' backend.log`" = 'x' ]; do sleep 1; echo -n '.'; done
echo ''
echo 'Backend startup finished, running e2e tests'
npm run e2e-tests-with-frontend-build
INTEGRATION_TEST_EXIT_CODE=$?
kill_proc $BACKEND_PID
if [ "$INTEGRATION_TEST_EXIT_CODE" -ne 0 ]; then
echo 'Frontend integration tests failed! Printing backend.log ------ START'
cat backend.log
echo 'Frontend integration tests failed! Printing backend.log ------ END'
fi
exit $INTEGRATION_TEST_EXIT_CODE