Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,657 changes: 1,516 additions & 7,141 deletions lib/a11y-snapshot/__snapshots__/aom.test.js.snap

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/a11y-snapshot/a11y-tree-serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ function serializeAxNode(node) {
{
"combobox list": "MenuListPopup", // what chromium uses
"combobox option": "menuitem", // what chromium uses
"date editor": "Date",
"date editor": "DateTime", // what chromium uses
"list item marker": "ListMarker", // what chromium uses
// Chromium still uses textbox.
"password text": "textbox",
// TODO: should probably use the paragraph role instead?
"text container": "text-container",
"text leaf": "text",
"time editor": "InputTime", // what chromium uses
// Chrome uses <button pressed="true|false" />
"toggle button": "togglebutton",
}[role] || role;
Expand Down
18 changes: 4 additions & 14 deletions lib/a11y-snapshot/aom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ describe.each(["chromium", "firefox"])("%s", (browserType) => {
* @type {import('playwright').Browser}
*/
let browser;
/**
* @type {import('playwright').Page}
*/
let page;

beforeAll(async () => {
browser = await playwright[browserType].launch();
Expand All @@ -19,16 +15,9 @@ describe.each(["chromium", "firefox"])("%s", (browserType) => {
await browser.close();
});

beforeEach(async () => {
page = await browser.newPage();
});

afterEach(async () => {
await page.close();
});

it("/", async () => {
blockSocials(page);
const page = await browser.newPage();
await blockSocials(page);
await gotoMuiPage(page, "/");
const tree = await page.accessibility.snapshot({ interestingOnly: false });

Expand Down Expand Up @@ -135,7 +124,8 @@ describe.each(["chromium", "firefox"])("%s", (browserType) => {
"/components/rating/",
"/components/tree-view/",
])(`%s`, async (docsRoute) => {
blockAds(page);
const page = await browser.newPage();
await blockAds(page);
await gotoMuiPage(page, docsRoute);
const main = await page.$("main");
const tree = await page.accessibility.snapshot({
Expand Down
21 changes: 8 additions & 13 deletions lib/a11y-snapshot/axe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ describe.each(["chromium"])("%s", (browserType) => {
* @type {import('playwright').Browser}
*/
let browser;
/**
* @type {import('playwright').Page}
*/
let page;

beforeAll(async () => {
browser = await playwright[browserType].launch();
Expand All @@ -40,19 +36,17 @@ describe.each(["chromium"])("%s", (browserType) => {
await browser.close();
});

beforeEach(async () => {
page = await browser.newPage();
async function newPage() {
const page = await browser.newPage();
await page.addInitScript({
path: require.resolve("axe-core"),
});
});

afterEach(async () => {
await page.close();
});
return page;
}

it("/", async () => {
blockSocials(page);
const page = await newPage();
await blockSocials(page);
await gotoMuiPage(page, "/");

await expect(axeRun(page)).resolves.toMatchAxeSnapshot();
Expand Down Expand Up @@ -81,7 +75,8 @@ describe.each(["chromium"])("%s", (browserType) => {
"/components/rating/",
"/components/tree-view/",
])(`%s`, async (docsRoute) => {
blockAds(page);
const page = await newPage();
await blockAds(page);
await gotoMuiPage(page, docsRoute);

await expect(axeRun(page)).resolves.toMatchAxeSnapshot();
Expand Down
24 changes: 12 additions & 12 deletions lib/a11y-snapshot/deploy.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"id": "5feefb6c270be300082db725",
"id": "5ff055ad0661c60008aec543",
"site_id": "64f32322-7c26-4008-b886-60800cd747b0",
"build_id": "5feefb6c270be300082db723",
"build_id": "5ff055ad0661c60008aec541",
"state": "ready",
"name": "material-ui",
"url": "http://material-ui.netlify.app",
"admin_url": "https://app.netlify.com/sites/material-ui",
"deploy_url": "http://next--material-ui.netlify.app",
"deploy_ssl_url": "https://next--material-ui.netlify.app",
"created_at": "2021-01-01T10:37:32.182Z",
"updated_at": "2021-01-01T11:06:07.003Z",
"commit_ref": "f736ebe441d73c823919887ac0f8d5fa983ef0e0",
"created_at": "2021-01-02T11:14:53.574Z",
"updated_at": "2021-01-02T11:29:49.203Z",
"commit_ref": "377deb77cc424cc4e50190a1ad787b44568a0639",
"review_id": null,
"skipped": null,
"locked": null,
"branch": "next",
"commit_url": "https://github.com/mui-org/material-ui/commit/f736ebe441d73c823919887ac0f8d5fa983ef0e0",
"commit_url": "https://github.com/mui-org/material-ui/commit/377deb77cc424cc4e50190a1ad787b44568a0639",
"log_access_attributes": {
"type": "firebase",
"url": "https://netlify-builds2.firebaseio.com/builds/5feefb6c270be300082db723/log",
"endpoint": "https://netlify-builds2.firebaseio.com",
"path": "/builds/5feefb6c270be300082db723/log",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2IjowLCJpYXQiOjE2MDk1MDUxNzMsImQiOnsidWlkIjoiIn19.MyTwpqnqDPE3ThZKF-dhq_8lpvV1UDvEWIrNaTFDhdE"
"url": "https://netlify-builds4.firebaseio.com/builds/5ff055ad0661c60008aec541/log",
"endpoint": "https://netlify-builds4.firebaseio.com",
"path": "/builds/5ff055ad0661c60008aec541/log",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2IjowLCJpYXQiOjE2MDk2MDg5NTQsImQiOnsidWlkIjoiIn19.F1yeT05D7ZoesQB_G593dvne7U5jEWu5WyadmhZOTEA"
},
"title": "[DatePicker] Fix year only view, hide the current month (#24205)",
"title": "[docs] Sync translations (#24161)",
"review_url": null,
"published_at": null,
"context": "branch-deploy",
"deploy_time": 995,
"deploy_time": 893,
"public": true,
"plugin_state": "success"
}
16 changes: 8 additions & 8 deletions lib/a11y-snapshot/mui-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ async function gotoMuiPage(page, route) {
/**
* @param {import('playwright').Page} page
*/
function blockAds(page) {
return Promise.all(
async function blockAds(page) {
await Promise.all(
[
"https://codefund.io/**",
"https://cd2n.codefund.io/**",
"https://cdn.carbonads.com/**",
].map((url) => {
return page.route(url, (route) => {
route.abort();
return page.route(url, async (route) => {
await route.abort();
});
})
);
Expand All @@ -45,12 +45,12 @@ function blockAds(page) {
/**
* @param {import('playwright').Page} page
*/
function blockSocials(page) {
return Promise.all(
async function blockSocials(page) {
await Promise.all(
["https://platform.twitter.com/**", "https://buttons.github.io/**"].map(
(url) => {
return page.route(url, (route) => {
route.abort();
return page.route(url, async (route) => {
await route.abort();
});
}
)
Expand Down
18 changes: 5 additions & 13 deletions lib/a11y-snapshot/screen-reader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ describe("nvda", () => {
* @type {import('playwright').Browser}
*/
let browser;
/**
* @type {import('playwright').Page}
*/
let page;

beforeAll(async () => {
browser = await playwright.chromium.launch({ headless: false });
Expand All @@ -43,23 +39,16 @@ describe("nvda", () => {
await browser.close();
});

beforeEach(async () => {
page = await browser.newPage();
});

afterEach(async () => {
await page.close();
});

test("quick access to the docs search", async () => {
const page = await browser.newPage();
await blockSocials(page);
await gotoMuiPage(page, "/");

await expect(async () => {
await page.keyboard.press("Control+k");
}).toMatchSpeechInlineSnapshot(`
"banner landmark"
"Search, combo box, expanded, has auto complete, editable, Search…"
"Search, combo box, expanded, has auto complete, editable, Search…, blank"
`);

await expect(async () => {
Expand All @@ -75,6 +64,7 @@ describe("nvda", () => {
}, 20000);

test("settings drawer", async () => {
const page = await browser.newPage();
await blockAds(page);
await gotoMuiPage(page, "/components/box");
const $document = await getDocument(page);
Expand Down Expand Up @@ -125,6 +115,7 @@ describe("nvda", () => {

describe("Slider", () => {
test("keyboard navigation when horizontal", async () => {
const page = await browser.newPage();
await blockAds(page);
await gotoMuiPage(page, "/components/slider");
const $document = await getDocument(page);
Expand Down Expand Up @@ -170,6 +161,7 @@ describe("nvda", () => {
}, 30000);

test("keyboard navigation when vertical", async () => {
const page = await browser.newPage();
await blockAds(page);
await gotoMuiPage(page, "/components/slider");
const $document = await getDocument(page);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lodash": "^4.17.20",
"netlify": "^6.0.7",
"node-fetch": "^2.6.1",
"playwright": "1.4.2",
"playwright": "1.7.1",
"playwright-testing-library": "^2.7.0",
"prettier": "^2.2.1",
"react": "^17.0.1",
Expand Down
9 changes: 5 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5573,10 +5573,10 @@ playwright-testing-library@^2.7.0:
"@testing-library/dom" "^7.22.2"
wait-for-expect "^3.0.2"

playwright@1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.4.2.tgz#84dac641ff7af9f465e367e01fde8a8f1cc274bf"
integrity sha512-qiQHrhU4JBxup9JoGZff6hdFL2VrD+ae5QLELGHwRq/vYNQFeJF10Z3ENnQ6hWJmG+YnpfzgoBvX+cUg4WHwTw==
playwright@1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.7.1.tgz#841638811bc39eb2fed792ffaacbcc959a0aaf5e"
integrity sha512-dOSWME42wDedJ/PXv8k0zG0Kxd6d6R2OKA51/05++Z2ISdA4N58gHlWqlVKPDkBog1MI6lu/KNt7QDn19AybWQ==
dependencies:
debug "^4.1.1"
extract-zip "^2.0.1"
Expand All @@ -5585,6 +5585,7 @@ [email protected]:
mime "^2.4.6"
pngjs "^5.0.0"
progress "^2.0.3"
proper-lockfile "^4.1.1"
proxy-from-env "^1.1.0"
rimraf "^3.0.2"
ws "^7.3.1"
Expand Down