Files
pchelpmaster/tests/e2e/a11y.ts
T
kamaskandClaude Opus 5.5 82e097f876 test(e2e): add playwright e2e stand with test pocketbase and axe checks
- playwright.config.ts: test PocketBase (port 8190) and ng serve (port 4300)
  as webServers, SIGTERM shutdown so the stand removes its temp dir
- fixtures: user via open registration, api SDK client, signedInPage with pb_auth cookie
- expectNoA11yViolations runs all axe rules (WCAG and best-practice)
- render home route on the server; main and h1 placeholder in app shell
- config tests for playwright.config.ts in test:lint; docs updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:12:04 +03:00

14 lines
635 B
TypeScript

import AxeBuilder from '@axe-core/playwright';
import type { Page } from '@playwright/test';
/** Запускает axe со всеми правилами (WCAG и best-practice) и падает со списком нарушений. */
export async function expectNoA11yViolations(page: Page): Promise<void> {
const { violations } = await new AxeBuilder({ page }).analyze();
if (violations.length === 0) return;
const list = violations
.map((v) => `- ${v.id}: ${v.help} (элементов: ${v.nodes.length})`)
.join('\n');
throw new Error(`Нарушения доступности:\n${list}`);
}