Skip to content

SCRUM-261: AdminUI mocks, unit tests and e2e flows

Plan ref: UI-16 (docs/11-admin-plane-plan.md). Stacked on SCRUM-260.

What exists

Piece Notes
Mock coverage tests/unit/mock-coverage.spec.ts lists all 47 UI-facing backend routes (admin-auth incl. /account/*, users, config, dashboard) and fails if one has no MSW handler. Added the missing GET /admin-auth/audit. Invite/reset links minted on the Users page now redeem in a fresh tab (the mock registers the token in localStorage)
Unit tests success + error paths for every src/api/* client function that lacked them (auth login/verify/logout, publish, channel head, create version, readers, account anonymous paths, packs/dashboard envelopes); 569 tests
e2e flows sign-in (password, password + TOTP, refusal, sign out); invite → onboard (admin mints an invite on Users, the link opens in a fresh page, live_ops signs straight in, admin goes to TOTP enrollment); draft → version → publish → rollback (release-compose.spec.ts)
Flake fix tests/e2e/fixtures.ts: every spec navigates through gotoApp, which reloads (at most twice) only when the load saw net::ERR_NETWORK_CHANGED, and annotates the test network-change. No Playwright retries, no timeout changes
App fix ReleaseComposeView no longer requests /channels//releases when Ionic keeps it mounted after leaving the composer

The flake

The full suite failed a random test about one run in two with a 30 s timeout at the first step after goto. The trace of one (versions.spec.ts, login form never appeared) shows Failed to load resource: net::ERR_NETWORK_CHANGED on every module and stylesheet of that load: WSL's networking changed under Chromium, which aborts in-flight requests, so the app never booted. It is the host, not the app; CI on Linux does not see it. Playwright's route.abort has no network-changed code, so the reload path cannot be forced in a test; it has not fired in the runs below.

How to verify

cd services/adminui
npm run typecheck && npm run lint && npm run format:check && npx vitest run && npm run build
npx playwright test

Results at time of writing

  • typecheck, lint, format:check, build: pass. vitest: 569 passed (55 files).
  • Playwright: 47/47 in four consecutive full runs (three by DeepSeek, one by Claude); no network-change reloads were needed.

How it was built

Claude diagnosed the flake from the trace and listed the backend routes from the route tables. DeepSeek scoped (Landlock) to services/adminui, reasoning effort low, wrote the coverage test, handlers, unit tests, flows and the fixture. Claude review checked the fixture's scope (only the one error, navigation only).