- Add shared accessibility test helper (tests/accessibility/helper.js/ts) - scanAccessibility(): runs axe-core scans with WCAG 2.1 AA tags - formatViolations(): formats violation details for error reporting - expectNoAccessibilityViolations(): asserts no violations - Add smoke tests demonstrating helper usage (tests/accessibility/smoke.spec.js/ts) - Refactor existing accessibility tests to use shared helper - Simplified a11y.spec.js to use expectNoAccessibilityViolations() - Maintains all existing test coverage Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
803 B
JavaScript
25 lines
803 B
JavaScript
const { test } = require('@playwright/test');
|
|
const { expectNoAccessibilityViolations } = require('./accessibility/helper');
|
|
|
|
const pages = [
|
|
{ name: 'index', path: '/index.html' },
|
|
{ name: 'live', path: '/live.html' },
|
|
{ name: 'fleet', path: '/fleet.html' },
|
|
{ name: 'setup', path: '/setup.html' },
|
|
{ name: 'integrations', path: '/integrations.html' },
|
|
];
|
|
|
|
for (const page of pages) {
|
|
test.describe(`${page.name} page`, () => {
|
|
test('has no WCAG AA violations', async ({ browser }) => {
|
|
const context = await browser.newContext();
|
|
const pg = await context.newPage();
|
|
await pg.goto(page.path, { waitUntil: 'load' });
|
|
|
|
// Use the shared accessibility helper
|
|
await expectNoAccessibilityViolations(pg, page.path);
|
|
|
|
await context.close();
|
|
});
|
|
});
|
|
}
|