chore: add accessibility tests for security and uptime pages

This commit is contained in:
GitHub Actions
2026-04-20 17:44:01 +00:00
parent 03101012b9
commit 0c87c350e5
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import { test } from '../fixtures/a11y';
import { waitForLoadingComplete } from '../utils/wait-helpers';
import { expectNoA11yViolations } from '../utils/a11y-helpers';
import { getBaselinedRuleIds } from './a11y-baseline';
const securityRoutes = [
{ route: '/security', name: 'security dashboard' },
{ route: '/security/access-lists', name: 'access lists' },
{ route: '/security/crowdsec', name: 'CrowdSec' },
{ route: '/security/waf', name: 'WAF' },
{ route: '/security/rate-limiting', name: 'rate limiting' },
{ route: '/security/headers', name: 'security headers' },
{ route: '/security/encryption', name: 'encryption' },
{ route: '/security/audit-logs', name: 'audit logs' },
] as const;
test.describe('Accessibility: Security', () => {
test.describe.configure({ mode: 'parallel' });
for (const { route, name } of securityRoutes) {
test(`${name} page has no critical a11y violations`, async ({ page, makeAxeBuilder }) => {
await test.step(`Navigate to ${name}`, async () => {
await page.goto(route);
await waitForLoadingComplete(page);
});
await test.step('Run axe accessibility scan', async () => {
const results = await makeAxeBuilder().analyze();
test.info().attach('a11y-results', {
body: JSON.stringify(results.violations, null, 2),
contentType: 'application/json',
});
expectNoA11yViolations(results, {
knownViolations: getBaselinedRuleIds(route),
});
});
});
}
});

View File

@@ -0,0 +1,28 @@
import { test } from '../fixtures/a11y';
import { waitForLoadingComplete } from '../utils/wait-helpers';
import { expectNoA11yViolations } from '../utils/a11y-helpers';
import { getBaselinedRuleIds } from './a11y-baseline';
test.describe('Accessibility: Uptime', () => {
test.describe.configure({ mode: 'parallel' });
test('uptime page has no critical a11y violations', async ({ page, makeAxeBuilder }) => {
await test.step('Navigate to uptime', async () => {
await page.goto('/uptime');
await waitForLoadingComplete(page);
});
await test.step('Run axe accessibility scan', async () => {
const results = await makeAxeBuilder().analyze();
test.info().attach('a11y-results', {
body: JSON.stringify(results.violations, null, 2),
contentType: 'application/json',
});
expectNoA11yViolations(results, {
knownViolations: getBaselinedRuleIds('/uptime'),
});
});
});
});