-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tester.sh
executable file
·84 lines (69 loc) · 1.98 KB
/
run-tester.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
#!/bin/bash
set -euo pipefail
# This URL is used for firefox and chrome, and is only a placeholder for safari.
# When run in macOS, the test harness does not use WebDriver because
# SafariDriver's "glass pane" feature interferes with testing.
webdriver_url=http://127.0.0.1:4444
# Initialize so we can set up trap right away
webdriver_pid=0
atdriver_pid=0
function clean_up {
if [[ ${webdriver_pid} -ne 0 ]]; then
kill -9 ${webdriver_pid} || true
fi
if [[ ${atdriver_pid} -ne 0 ]]; then
kill -9 ${atdriver_pid} || true
fi
}
trap clean_up EXIT
./node_modules/.bin/at-driver serve --port 3031 > at-driver.log 2>&1 &
atdriver_pid=$!
poll_url() {
local url="$1"
local attempt=0
echo "Polling ${url}"
while [ ${attempt} -lt 30 ]; do
((attempt++))
response=$(curl -s -o /dev/null -w "%{http_code}" -m 2 "$url" || true)
if [ ${response:--1} -ge 99 ]; then
echo "Success: ${response} after ${attempt} tries"
return 0
else
echo "Attempt ${attempt}: URL ${url} returned HTTP ${response}. Retrying in 1 second..." >&2
sleep 1
fi
done
echo "Error: Max attempts reached. ${url} is not responding."
exit 1
}
case ${BROWSER} in
chrome)
echo "Starting chromedriver"
chromedriver --port=4444 --log-level=INFO > webdriver.log 2>&1 &
webdriver_pid=$!
echo "Started chromedriver"
poll_url $webdriver_url
;;
firefox)
echo "Starting geckodriver"
geckodriver/geckodriver > webdriver.log 2>&1 &
webdriver_pid=$!
echo "Started geckodriver"
poll_url $webdriver_url
;;
safari)
;;
*)
echo "Unknown browser (${BROWSER})"
exit 1
;;
esac
node aria-at-automation-harness/bin/host.js run-plan \
--plan-workingdir aria-at/build/${ARIA_AT_WORK_DIR} \
--debug \
--web-driver-url=${webdriver_url} \
--at-driver-url=ws://127.0.0.1:3031/session \
--reference-hostname=127.0.0.1 \
--web-driver-browser=${BROWSER} \
'{reference/**,test-*-voiceover_macos.*}' 2>&1 | \
tee harness-run.log