Skip to content

[NO-ISSUE] test(storybook): cover light theme, tablet and mobile in the visual matrix#756

Open
robsongajunior wants to merge 4 commits into
devfrom
test/storybook-visual-matrix
Open

[NO-ISSUE] test(storybook): cover light theme, tablet and mobile in the visual matrix#756
robsongajunior wants to merge 4 commits into
devfrom
test/storybook-visual-matrix

Conversation

@robsongajunior

@robsongajunior robsongajunior commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

16 files modified another are added images

The visual regression layer screenshotted every story exactly once — dark theme at 1280×720 — so light mode, tablet, and mobile were never tested, even though light tokens have full parity and the responsive spacing/typography tokens reshape nearly every story below md.

Every story is now snapshotted in a 6-mode matrix: dark|light × desktop(1280×720)|tablet(768×1024)|mobile(375×667), aligned to the theme's token breakpoints. The Storybook toolbar gets the same DS viewports.

  • .storybook/visual-modes.js (new): single source of truth — viewports, theme classes, mode matrix, snapshot naming, resolveModes (per-story narrowing + VISUAL_MODES env filter). Feeds both the test-runner and preview.js (toolbar viewports + theme decorator classes).
  • test-runner.js: per-story mode loop (resize → theme class flip → double-rAF settle → fonts/images settled → screenshot). Failures are collected per mode so one run writes every failing diff. The freeze style now also mirrors preview.css's canvas-transition selectors (they outrank * in specificity — a theme flip would otherwise animate 0.4s mid-screenshot). New: explicit image-settle await (load/error + decode()) — networkidle alone let the remote avatar photo flake both ways.
  • Baseline naming (compat): dark-desktop keeps the bare story id, so the 317 committed baselines stay byte-identical; other modes get --<mode> suffixes. Verified locally: full matrix = 1,890 snapshots, stable across back-to-back runs (0 diffs, ~2 min).
  • Per-story control: parameters.visual: false unchanged; new visual: { modes: [...] } narrows the matrix (used only by the 3 foundation token galleries, whose mobile reflow approaches Chromium's 16384px capture ceiling — both themes still covered at desktop).
  • CI: the governance visual job is sharded ×4 (mirrors the Vitest job) via VISUAL_SHARD; per-shard diff artifacts. Baseline-regen workflow: timeout 60m + optional modes input for partial regeneration. testTimeout: 30000 in the jest layer (default 5s was sized for one screenshot).
  • Stories: Breadcrumb's ResponsiveCollapsed now uses the DS mobile viewport (the old mobile1 preset no longer exists) — its mobile snapshot finally captures the collapsed ellipsis state.
  • Docs: docs/OVERVIEW_TESTS.md Layer-2 sections updated (matrix, naming, determinism table, sharding, correct workflow filename).

Notes

  • The visual job is expected red on this PR until the Linux baselines land: next step is dispatching app-storybook-generate-baseline.yml on this branch (update_baselines=true), then committing the ~1,573 new PNGs here (existing 317 must show zero modifications — that's the compat invariant).
  • No release: nothing under packages/** changes (test type, no bump).
  • No new dependencies.
  • Root storybook:test:visual:update:baseline script now dispatches against the current branch instead of the deleted test/webkit.

@robsongajunior
robsongajunior requested a review from a team July 17, 2026 14:46
@robsongajunior
robsongajunior requested a review from a team as a code owner July 17, 2026 14:46
@robsongajunior
robsongajunior marked this pull request as draft July 17, 2026 15:12
@robsongajunior robsongajunior added enhancement New feature or request WIP Work in Progress labels Jul 17, 2026
@robsongajunior robsongajunior removed the WIP Work in Progress label Jul 17, 2026
@robsongajunior
robsongajunior marked this pull request as ready for review July 17, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant