Files
clawmates/frontend/tests/e2e/p6-pwa.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

41 lines
1.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
// P6 exit (§16 NFR): installable PWA — manifest, icons, and a live
// service worker that never touches /api.
test("the app is installable: manifest, icons, service worker", async ({
page,
}) => {
await page.goto("/login");
// Manifest is linked and serves the §2 identity.
const href = await page
.locator('link[rel="manifest"]')
.getAttribute("href");
expect(href).toBeTruthy();
const manifest = await (await page.request.get(href!)).json();
expect(manifest.name).toBe("TeamClaw");
expect(manifest.display).toBe("standalone");
expect(manifest.theme_color).toBe("#f96565");
// Icons are real PNGs.
for (const icon of manifest.icons) {
const res = await page.request.get(icon.src);
expect(res.status()).toBe(200);
expect((await res.body()).subarray(0, 4).toString("latin1")).toContain(
"PNG",
);
}
// The service worker registers and activates (prod build in e2e).
const state = await page.evaluate(async () => {
const registration = await navigator.serviceWorker.ready;
return registration.active?.state;
});
expect(state).toBe("activated");
// The SW intercepts static assets but NEVER /api (live SSE).
const swText = await (await page.request.get("/sw.js")).text();
expect(swText).toContain('url.pathname.startsWith("/api/")');
});