Skip to content

Commit 828c92e

Browse files
committed
merge test scripts into one unified script
Added email capabilities Merged test_* scripts into one unified script Minor improvements in env vars
1 parent 93e5c3c commit 828c92e

File tree

5 files changed

+84
-41
lines changed

5 files changed

+84
-41
lines changed

bin/seleniumbender

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
3+
export CAPABILITIES='capabilities_firefox.yaml'
4+
5+
source ./env_vars.sh
6+
7+
ROOTDIR="/path/to/seleniumTests"
8+
9+
if [ $# -lt 1 ]; then
10+
echo "Please provide an argument or run -h(--help) option"
11+
exit 1
12+
fi
13+
14+
app_name="$0"
15+
common=0
16+
libraries=0
17+
examples=0
18+
sketches=0
19+
20+
while true; do
21+
case "$1" in
22+
-h|help)
23+
echo -e "usage: ${app_name} [option(s)]\n\n" "Options:\n" \
24+
" common - Runs common tests against a specified website\n" \
25+
" libraries - Visits all the libraries and examples at libraries view\n" \
26+
" examples - Compiles all the examples at libraries view\n" \
27+
" sketches - Compiles the examples of user cb_compile_tester\n" \
28+
" help - Display this help and exit"
29+
exit 0
30+
;;
31+
common) common=1
32+
;;
33+
libraries) libraries=1
34+
;;
35+
examples) examples=1
36+
;;
37+
sketches) sketches=1
38+
;;
39+
-*) echo -e "error: unknown argument: ${1}.\nRun ${app_name} -h."
40+
exit 1
41+
;;
42+
*) break
43+
;;
44+
esac
45+
shift
46+
done
47+
48+
cd ..
49+
50+
URL="https://codebender.cc"
51+
SOURCE="codebender_cc"
52+
53+
email_date=$(date +"%Y-%m-%d %H:%M:%S")
54+
55+
if [ "${common}" -eq 1 ]; then
56+
IDENTIFIER="common"
57+
tox tests/common -- --url=${URL} --source=${SOURCE}
58+
RETVAL=$?
59+
if [ "${RETVAL}" -eq 1 ]; then
60+
mail -s "Selenium Tests: ${IDENTIFIER} Failed To Run" [email protected] <<< 'Something went wrong with common tests. Please check the logs.'
61+
exit ${RETVAL}
62+
fi
63+
elif [ "${examples}" -eq 1 ]; then
64+
IDENTIFIER="libraries_test"
65+
tox tests/libraries -- --url=${URL} --source=${SOURCE} -F
66+
elif [ "${libraries}" -eq 1 ]; then
67+
IDENTIFIER="libraries_fetch"
68+
tox tests/libraries_fetch -- --url=${URL} --source=${SOURCE} -F
69+
elif [ "${sketches}" -eq 1 ]; then
70+
IDENTIFIER="cb_compile_tester"
71+
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F
72+
fi
73+
74+
DATE=$(date +"%Y-%m-%d") # Get the current date
75+
LOGS="${ROOTDIR}/logs"
76+
REPORTS="${ROOTDIR}/reports"
77+
78+
logfile=$(ls -t ${LOGS} | egrep "${DATE}.*${IDENTIFIER}" | head -1)
79+
reportfile=$(ls -t ${REPORTS} | egrep "${DATE}.*${IDENTIFIER}" | head -1)
80+
diffnum=$(ls -t ${REPORTS} | egrep "${DATE}.*${IDENTIFIER}" | head -1 | cut -d'_' -f6)
81+
changes=${diffnum:0:1}
82+
83+
(echo "Changes since the last time: ${changes}"; uuencode "${LOGS}/${LOGFILE}" "${LOGFILE}"; uuencode "${REPORTS}/${REPORTFILE}" "${REPORTFILE}") \
84+
| mail -s "Selenium Tests Report: ${IDENTIFIER} ${email_date} Changes: ${changes}" [email protected]

bin/test_common.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/test_examples.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/test_libraries_fetch.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/test_sketches.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)