voiceover-test #1223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |