Created
July 29, 2024 08:49
-
-
Save adamliptrot-oc/9cf4281033a4db2a2d9e3db7aee1163b to your computer and use it in GitHub Desktop.
Automating virtual screen-readers with Guidepup and Jest
This file contains hidden or 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
| test("should navigate to the input and announce the label and hint", async () => { | |
| document.body.innerHTML = ` | |
| <form> | |
| <label for="ref">What is your reference?</label> | |
| <div class="hint" id="ref-hint">This is 10 characters.</div> | |
| <input type="text" name="ref" id="ref" aria-describedby="ref-hint" /> | |
| <button>Save</button> | |
| </form> | |
| `; | |
| await virtual.start({ container: document.body }); | |
| // Move to form | |
| await virtual.perform(virtual.commands.moveToNextForm); | |
| // Move to the input | |
| await virtual.next(); | |
| await virtual.next(); | |
| await virtual.next(); | |
| const lastSpokenPhrase = await virtual.lastSpokenPhrase(); | |
| expect(lastSpokenPhrase).toContain("What is your reference?"); | |
| expect(lastSpokenPhrase).toContain("This is 10 characters"); | |
| await virtual.stop(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment