View all files | ||||
Virtual Screen Reader is a screen reader simulator for testing.
This package aims to supplement your testing by enabling you to automate a Virtual Screen Reader for unit test workflows the same as you would for mouse or keyboard based scenarios.
Important
This package should not replace but augment your screen reader testing, there is no substitute for testing with real screen readers and with real users.
If you are looking to automate real screen readers, check out the @guidepup/guidepup package.
If you are looking to for quick and easy Jest snapshot testing, check out the @guidepup/jest package.
There is currently no explicit specification for screen readers to adhere to, but there are a number of requirements laid out by specifications to inform screen reader expectations. This library aims to meet these requirements so that it can be as "spec compliant" as possible.
Current W3C specifications used:
Extracted requirements from these specifications can be found in docs/requirements.md. If a requirement is not met, please raise an issue.
Internal modules responsible for constructing the Virtual Screen Reader accessibility tree are being tested against Web Platform Tests for the following specs:
The current status of the WPT coverage is:
| 396 | 81 | 338 |
The included tests, skipped tests, and expected failures can be found in the WPT configuration file with reasons as to skips and expected failures. "Tentative" tests are excluded as their behaviour is often not yet confirmed.
In addition to the W3C specifications a11ysupport.io has been used as a guide for test cases in the absence of anything formal for screen reader output. In future we hope to adopt test cases laid out by the ARIA and Assistive Technologies (ARIA-AT) community group.
Note
This library should not used as a substitute for testing with real screen readers and with real screen reader users, but a means to gain quick coverage and confidence by automating away common scenarios the same as any other unit test.
Install Virtual Screen Reader to your projects:
And get cracking with your first screen reader unit test automation code!
Head over to the Guidepup Website for guides, real world examples, and complete API documentation with examples.
Some examples can also be found in the examples section.
You can also check out this project's own integration tests to learn how you could use the Virtual Screen Reader in your projects.
Here is a basic example for navigating through HTML in a Jest test in a Node setup:
Virtual Screen Reader also supports ESM environments such as browsers.
Try it out on any website in a browser of your choice by executing the following snippet in DevTools:
Virtual Screen Reader will feature detect Accessibility Object Model (AOM) support and adopt the browser's computed accessible names and roles when available.
See the Storybook example to learn how to opt into this behaviour.
Check out some of the other Guidepup modules:
Here are some similar unaffiliated projects: