-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-integration-tests.sh
executable file
·82 lines (68 loc) · 1.41 KB
/
run-integration-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
#!/bin/bash
set -e
on_exit() {
set +e
[ -n "$GORETRO_PID" ] && kill $GORETRO_PID
[ -n "$DEV_SERVER_PID" ] && kill $DEV_SERVER_PID
wait
exit $EXIT_CODE
}
trap on_exit EXIT
if [ -n "$CI" ]; then
echo "=== Installing 3rd party dependencies"
# 3rd party deps copied from https://github.com/microsoft/playwright-github-action/blob/master/index.js
sudo apt update
sudo apt -y install \
libgbm-dev \
libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libgles2 \
libevent-2.1-6 \
libnotify4 \
libxslt1.1
fi
echo "=== Build server"
go build ./cmd/...
echo "=== Install UI dependencies"
yarn --cwd ui --prefer-offline
echo "=== Install E2E test dependencies"
yarn --cwd e2e --prefer-offline
echo "=== Start server"
./goretro >/dev/null &
GORETRO_PID=$!
echo "=== Start UI development server"
yarn --cwd ui start >/dev/null &
DEV_SERVER_PID=$!
echo "=== Wait for development server to come up"
while true; do
set +e
curl -sf -o/dev/null http://127.0.0.1:3000
CURL_RES=$?
set -e
case $CURL_RES in
0)
echo "=== Development server is up!"
break
;;
7)
echo "=== Development server is not up yet"
sleep 1
continue
;;
*)
echo "=== Unexpected curl exit code: $?"
exit 1
;;
esac
done
echo "=== Run the tests"
yarn --cwd e2e run codeceptjs run -p screenshotOnFail --steps
EXIT_CODE=$?