forked from adobecom/nala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runLocalRegression.sh
executable file
·45 lines (39 loc) · 1.15 KB
/
runLocalRegression.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
#!/bin/bash
# This script allows users to run regression tests against localhost
T_FLAG=''
H_FLAG=''
B_FLAG=''
P_FLAG=3000
Help() {
echo "This script allows users to run regression tests against localhost.\n"
echo "Options:"
echo "-t Tag name. Default=all.\n
ie. ./runLocalRegression.sh -t @modal\n"
echo "-h Headed mode. Defaults to headless.\n
ie. ./runLocalRegression.sh -h headed\n"
echo "-b Project(browser) name. Default=all.\n
ie. ./runLocalRegression.sh -b webkit\n"
echo "-p Localhost port. Defaults to localhost:3000.\n
ie. ./runLocalRegression.sh -p 6456\n"
}
while getopts 't:h:b:p:' flag; do
case ${flag} in
t) T_FLAG=$OPTARG;;
h) H_FLAG=--$OPTARG;;
b) B_FLAG=--project=$OPTARG;;
p) P_FLAG=$OPTARG;;
*) Help
exit 1 ;;
esac
done
echo "Setting envs to local"
sed -i "" "/envs:/s/^/ envs: '@local$P_FLAG', \/\//" ./features/*.js
echo "Executing tests against localhost:$P_FLAG"
if [ ! -z "$T_FLAG" ]
then
npm test -- -g $T_FLAG $H_FLAG $B_FLAG
else
npm test -- $H_FLAG $B_FLAG
fi
echo "Reverting envs back to original values"
sed -i "" "s/envs: '@local$P_FLAG', \/\/ //g" ./features/*.js