ADR-WEB-10. Visual QA loop: Playwright, shots, lab and critique
Source:
docs/decisions/ADR-WEB-10-visual-qa-loop.md. Generated at build time; edit the source file.
Date: 2026-11-21 Status: Accepted
Context
Section titled “Context”The owner requires a premium, non-generic UI. Tests cannot judge that, so every visual task needs screenshots looked at critically against packages/ui/DESIGN.md, repeatably and at the same sizes.
Decision
Section titled “Decision”- Playwright projects in
apps/web/playwright.config.ts:e2e(Chromium 1280x800) andvisual-{390,1440}-{light,dark}(390x844 and 1440x900,colorSchemeset,reducedMotion: "reduce").baseURLisE2E_BASE_URL, defaulthttp://localhost:3100. pnpm shots(scripts/shots.ts, pure helpers inscripts/shots-lib.ts) captures full-page PNGs for each route at 390 and 1440, light and dark, into.shots/<slug>/<width>-<theme>.png. It waits fornetworkidleanddocument.fonts.ready, hides[data-lab-chrome], and exits 1 if any route answers 400 or more.--motionwrites a 12-frame strip at 100 ms instead of using reduced motion. The script resolves Playwright fromapps/web, so no root dependency was added. On Git Bash for Windows, setMSYS_NO_PATHCONV=1or--routes /ais rewritten into a Windows path.- Lab pattern:
/lab/<surface>/<a|b|c>pages wrap variants inLabFrame, which adds a variant switcher and a rationale footer, both markeddata-lab-chrome./lab/layout.tsxcallsnotFound()unlesslabEnabled(process.env)(NODE_ENV !== "production" || LAB_ENABLED === "1") and setsrobots: { index: false }. The layout isforce-dynamicso the check runs per request. - Critique template in
packages/ui/qa/critique-prompt.md: a critic sees screenshots, DESIGN.md and REFERENCES.md, never source, and returns at most 10 ranked issues plus a verdict. Rounds are logged underpackages/ui/qa/log/. - Playwright MCP is configured in the project-level
.mcp.jsononly (@playwright/mcp@0.0.86, isolated, 1440x900), never in user-level config.
Alternatives
Section titled “Alternatives”- Screenshot tests with pixel baselines: rejected; the goal is critical judgement, not regression.
- Playwright as a root dependency: rejected to keep the lockfile unchanged.
Consequences
Section titled “Consequences”- The MCP server only appears in a new Claude Code session; verify with
/mcp(if it lists no tools, runnpx clear-npx-cacheand retry). Not verified in the implementing session; see the task report. - Production builds 404 on
/labunlessLAB_ENABLED=1. The layout, the lab index and/styleguideall call the singlelabEnabledinlab/lab-enabled.ts, whoseflagOnis also whatenv.tsuses. - Warning:
docker-compose.ymldefaultsLAB_ENABLED=1. That is for local development only; never carry it into a deployment, or the lab and styleguide become public.