forked from psi-4ward/psitransfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browserstack-test.sh
executable file
·70 lines (57 loc) · 1.53 KB
/
browserstack-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
#!/usr/bin/env bash
# Browser Buckets, note the trailing comma, slashes and blank lines
BROWSERS=(
"browserstack:[email protected]:Windows 10"
"browserstack:[email protected]:Windows 10"
"browserstack:iPad Pro 11 2018"
"browserstack:[email protected]:Windows 10"
"browserstack:[email protected]:Windows 10"
"browserstack:[email protected]:Windows 10"
"browserstack:[email protected]:OS X Mojave"
)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/..
TC=node_modules/.bin/testcafe
function err {
>&2 echo Error: "$*"
exit 1
}
if [[ ! -x "$TC" ]]; then
err $TC does not exist or has not execute permissions
fi
export BROWSERSTACK_PROJECT_NAME=PsiTransfer
export BROWSERSTACK_BUILD_ID=${BROWSERSTACK_BUILD_ID:-dev}
export BROWSERSTACK_PARALLEL_RUNS=1
export BROWSERSTACK_CONSOLE=warnings
if [[ -z "$BROWSERSTACK_USERNAME" ]]; then
err Env Var BROWSERSTACK_USERNAME is empty.
fi
if [[ -z "$BROWSERSTACK_ACCESS_KEY" ]]; then
err Env Var BROWSERSTACK_ACCESS_KEY is empty.
fi
function abort {
echo Aborting ...
kill ${PID} 2>/dev/null || true
wait ${PID}
exit 1
}
trap abort SIGINT SIGTERM SIGHUP
export TEST_URL="http://localhost:3030"
(PSITRANSFER_PORT=3030 PROCESS_ENV=production node app)&
PID=$!
sleep 2 # Give PsiTransfer some time to start
echo PsiTransfer PID ${PID}
# Seems parallel tests with browserstack provider are buggy
EXIT_CODE=0
for BROWSER in "${BROWSERS[@]}"; do
echo Testing "${BROWSER}" ...
$TC \
"${BROWSER}" \
tests/e2e
if [[ $? -gt 0 ]]; then
EXIT_CODE=$?
fi
done
kill ${PID}
wait ${PID}
exit ${EXIT_CODE}