feat(a11y): add axe-core WCAG 2.1 AA regression scans (AX1-AX5) and fix active filter button contrast
This commit is contained in:
@@ -95,3 +95,30 @@ test('A5: GPX delete buttons have unique aria-labels per filename', async ({ pag
|
||||
await expect(deleteBtn).toBeVisible();
|
||||
await expect(deleteBtn).toHaveAttribute('aria-label', 'Delete tokyo-day1.gpx');
|
||||
});
|
||||
|
||||
// ── AX1–AX5: axe-core WCAG 2.1 AA regression scans ───────────────────────────
|
||||
const { AxeBuilder } = require('@axe-core/playwright');
|
||||
|
||||
const WCAG_TAGS = ['wcag2a', 'wcag2aa'];
|
||||
const BLOCKING = ['critical', 'serious'];
|
||||
|
||||
function axeScan(id, url) {
|
||||
test(`${id}: ${url} passes axe WCAG 2.1 AA (critical/serious)`, async ({ page }) => {
|
||||
await page.goto(url);
|
||||
const results = await new AxeBuilder({ page }).withTags(WCAG_TAGS).analyze();
|
||||
const violations = results.violations.filter(v => BLOCKING.includes(v.impact));
|
||||
expect(
|
||||
violations,
|
||||
violations.map(v =>
|
||||
`[${v.impact}] ${v.id}: ${v.description}\n ` +
|
||||
v.nodes.map(n => n.html).join('\n ')
|
||||
).join('\n\n')
|
||||
).toHaveLength(0);
|
||||
});
|
||||
}
|
||||
|
||||
axeScan('AX1', '/');
|
||||
axeScan('AX2', '/trips/japan-korea-2026');
|
||||
axeScan('AX3', '/trips/japan-korea-2026/dailies');
|
||||
axeScan('AX4', '/trips/japan-korea-2026/dailies/2026-06-17.entry');
|
||||
axeScan('AX5', '/trips');
|
||||
|
||||
Reference in New Issue
Block a user