-
Notifications
You must be signed in to change notification settings - Fork 7
/
teena.sh
executable file
·181 lines (140 loc) · 3.6 KB
/
teena.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env bash
# Abort immediately if a command fails
set -e
trap "killall background" EXIT
echo
echo "------------------------"; echo
echo " Teena welcomes you."; echo;
echo "------------------------"; echo
echo " You can skip prompts by setting the proper environment variables:"; echo
echo " For example,"
echo " export TEENA__TOOL=\"SuiteC\""
echo " export TEENA__TOOL_VERSION=\"3.4\""
echo " export TEENA__TEST_SUITE_KEYWORD=\"whiteboard\""
echo "------------------------"; echo
# ----
echo 'Which browser do we want to use? Enter 1 or 2. '
browser_options=("chrome" "firefox")
select opt in "${browser_options[@]}"; do
case ${opt} in
"chrome")
browser="chrome"
break
;;
"firefox")
browser="firefox"
break
;;
*)
echo "Answer truly, or you will browse in vain"
exit 1
;;
esac
done
echo
# ----
echo 'Head or no head? Enter 1 or 2. '
headless_options=("regular" "headless")
select opt in "${headless_options[@]}"; do
case ${opt} in
"regular")
headless=false
break
;;
"headless")
headless=true
break
;;
esac
done
echo
# ----
options=("BOA" "Ripley" "SuiteC")
tool_being_tested=''
function set_tool_being_tested {
case "${1}" in
"BOA")
tool_being_tested='boac'
friendly_tool_name=${options[0]}
;;
"Ripley")
tool_being_tested='ripley'
friendly_tool_name=${options[2]}
;;
"SuiteC")
tool_being_tested='squiggy'
friendly_tool_name=${options[3]}
;;
*)
echo "[ERROR] Invalid option: ${REPLY}"
exit 1
;;
esac
}
tool="${TEENA__TOOL}"
version="${TEENA__TOOL_VERSION}"
test_suite="${TEENA__TEST_SUITE_KEYWORD}"
# ----
if [ -z "${tool}" ]
then
PS3=$'\nWhich tool are you testing? '
select opt in "${options[@]}"; do
set_tool_being_tested "${opt}"
break
done
else
set_tool_being_tested "${tool}"
fi
# ----
if [ -z "${version}" ]
then
echo; echo "Enter version of ${tool_being_tested} being tested (e.g., '2.15')."
echo; echo -n " > "
read version
fi
# ----
if [ -z "${test_suite}" ]
then
echo
echo "Enter snippet (e.g., 'user_role' or 'user_role_coe') to match the ${tool_being_tested} Selenium script(s) you want to run."
echo "Blank input will run all tests."; echo
echo -n " > "
read test_suite
fi
# ----
echo
echo "Enter your username. Hit return to skip."
echo
printf " > "
read -s username
# ----
echo
echo "Enter your password. Hit return to skip."
echo
printf " > "
read -s password
# ----
DATE=$(date '+%Y-%m-%d-%H%M%S')
suffix="${DATE}"
summary="${tool_being_tested}-v${version}-${test_suite:-'all'}-${suffix}"
echo
echo "--------------------------------"; echo
echo " Look for output in log file: "
echo " ~/webdriver-output/test-results/test-results-${summary}-*.log"; echo
echo "--------------------------------"; echo
if [[ -z "${test_suite}" ]]
then
echo; echo "Running ALL tests of ${friendly_tool_name} v${version}"
echo
rake BROWSER="${browser}" HEADLESS="${headless}" VERSION="${summary}" USER="${username}" PASS="${password}" "${tool_being_tested}"
else
echo; echo "Running '${test_suite}' tests of ${friendly_tool_name} v${version}"
echo
rake BROWSER="${browser}" HEADLESS="${headless}" SCRIPTS="${test_suite}" VERSION="${summary}" USER="${username}" PASS="${password}" "${tool_being_tested}"
fi
echo
echo "--------------------------------"; echo
echo " We are done. Teena thanks you."; echo
echo "--------------------------------"
echo; echo
exit 0