Files
clawmates/frontend/tests/e2e/p6-a11y.spec.ts
T
Omar SobhandClaude Fable 5 ace66d7ffb P6 complete: PWA, route motion, dex browser-flow OAuth, release pipeline
- PWA (§16): hand-rolled 60-line service worker (network-first pages with
  offline fallback, cache-first hashed statics, /api NEVER touched — SSE
  and approvals stay live), app manifest with §2 identity, stdlib-
  generated coral claw icons, prod-only registration. E2E asserts
  manifest, real PNG icons, an ACTIVATED service worker, and the /api
  bypass. (Serwist was tried and dropped: its webpack plugin fights
  Next 16's Turbopack builds; sixty lines we own beat a plugin we fight.)
- Route motion (§3): (workspace) template re-mounts per navigation with a
  quiet fade-rise, zeroed under prefers-reduced-motion. The a11y sweep
  now settles running animations before scanning — axe was reading
  mid-fade opacity as contrast failures
- OAuth browser flow vs REAL dex: the e2e harness boots dexidp/dex with
  static client + password; the journey drives the actual dex login form
  from /api/apps/oauth/start through the callback 303 and asserts the
  app reads connected (closing the P4 deferral honestly)
- release.yml: tag-triggered — builds all four images + postgres, saves
  tarballs, assembles the SIGNED air-gapped bundle (compose, config,
  migrations, seccomp profile, installer, bundler binary), derives the
  public key via the new Could not find command "pubkey". subcommand (tested), verifies
  the bundle customer-style with the public half only, attaches tarball
  + public key to the GitHub release

153 Rust + 63 frontend tests + 29 Playwright journeys.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-10 09:57:21 -05:00

78 lines
2.7 KiB
TypeScript

import AxeBuilder from "@axe-core/playwright";
import { expect, test, type Page } from "@playwright/test";
// P6 exit (spec §17): a11y sign-off. Serious and critical axe violations
// fail the build on every primary surface.
const OWNER_EMAIL = "[email protected]";
const OWNER_PASSWORD = "e2e-password";
async function signIn(page: Page) {
await page.goto("/login");
await page.getByLabel("Email").fill(OWNER_EMAIL);
await page.getByLabel("Password").fill(OWNER_PASSWORD);
await page.getByRole("button", { name: "Sign in" }).click();
await expect(page.getByRole("heading", { name: "TeamClaw" })).toBeVisible();
}
async function expectClean(page: Page, context: string) {
// Route-enter fades opacity; scanning mid-animation reads false
// contrast failures. Let running animations settle first.
await page.evaluate(() =>
Promise.allSettled(document.getAnimations().map((a) => a.finished)),
);
const results = await new AxeBuilder({ page }).analyze();
const blocking = results.violations.filter(
(v) => v.impact === "serious" || v.impact === "critical",
);
expect(
blocking.map((v) => `${v.id}: ${v.help} (${v.nodes.length} nodes)`),
`axe violations on ${context}`,
).toEqual([]);
}
test("login page is clean", async ({ page }) => {
await page.goto("/login");
await expect(page.getByRole("button", { name: "Sign in" })).toBeVisible();
await expectClean(page, "login");
});
test("shell, chat, and computer panel are clean", async ({ page }) => {
await signIn(page);
await expectClean(page, "workspace home");
await page.getByRole("link", { name: /Scout/ }).click();
await expect(page).toHaveURL(/\/claws\/.+\/chat\//);
await expectClean(page, "chat");
await page.getByRole("button", { name: "Computer" }).click();
const panel = page.getByRole("complementary", { name: "Computer" });
await expect(panel.getByText(/Scout's Computer/)).toBeVisible();
await expectClean(page, "computer home");
await panel.getByRole("button", { name: "Settings" }).click();
await expect(panel.getByText("Managed by")).toBeVisible();
await expectClean(page, "settings app");
});
test("global pages are clean", async ({ page }) => {
await signIn(page);
for (const [link, marker] of [
["Skills", /Skill Library/],
["Approvals", /review/i],
["Team", /workspace/],
["Credits", /Available credits/],
] as const) {
await page.getByRole("link", { name: link, exact: true }).click();
await expect(page.getByText(marker).first()).toBeVisible();
await expectClean(page, link);
}
});
test("the wizard is clean", async ({ page }) => {
await signIn(page);
await page.getByRole("link", { name: "New claw" }).click();
await expect(page.getByText("Create your Claw")).toBeVisible();
await expectClean(page, "wizard");
});