-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (153 loc) · 5.91 KB
/
voiceover-test.yml
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
name: voiceover-test
on:
workflow_dispatch:
inputs:
aria_at_ref:
description: |
The sha / ref to checkout for aria-at tests
required: false
type: string
work_dir:
description: |
The --plan-workingdir passed to the aria-at-automation harness.
Based from the aria-at repo build folder.
Uses a default of tests/alert if not provided.
required: false
type: string
callback_url:
description: |
The harness will send POST requests to this url using callback_header
header with test results.
required: false
type: string
status_url:
description: |
The harness will send POST requests to this url using callback_header
header with status updates.
required: false
type: string
callback_header:
description: |
The harness will send POST requests to callback_url using this header
with status updates.
required: false
type: string
macos_version:
description: "macOS version to run the test on"
required: false
type: choice
options:
- "13"
- "14"
default: "14"
browser:
description: |
The browser to use for testing, "chrome" or "firefox" or "safari", default "safari"
required: false
type: string
at_driver_server_version:
description: |
The version or version range of the macOS AT Driver server to install from npm
required: false
type: string
default: "~0.0.6"
env:
ARIA_AT_WORK_DIR: ${{ inputs.work_dir || 'tests/alert' }}
ARIA_AT_CALLBACK_URL: ${{ inputs.callback_url }}
ARIA_AT_STATUS_URL: ${{ inputs.status_url }}
ARIA_AT_CALLBACK_HEADER: ${{ inputs.callback_header || 'x-header-param:empty' }}
BROWSER: ${{ inputs.browser || 'safari' }}
AT_DRIVER_SERVER_VERSION: ${{ inputs.at_driver_server_version }}
jobs:
voiceover-test:
runs-on: macos-${{ inputs.macos_version }}
steps:
# Checkout all repos first (helps cache purposes)
- uses: actions/checkout@v4
- name: Log job state QUEUED
if: inputs.status_url
run: ./report-status.sh QUEUED ''
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- uses: browser-actions/setup-chrome@v1
if: inputs.browser == 'chrome'
with:
chrome-version: stable
- uses: browser-actions/setup-firefox@v1
if: inputs.browser == 'firefox'
- name: Install geckodriver
if: inputs.browser == 'firefox'
env:
token: ${{ secrets.GITHUB_TOKEN }}
run: ./install-geckodriver.sh
- name: Setup Environment
uses: guidepup/[email protected]
- name: Install the macOS AT Driver server package
run: npm install @bocoup/macos-at-driver-server@"${AT_DRIVER_SERVER_VERSION}"
- name: Configure the system to support the AT Driver server
env:
DEBUG: "*"
working-directory: node_modules/.bin
run: ./at-driver install --unattended
- name: Wait for the AT Driver server to be ready
working-directory: node_modules/.bin
run: ../../wait-for-server.sh
- name: Checkout aria-at ref ${{ inputs.aria_at_ref || 'master' }}
uses: actions/checkout@v4
with:
repository: "w3c/aria-at"
path: "aria-at"
ref: ${{ inputs.aria_at_ref || 'master' }}
- name: Checkout aria-at-automation-harness
uses: actions/checkout@v4
with:
repository: "w3c/aria-at-automation-harness"
path: "aria-at-automation-harness"
- name: "aria-at: npm install"
working-directory: aria-at
run: npm install
- name: "aria-at: npm run build"
working-directory: aria-at
run: npm run build
- name: "automation-harness: npm install"
working-directory: aria-at-automation-harness
run: npm install
- name: Start VoiceOver
run: "/System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"
# This feature must be enabled in order for the harness to inspect the
# the page (AppleScript is used for this purpose instead of
# SafariDriver because SafariDriver implements a "glass pane" which
# rejects the kinds of interactions--namely, key presses--that ARIA-AT
# tests must simulate).
# https://stackoverflow.com/questions/37802673/allow-javascript-from-apple-events-in-safari-through-terminal-mac
- name: Configure Safari to Allow JavaScript from Apple Events
run: defaults write -app Safari AllowJavaScriptFromAppleEvents 1
# Ensure that VoiceOver doesn't automatically read through the entirety of
# a webpage when its loaded and there isn't immediate keyboard interaction.
# This is turned on by default for some versions of MacOS
# https://support.apple.com/guide/voiceover/general-cpvouwebpageloading/mac
- name: Configure VoiceOver not to "Automatically Speak Web Page"
run: defaults write com.apple.VoiceOver4/default SCRCUserDefaultsAutomaticallySpeakWebPage 0
- name: Log job state RUNNING
if: inputs.status_url
run: './report-status.sh RUNNING "\"work_dir\": \"${ARIA_AT_WORK_DIR}\","'
- name: Run harness
run: ./run-tester.sh
- name: Log job state ERROR
if: failure() && inputs.status_url
run: ./report-status.sh ERROR ''
- name: Log job state COMPLETED
if: success() && inputs.status_url
run: ./report-status.sh COMPLETED ''
- name: upload *.{log,png}
uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: |
*.log
*.png