1
1
#! /bin/bash
2
2
3
- export CAPABILITIES=' capabilities_firefox.yaml'
4
-
5
3
source ./env_vars.sh
6
4
7
- ROOTDIR=" /path/to/seleniumTests"
8
-
9
5
if [ $# -lt 1 ]; then
10
6
echo " Please provide an argument or run -h(--help) option"
11
7
exit 1
12
8
fi
13
9
14
10
app_name=" $0 "
15
- common=0
16
- libraries =0
11
+
12
+ target =0
17
13
examples=0
14
+ libraries=0
18
15
sketches=0
19
- staging =0
16
+ common =0
20
17
noplugin=0
21
18
walkthrough=0
22
- target =0
19
+ staging =0
23
20
24
21
while true ; do
25
22
case " $1 " in
@@ -29,29 +26,32 @@ while true; do
29
26
" libraries - Visits all the libraries and examples at libraries view\n" \
30
27
" examples - Compiles all the examples at libraries view\n" \
31
28
" sketches - Compiles the examples of user cb_compile_tester\n" \
29
+ " target - Compiles the examples of given libraries as comma seperated list\n" \
30
+ " noplugin - Runs tests that do not need plugin installed\n" \
31
+ " walkthrough - Runs tests for walkthrough\n" \
32
+ " staging - Runs tests in staging\n" \
32
33
" help - Display this help and exit"
33
34
exit 0
34
35
;;
35
- common) common=1
36
- ;;
37
- libraries) libraries=1
38
- ;;
39
- examples) examples=1
40
- ;;
41
- target) compile=1
36
+ target) target=1
42
37
shift
43
- target=1
44
38
TARGETS=$@
45
39
break
46
40
;;
41
+ examples) examples=1
42
+ ;;
43
+ libraries) libraries=1
44
+ ;;
47
45
sketches) sketches=1
48
46
;;
49
- staging) staging =1
47
+ common) common =1
50
48
;;
51
49
noplugin) noplugin=1
52
50
;;
53
51
walkthrough) walkthrough=1
54
52
;;
53
+ staging) staging=1
54
+ ;;
55
55
-* ) echo -e " error: unknown argument: ${1} .\nRun ${app_name} -h."
56
56
exit 1
57
57
;;
64
64
cd ..
65
65
66
66
URL=" https://codebender.cc"
67
- URL_STAGING=" https://staging.codebender.cc"
68
67
SOURCE=" codebender_cc"
69
68
70
69
email_date=$( date +" %Y-%m-%d %H:%M:%S" )
71
70
72
- if [ " ${common} " -eq 1 ]; then
73
- IDENTIFIER=" common"
74
- tox tests/common -- --url=${URL} --source=${SOURCE} --plugin
75
- RETVAL=$?
76
- if [ " ${RETVAL} " -eq 1 ]; then
77
- mail -s " Selenium Tests: ${IDENTIFIER} Failed To Run" ${EMAIL} <<< ' Something went wrong with common tests. Please check the logs.'
78
- fi
79
- exit ${RETVAL}
71
+ RETVAL=0
72
+ NO_LOGS=0
73
+
74
+ if [ " ${target} " -eq 1 ]; then
75
+ IDENTIFIER=" test_target_libraries"
76
+ tox tests/target_libraries -- --url=${URL} --source=${SOURCE} -F --plugin --libraries=${TARGETS}
80
77
elif [ " ${examples} " -eq 1 ]; then
81
78
IDENTIFIER=" libraries_test"
82
79
tox tests/libraries -- --url=${URL} --source=${SOURCE} -F --plugin
@@ -86,18 +83,16 @@ elif [ "${libraries}" -eq 1 ]; then
86
83
elif [ " ${sketches} " -eq 1 ]; then
87
84
IDENTIFIER=" cb_compile_tester"
88
85
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F --plugin
89
- elif [ " ${staging} " -eq 1 ]; then
90
- IDENTIFIER=" cb_compile_tester_staging"
91
- tox tests/compile_tester -- --url=${URL_STAGING} --source=${SOURCE} -F --plugin
92
- exit $?
86
+ elif [ " ${common} " -eq 1 ]; then
87
+ IDENTIFIER=" common"
88
+ tox tests/common -- --url=${URL} --source=${SOURCE} --plugin
89
+ RETVAL=$?
90
+ NO_LOGS=1
93
91
elif [ " ${noplugin} " -eq 1 ]; then
94
92
IDENTIFIER=" noplugin"
95
93
tox tests/noplugin -- --url=${URL} --source=${SOURCE}
96
94
RETVAL=$?
97
- if [ " ${RETVAL} " -eq 1 ]; then
98
- mail -s " Selenium Tests: ${IDENTIFIER} Failed To Run" ${EMAIL} <<< ' Something went wrong with noplugin tests. Please check the logs.'
99
- fi
100
- exit ${RETVAL}
95
+ NO_LOGS=1
101
96
elif [ " ${walkthrough} " -eq 1 ]; then
102
97
IDENTIFIER=" walkthrough"
103
98
RETVALS=()
@@ -114,22 +109,31 @@ elif [ "${walkthrough}" -eq 1 ]; then
114
109
tox tests/walkthrough -- --url=${URL} --source=${SOURCE} --plugin
115
110
RETVALS+=($? )
116
111
117
- RETVAL=0
118
112
for i in " ${RETVALS[@]} "
119
113
do
120
114
if [ ${i} -ne 0 ]; then
121
115
RETVAL=${i}
122
116
fi
123
117
done
124
- if [ " ${RETVAL} " -ne 0 ]; then
125
- mail -s " Selenium Tests: ${IDENTIFIER} Failed To Run" ${EMAIL} <<< ' Something went wrong with noplugin tests. Please check the logs.'
126
- fi
118
+ NO_LOGS=1
119
+ elif [ " ${staging} " -eq 1 ]; then
120
+ IDENTIFIER=" cb_compile_tester_staging"
121
+ URL=" https://staging.codebender.cc"
122
+ tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F --plugin
123
+ # No need to send email for tests in staging
124
+ exit $?
125
+ fi
126
+
127
+ # email notification without attaching any logs
128
+ if [ ${RETVAL} -ne 0 ]; then
129
+ mail -s " Selenium Tests: ${IDENTIFIER} Failed To Run" ${EMAIL} <<< " Something went wrong with ${IDENTIFIER} tests. Please check the logs."
130
+ fi
131
+
132
+ if [ ${NO_LOGS} -eq 1 ]; then
127
133
exit ${RETVAL}
128
- elif [ " ${target} " -eq 1 ]; then
129
- IDENTIFIER=" test_target_libraries"
130
- tox tests/target_libraries -- --url=${URL} --source=${SOURCE} -F --plugin --libraries=${TARGETS}
131
134
fi
132
135
136
+ # email notification with attaching the produced reports
133
137
DATE=$( date +" %Y-%m-%d" ) # Get the current date
134
138
LOGS=" ${ROOTDIR} /logs"
135
139
REPORTS=" ${ROOTDIR} /reports"
0 commit comments