forked from onfido/onfido-sdk-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·40 lines (33 loc) · 1.21 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
#!/bin/bash
set -e
# run only on pull requests and when NODE_ENV=test
if [[ ${CI} != "true" || (${NODE_ENV} = "test" && ${TRAVIS_PULL_REQUEST} != "false") ]]; then
# set path for test directory
TESTS_PATH=./test
# setup to run browser GUI
if [[ ${CI} = "true" ]]; then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start &
sleep 3 # give xvfb some time to start
fi
# run local server in the background and wait until it starts
# ref: https://stackoverflow.com/a/21002153
server=$([[ ${CI} = "true" ]] && echo "travis" || echo "dev")
echo "Running local server..."
exec 3< <(npm run $server)
if [[ ${CI} != "true" ]]; then
sed '/webpack: Compiled successfully.$/q' <&3 ; cat <&3 &
fi
# go to test directory
cd $TESTS_PATH
# install gem dependencies using monster_rsa private key to fetch the monster gem
if [[ ${CI} = "true" ]]; then
GIT_SSH_COMMAND="ssh -i ~/.ssh/monster_rsa" bundle install
else
bundle install
fi
# run cucumber tests against localhost
SDK_URL="https://localhost:8080/?async=false"
echo "Running Cucumber tests on ${SDK_URL}"
bundle exec cucumber BROWSER=${BROWSER:-chrome} SDK_URL=${SDK_URL} USE_SECRETS=false SEED_PATH=false DEBUG=false CI=${CI}
fi