import AxeBuilder from '@axe-core/playwright'; import { test, expect } from '../fixtures'; import { DEFAULT_ADMIN_BASE_URL } from '../env-defaults'; /** * Lightweight a11y smoke — critical violations only (axe impact: critical|serious). * Does not block on moderate/minor noise. */ test.describe('a11y smoke @smoke', () => { test('viewer home has no critical axe violations', async ({ page }) => { await page.goto('/'); await expect(page.getByRole('link', { name: /skip to main content/i })).toBeAttached(); const results = await new AxeBuilder({ page }) .withTags(['wcag2a', 'wcag2aa']) .analyze(); const bad = results.violations.filter((v) => v.impact === 'critical' || v.impact === 'serious'); expect(bad, JSON.stringify(bad, null, 2)).toEqual([]); }); test('admin login has no critical axe violations', async ({ page }) => { const adminBaseUrl = process.env.PLAYKIT_ADMIN_BASE_URL || DEFAULT_ADMIN_BASE_URL; await page.goto(`${adminBaseUrl}/login`); await expect(page.getByRole('button', { name: /sign in/i })).toBeVisible({ timeout: 20_000 }); const results = await new AxeBuilder({ page }) .withTags(['wcag2a', 'wcag2aa']) .analyze(); const bad = results.violations.filter((v) => v.impact === 'critical' || v.impact === 'serious'); expect(bad, JSON.stringify(bad, null, 2)).toEqual([]); }); });