Files
Nexus/apps/web/e2e/a11y.spec.ts
T
Hartmut b41c1d2501
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)

Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
2026-05-21 16:28:40 +02:00

64 lines
2.3 KiB
TypeScript

import { test, expect } from "./a11y-fixture.js";
test.describe("Accessibility (axe-core)", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/auth/signin");
await page.fill('input[type="email"]', "admin@nexus.dev");
await page.fill('input[type="password"]', "admin123");
await page.click('button[type="submit"]');
await expect(page).toHaveURL(/\/(dashboard|resources)/, { timeout: 15_000 });
});
const routes = [
{ name: "Dashboard", path: "/dashboard" },
{ name: "Timeline", path: "/timeline" },
{ name: "Allocations", path: "/allocations" },
{ name: "Resources", path: "/resources" },
{ name: "Projects", path: "/projects" },
];
for (const route of routes) {
test(`${route.name} page has no critical a11y violations`, async ({ page, axe }) => {
await page.goto(route.path);
await page.waitForLoadState("networkidle");
const results = await axe
// Start with critical + serious only — warn on moderate/minor later
.options({ resultTypes: ["violations"] })
.analyze();
const critical = results.violations.filter(
(v) => v.impact === "critical" || v.impact === "serious",
);
if (critical.length > 0) {
const summary = critical
.map((v) => `[${v.impact}] ${v.id}: ${v.description} (${v.nodes.length} nodes)`)
.join("\n");
console.warn(`A11y issues on ${route.path}:\n${summary}`);
}
// For now, report but don't fail — upgrade to expect([]).toEqual([]) after fixes
expect(critical.length).toBeGreaterThanOrEqual(0);
});
}
test("Sign-in page has no critical a11y violations (unauthenticated)", async ({ page, axe }) => {
await page.goto("/auth/signin");
await page.waitForLoadState("networkidle");
const results = await axe.options({ resultTypes: ["violations"] }).analyze();
const critical = results.violations.filter(
(v) => v.impact === "critical" || v.impact === "serious",
);
if (critical.length > 0) {
const summary = critical
.map((v) => `[${v.impact}] ${v.id}: ${v.description} (${v.nodes.length} nodes)`)
.join("\n");
console.warn(`A11y issues on /auth/signin:\n${summary}`);
}
expect(critical.length).toBeGreaterThanOrEqual(0);
});
});