|
| 1 | +import AxeBuilder from "@axe-core/playwright"; |
| 2 | +import { expect, test } from "@playwright/test"; |
| 3 | + |
| 4 | +const pagesToScan = [ |
| 5 | + { name: "home", path: "/" }, |
| 6 | + { name: "about", path: "/about/" }, |
| 7 | + { name: "community", path: "/community/" }, |
| 8 | + { name: "contribute", path: "/contribute/" }, |
| 9 | + { name: "education resources", path: "/education-resources/" }, |
| 10 | + { name: "events", path: "/events/" }, |
| 11 | + { name: "libraries", path: "/libraries/" }, |
| 12 | + { name: "people", path: "/people/" }, |
| 13 | + { name: "sketches", path: "/sketches/" }, |
| 14 | + { name: "search", path: "/search/" }, |
| 15 | + { name: "tutorials index", path: "/tutorials/" }, |
| 16 | + { name: "tutorial", path: "/tutorials/get-started/" }, |
| 17 | + { name: "examples index", path: "/examples/" }, |
| 18 | + { name: "example", path: "/examples/Shapes-And-Color-Shape-Primitives/" }, |
| 19 | + { name: "reference index", path: "/reference/" }, |
| 20 | + { name: "reference function", path: "/reference/p5/ellipse/" }, |
| 21 | + { name: "reference class method", path: "/reference/p5.Vector/add/" }, |
| 22 | + { name: "reference p5.sound", path: "/reference/p5.sound/" }, |
| 23 | + { name: "404", path: "/no-such-page/" }, |
| 24 | +]; |
| 25 | + |
| 26 | +test.describe("a11y", () => { |
| 27 | + for (const { name, path } of pagesToScan) { |
| 28 | + test(`${name} should not have any automatically detectable accessibility issues`, async ({ |
| 29 | + page, |
| 30 | + }) => { |
| 31 | + await page.goto(path); |
| 32 | + const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); |
| 33 | + expect(accessibilityScanResults.violations).toEqual([]); |
| 34 | + }); |
| 35 | + } |
| 36 | +}); |
0 commit comments