41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import AxeBuilder from "@axe-core/playwright";
|
|
|
|
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
import {
|
|
gotoTechLog,
|
|
TECH_LOG_CANONICAL_ROUTES,
|
|
} from "../support/browser/tech-log-fixtures.ts";
|
|
|
|
for (const route of TECH_LOG_CANONICAL_ROUTES) {
|
|
test(`@a11y ${route.routeId} has no critical or serious Axe violations`, async ({
|
|
page,
|
|
}) => {
|
|
await gotoTechLog(page, route.path);
|
|
const results = await new AxeBuilder({ page })
|
|
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
|
|
.analyze();
|
|
expect(
|
|
results.violations.filter((violation) =>
|
|
["critical", "serious"].includes(violation.impact ?? ""),
|
|
),
|
|
).toEqual([]);
|
|
});
|
|
}
|
|
|
|
test("@a11y keyboard reaches a visible Public navigation focus indicator", async ({
|
|
page,
|
|
}) => {
|
|
await gotoTechLog(page, "/");
|
|
const action = page.getByRole("link", { name: "TechLog 홈" });
|
|
await action.focus();
|
|
await expect(action).toBeFocused();
|
|
await expect(action).toHaveCSS("outline-style", "solid");
|
|
});
|
|
|
|
test("@a11y reduced-motion preference leaves no running document animations", async ({
|
|
page,
|
|
}) => {
|
|
await gotoTechLog(page, "/");
|
|
expect(await page.evaluate(() => document.getAnimations().length)).toBe(0);
|
|
});
|