UCDL Accessibility Use Case Definition Language
Contents

Writing Accessibility Use Case Tests with @afixt/usecase-runner

Part 5c: Screen-Reader Assertions with sr_says

sr_says reads the spoken-phrase log of an active screen-reader session and asserts that an expected substring (or regex) appears:

- sr_says: '"Welcome to the dashboard"' # substring match
- sr_says: matches "(Welcome|Hello).*dashboard" # regex
- sr_says: role "alert" "Email is required" # role-filtered

Diffing the log around a prior step

The after <step> form restricts the assertion to phrases produced during or after the most-recent matching prior step:

- activate: button "Search"
- sr_says: '"3 results found" after activate button "Search"'

Live-region announcements often arrive asynchronously. Use within <duration> to poll the log up to a deadline. It takes the same three spellings wait does — 5000, 5000ms or 5s, with a bare number meaning milliseconds. The runner passes as soon as a match appears, or fails at the deadline:

- sr_says: '"Loading complete" within 5s'
- sr_says: '"Saved" after activate button "Save" within 2s'

Configure the screen-reader driver via RunOptions.srDriver: virtual (default, in-process via @guidepup/virtual-screen-reader), auto (autodetect), voiceover, or nvda.