Skip to content

Instantly share code, notes, and snippets.

@cmorten
Last active November 4, 2022 16:23
Show Gist options
  • Select an option

  • Save cmorten/8872cbf459436dc76e970283d88f6ff1 to your computer and use it in GitHub Desktop.

Select an option

Save cmorten/8872cbf459436dc76e970283d88f6ff1 to your computer and use it in GitHub Desktop.
CircleCI VoiceOver PoC
version: 2.1
orbs:
macos: circleci/[email protected]
jobs:
voiceover-test:
macos:
xcode: 12.5.1
steps:
- checkout
- macos/add-uitest-permissions
- macos/add-safari-permissions
- run:
name: Add VoiceOver AppleScript DB Entry
command: sudo bash -c 'echo -n "a" > /private/var/db/Accessibility/.VoiceOverAppleScriptEnabled'
- run:
name: Set System Preferences Default
command: defaults write com.apple.VoiceOver4/default SCREnableAppleScript 1
- run:
name: VoiceOver Test
command: osascript ./test.applescript || true
- store_artifacts:
path: ./screenshots
workflows:
version: 2
voiceover-poc-workflow:
jobs:
- voiceover-test
delay 1
do shell script "mkdir -p ./screenshots/"
do shell script "/System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"
delay 1
tell application "System Events"
tell application "Safari" to activate
repeat until (name of every process contains ("Safari"))
delay 0.1
end repeat
repeat until (exists window 1 of application process "Safari")
delay 0.1
end repeat
repeat until (name of every process contains ("VoiceOver"))
delay 0.1
end repeat
tell application "VoiceOver" to activate
delay 5
do shell script "screencapture ./screenshots/voiceover_activated.png"
-- Interact with element
key code 125 using {control down, option down, shift down}
delay 1
-- Move right 5 times
key code 124 using {control down, option down}
delay 1
key code 124 using {control down, option down}
delay 1
key code 124 using {control down, option down}
delay 1
key code 124 using {control down, option down}
delay 1
key code 124 using {control down, option down}
delay 1
-- Navigate to GitHub
tell application "Safari" to activate
keystroke "https://github.com/guidepup/guidepup"
key code 36
delay 2
do shell script "screencapture ./screenshots/voiceover_navigated.png"
tell application "VoiceOver" to quit
end tell
tell application "Safari" to quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment