-
Notifications
You must be signed in to change notification settings - Fork 1
/
cypress-ete.sh
executable file
·77 lines (64 loc) · 2.29 KB
/
cypress-ete.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
#!/bin/bash
# Quickly fire up Cypress using the CI settings for interactive local usage.
# Set DEV_MODE=true to run the mocked tests with the development server.
# We default to false here.
: "${DEV_MODE:=false}"
if [[ "$DEV_MODE" == "true" ]]; then
echo "Running with development config and server..."
else
echo "Running with production build..."
fi
echo "Opening Cypress e2e tests..."
if pgrep "nginx" >/dev/null
then
echo "nginx is running - ok"
else
echo "nginx is stopped, please start nginx"
exit 0
fi
set -ae
trap 'kill $(jobs -p)' INT TERM EXIT
echo "loading environment variables"
source .env
CI_ENV=$(cat .env | tr '\n' ',')
CI_ENV=${CI_ENV%?}
# Used to tell Gateway server we're running in Cypress
RUNNING_IN_CYPRESS=true
if [ -z ${NODE_EXTRA_CA_CERTS+x} ]; then
echo "NODE_EXTRA_CA_CERTS is unset in your bash config, see setup docs on how to set this."
echo "Setting NODE_EXTRA_CA_CERTS locally for now."
NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
else
echo "NODE_EXTRA_CA_CERTS is set."
fi
if [[ -z "${CYPRESS_MAILOSAUR_API_KEY}" ]]; then
echo "You don't have the CYPRESS_MAILOSAUR_API_KEY environment variable set!"
echo
echo "This key is required to run these ete Cypress tests. Check your .env file."
echo
exit
elif [[ -z "${CYPRESS_MAILOSAUR_SERVER_ID}" ]]; then
echo "You don't have the CYPRESS_MAILOSAUR_SERVER_ID environment variable set!"
echo
echo "This ID is required to run these ete Cypress tests. Check your .env file."
echo
exit
elif [[ -z "${CYPRESS_OKTA_ANDROID_CLIENT_ID}" ]]; then
echo "You don't have the CYPRESS_OKTA_ANDROID_CLIENT_ID environment variable set!"
echo
echo "The Okta Android Client ID is required to run these ete Cypress tests. Check your .env file."
echo
exit
fi
if [[ "$DEV_MODE" == "false" ]]; then
echo "building gateway"
pnpm run build
echo "starting gateway server, and waiting for https://profile.thegulocal.com/healthcheck"
pnpm run start &
pnpm run wait-on:server
else
echo "starting gateway server in watch and dev mode, and waiting for https://profile.thegulocal.com/healthcheck"
pnpm run watch:server & pnpm run watch & pnpm run wait-on:server
fi
echo "opening cypress"
pnpm run cypress open --env $CI_ENV --config '{"e2e":{"specPattern":["**/ete/**/*.cy.ts"]}}' --e2e --browser chrome