Skip to content

Commit

Permalink
Bump screen-reader-testing-library to 0.0.6 (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Dec 6, 2020
1 parent 0daef49 commit e855d8b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 73 deletions.
105 changes: 37 additions & 68 deletions lib/a11y-snapshot/screen-reader.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/* global __NVDA_LOG_FILE_PATH__ */
const playwright = require("playwright");
const { getDocument, queries } = require("playwright-testing-library");
const {
awaitNvdaRecording,
createJestSpeechRecorder,
} = require("screen-reader-testing-library");
const { awaitNvdaRecording } = require("screen-reader-testing-library");
const {
gotoMuiPage: gotoMuiPage_actual,
blockAds,
Expand All @@ -30,7 +26,6 @@ async function gotoMuiPage(page, route) {
}

describe("nvda", () => {
const speechRecorder = createJestSpeechRecorder(__NVDA_LOG_FILE_PATH__);
/**
* @type {import('playwright').Browser}
*/
Expand Down Expand Up @@ -60,26 +55,20 @@ describe("nvda", () => {
await blockSocials(page);
await gotoMuiPage(page, "/");

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("s");
})
).resolves.toMatchSpeechInlineSnapshot(`
await expect(async () => {
await page.keyboard.press("s");
}).toMatchSpeechInlineSnapshot(`
"banner landmark"
"Search, combo box, expanded, has auto complete, editable, Search…"
`);

await expect(
speechRecorder.record(async () => {
await page.keyboard.type("Rating");
})
).resolves.toMatchSpeechInlineSnapshot(``);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("ArrowDown");
})
).resolves.toMatchSpeechInlineSnapshot(`
await expect(async () => {
await page.keyboard.type("Rating");
}).toMatchSpeechInlineSnapshot(``);

await expect(async () => {
await page.keyboard.press("ArrowDown");
}).toMatchSpeechInlineSnapshot(`
"list"
"Link to the result, 1 of 5"
`);
Expand All @@ -93,64 +82,44 @@ describe("nvda", () => {
const $openSettingsButton = await queries.getByRole($document, "button", {
name: "Toggle settings drawer",
});
await expect(
speechRecorder.record(async () => {
await $openSettingsButton.focus();
})
).resolves.toMatchSpeechInlineSnapshot(
await expect(async () => {
await $openSettingsButton.focus();
}).toMatchSpeechInlineSnapshot(
`"banner landmark, Toggle settings drawer, button"`
);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Enter");
})
).resolves.toMatchSpeechInlineSnapshot(
await expect(async () => {
await page.keyboard.press("Enter");
}).toMatchSpeechInlineSnapshot(
`"clickable, Settings, heading, level 5, , button, , separator, Mode, Mode, grouping, light, toggle button, not pressed, system, toggle button, pressed, dark, toggle button, not pressed, out of grouping, Direction, Direction, grouping, light, toggle button, pressed, system, toggle button, not pressed, out of grouping, Color, Edit website colors"`
);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(`"button"`);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(
await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(`"button"`);

await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(
`"Mode, grouping, light, toggle button, not pressed"`
);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(`"system, toggle button, pressed"`);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(
`"dark, toggle button, not pressed"`
);
await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(`"system, toggle button, pressed"`);

await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(`"dark, toggle button, not pressed"`);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(
await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(
`"Direction, grouping, light, toggle button, pressed"`
);

await expect(
speechRecorder.record(async () => {
await page.keyboard.press("Tab");
})
).resolves.toMatchSpeechInlineSnapshot(
`"system, toggle button, not pressed"`
);
await expect(async () => {
await page.keyboard.press("Tab");
}).toMatchSpeechInlineSnapshot(`"system, toggle button, not pressed"`);
}, 30000);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"playwright-testing-library": "^2.7.0",
"prettier": "^2.2.1",
"react": "^17.0.1",
"screen-reader-testing-library": "^0.0.3",
"screen-reader-testing-library": "^0.0.6",
"yargs": "^16.1.1",
"yauzl": "^2.10.0"
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6362,10 +6362,10 @@ scheduler@^0.18.0:
loose-envify "^1.1.0"
object-assign "^4.1.1"

screen-reader-testing-library@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/screen-reader-testing-library/-/screen-reader-testing-library-0.0.3.tgz#b07b387aeeba62c4f215460853c8c1095771dc42"
integrity sha512-w1T4Kl+51rvO4fcTOb4jZ/NdHU8Jk+IiZLW6JLSoYvW/gbPi8UId+PnbJVjK21wv+h6Np/dVBSyG7pv22uQcGA==
screen-reader-testing-library@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/screen-reader-testing-library/-/screen-reader-testing-library-0.0.6.tgz#c28365e74ac2fecd3d2f16ed8ee6b3a67fe817b4"
integrity sha512-DrhiiK/Eyr8WOFv/9NV8BzI5pWwzCt8c8se3sQhEkYwZxdW631l2jfg/1pCc/ywjZwph+SdoAmM1YfUd7fXGwA==
dependencies:
extract-zip "^2.0.1"
fs-extra "^9.0.1"
Expand Down

0 comments on commit e855d8b

Please sign in to comment.