Complete worked example
typescript
import { test, expect } from "../support/test.js";
import AxeBuilder from "@axe-core/playwright";
test("local page automated accessibility scan", async ({page}) => {
await page.goto("/");
await expect(page.getByRole("list", {name:"Matching roles"}).getByRole("listitem")).toHaveCount(4);
const result = await new AxeBuilder({page}).analyze();
expect(result.violations).toEqual([]);
});- Reasoning
- The scan runs on loaded content and reports a defined class of automated findings.