-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·79 lines (72 loc) · 2.62 KB
/
run.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
#!/bin/bash
############################################################
# Help #
############################################################
Help()
{
# Display Help
echo
echo
echo "Run Cypress tests for o-platform"
echo
echo "This script will run Cypress tests for o-platform. By default, it will run all tests in headless mode."
echo
echo "To run Cypress tests in headless mode, run the script with the -n option specify a test file without extensions (e.g. preSeededRegularUser)."
echo
echo "To run Cypress tests in browser mode, run the script with the -o option."
echo
echo "To run Cypress tests in headless mode for CI, run the script with the -ci option. You can also specify a test file (e.g. preSeededRegularUser)."
echo
echo "Syntax: run.sh [-h|o|n|ci]"
echo "options:"
echo "h Print this Help."
echo "o Opens cypress in browser-mode."
echo "n Run a specific test file in headless."
echo "ci Run Cypress tests in headless mode for CI."
echo
}
############################################################
# Main program #
############################################################
Open()
{
echo "Running Cypress tests for o-platform"
npm run cy:open
}
# Set variables
test_file=""
############################################################
# Process the input options. Add options as needed. #
############################################################
# Get the options
while getopts ":ohnc:" option; do
case $option in
o) # Opens Cypress
Open
exit;;
h) # display Help
Help
exit;;
n) # Enter a name
test_file=$OPTARG
path=$(pwd)
if [[ -n $test_file ]]; then
echo "Running Cypress tests for o-platform"
echo "test_file: $test_file"
cp -f ../land-local/modes/from-source/.state/static-content/public/Person_1.y4m ./cypress/fixtures || exit && npx cypress run --browser chromium --spec "$path/cypress/e2e/test-journeys/$test_file.cy.ts"
exit
fi
;;
c) # Run Cypress tests in headless mode for CI
test_file=$OPTARG
path=$(pwd)
echo "Running Cypress tests for o-platform"
npx cypress run --browser chromium --spec "$path/cypress/e2e/test-journeys/$test_file.cy.ts"
exit
;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
cp -f ../land-local/modes/from-source/.state/static-content/public/Person_1.y4m ./cypress/fixtures || exit && npx cypress run --browser chromium