/uiverify:storybook-visual-testingfrom UI Verify
Makes Storybook stories deterministic for UI Verify visual testing by eliminating flaky diffs. Freezes clocks, animations, live data, and non-Math.random randomness. Use when setting up story-level visual tests or debugging a story that diffs every run.
Ships in UI Verify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
UI Verify renders each story as a baseline. Because a story is an isolated component in a controlled
harness, you get for free the things that make real-page capture hard: no page scroll, no A/B / analytics
/ chat / consent scripts, no lazy-load-on-scroll races. That isolation is the point — the determinism
work here is narrow. If you reach for scroll-settling or third-party stubbing, you're fighting a
problem Storybook already removed; that's a real-page concern (see playwright-visual-testing).
UI Verify's capturer also neutralizes these automatically — do NOT hand-fix them:
prefers-reduced-motion: reduce — emulated, so any component that honors it renders its calm state.Math.random — seeded before your app code runs (a shuffle/jitter driven by Math.random is
already stable).<img> loading — waited for before capture (the fonts your story actually loads; see
the preview.ts setup below).So the checklist below is only the remainder — what lives inside your app and can't be fixed from
outside it. And like Vitest browser mode (vitest-visual-testing) and unlike a real page, a story has
no SSR — no server-rendered random pick to reconcile.
The headline: freeze the data. Once the list above is off the table, the one thing left that floods a story suite with false "changes" is live/dynamic data — star counts, follower counts, contributor lists, tiles, timestamps. Give every story static args / fixtures and that entire class disappears at the source: static data can't churn run-to-run, so there is nothing to diff. This is the single highest-value determinism step here — do it first (step 1), and most stories need nothing else.
Load your app's global CSS + fonts in .storybook/preview.ts. A story renders an isolated component,
so anything your real app loads in its entry/layout — the global stylesheet, an icon-font CSS
(bootstrap-icons) — has to be imported in preview.ts (which loads once for every story) or the story
captures with fallback fonts / tofu glyphs:
// .storybook/preview.ts
import 'bootstrap-icons/font/bootstrap-icons.css';
import '../src/styles/globals.css';
Import fonts from a package or a same-origin asset (not a CDN <link> in preview-head.html), so the
archive captures the bytes. The capturer waits for these like any other font — but only ones the story
actually loads; it can't declare a font you never imported. Rule of thumb: if a story renders right in
your local Storybook, its fonts are already in the build.
Point UI Verify at your built stories:
npm run build-storybook && uiverify upload --static-dir storybook-static
A story fed live/dynamic data is flaky by construction: the stars, followers, contributor list, tile order, and timestamps move between runs, so the diff lights up with no code change. Give every story static args/fixtures and the whole class is gone. Never let a story hit a real backend.
Concrete — fixed, ordered, complete data:
Two ways to inject them, both fine:
args on the story;msw-storybook-addon
returns the same response every time.One component per story file, every variant × state in one story where you can — cheaper and easier to eyeball than N near-identical stories. Keep each in its own file so unchanged ones are skipped, and add a path filter so the visual job only runs on UI PRs.
The one thing the capturer deliberately does not do (freezing time breaks entry animations). Any
component that reads the clock — a relative timestamp, a date picker defaulting to "today", a chart's day
axis — drifts every run. Pin it with
storybook-addon-mock-date (Storybook 10+),
which mocks Date per story:
// .storybook/main.ts
addons: ['storybook-addon-mock-date'],
// .storybook/preview.ts — a fixed date for every story (meta- or story-level overrides it)
export default { parameters: { mockingDate: new Date('2020-01-01T00:00:00Z') } };
Pass a Date, a millisecond timestamp, or an ISO string as mockingDate; the most specific value
(story > meta > preview) wins, so a single story can pin its own "today". On older Storybook, install
@sinonjs/fake-timers in a decorator instead
(install({ now: FROZEN_NOW })) — it covers Date, Date.now, and timers in one call.
A CSS/WAAPI/finite animation is handled for you (above). What's left is an infinite JS loop that
never has a final frame — framer-motion pulsing dots, a Lottie loop, an autoplay spinner, or a
<canvas> / requestAnimationFrame loop (which no media query can reach). Two fixes:
Preferred — honor reduced motion. The capturer emulates prefers-reduced-motion: reduce, so make
the component respect it. framer-motion ignores it by default (reducedMotion: "never"); opt in:
// .storybook/preview.tsx decorator
<MotionConfig reducedMotion="user"><Story /></MotionConfig>
or gate the loop yourself with useReducedMotion(). One line, and it's good app behavior anyway.
Escape hatch — detect the capture and render the end state. UI Verify flags every capture with a
UIVerify marker on the user-agent and a window.__UI_VERIFY__ global, so a component can branch:
export const isUIVerify = () =>
(typeof navigator !== 'undefined' && navigator.userAgent.includes('UIVerify')) ||
(typeof window !== 'undefined' && '__UI_VERIFY__' in window);
<RadarChart isAnimationActive={!isUIVerify()} />
Prefer pausing at the end frame, not the start. For a hand-rolled <canvas> rAF loop the same
branch applies: if (isUIVerify()) drawOneStaticFrame(); else startRaf(); in the component's effect.
Math.random randomnessMath.random is seeded for you, but crypto.randomUUID(), a uuid library, or faker are not. Use
fixed fixtures for anything that ends up on screen (an id in the DOM, a faker name), or set a fixed faker
seed.
A JS-measured layout that reflows or reorders on its own (packing driven by measured size, a shuffled list) can vary run-to-run even with identical content. Force a deterministic variant in the story (a fixed order/size), or mask the region (step 6).
Last resort for content that is supposed to differ and can't be pinned at the source (a third-party
embed, a map, an ad slot, a live feed): add data-uiverify-ignore to the element. UI Verify paints
its box solid black on every capture, so its content never reaches the diff. The box's size and position
still diff (give it a fixed size), and nothing inside it is checked, so mask only what you can't pin and
fix what you own. Docs.
<aside data-uiverify-ignore style={{ width: 320, height: 256 }}><AdSlot /></aside>
Math.random / waiting on fonts by hand → wasted effort; the
capturer already does all three. Spend the effort on the clock and infinite loops.crypto/uuid/faker or a bare Date.now() → fixtures + freeze the clock.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub uiverify/uiverify --plugin uiverify10 skills in this plugin
/bun-visual-testingMake @uiverify/bun captures deterministic so Bun visual tests (bun test driving Chrome through Bun.WebView) stop coming back "changed" without a real change (flaky diffs). Use when setting up or debugging visual tests written with @uiverify/bun, on a real page of your running app (run() with webServer) or on a component page served by serveBundle(). Focuses only on the run-to-run variation the SDK can't neutralize from outside your app — above all live/dynamic data, the highest-value step (freeze it with fixtures or page.route and the whole content-noise class disappears), plus the clock, infinite JS animations, non-Math.random randomness, fonts a measuring component reads before they load, and the Bun-specific setup traps./check-visual-changesCheck the visual impact of an edit mid-task with `uiverify check` — render just the components you're touching on the UI Verify fleet and diff them against the real CI baseline, without opening a PR, posting a check, or moving a baseline. Works for every capture method (Storybook, Playwright, Vitest and Bun archives, and raw screenshots). Use when a coding agent has changed UI and wants a fast, authoritative "would this pass" answer before pushing — "check my visual changes", "did I break anything visually", "preview this diff", "run uiverify check". Hands off to triage-visual-changes for the pixel review./economical-visual-testsAuthor economical visual tests — full visual coverage in the fewest billable snapshots. Applies to any per-snapshot visual tool (UI Verify, Chromatic, Percy, Playwright screenshots), which all bill and diff per rendered story/test. Use when a component's variants/states are exploding into one snapshot per combination, when the visual-testing bill or noise is driven by snapshot count, or when writing new stories/captures and you want the cheapest layout that still covers every variant. Covers gallery/matrix stories, data-driven states, and the coarse-granularity tradeoff./implement-figma-designImplement a Figma design (a Figma frame link or an exported PNG) in code as a Storybook story (or a Vitest browser-mode test) and converge the render to it using UI Verify as the source of truth. Declare the design as the story's baseline (`parameters.uiVerify.baselineImage`), build, upload, then converge SECTION BY SECTION from the top of the page down - reading UI Verify's localized diff and measuring the baseline/candidate pixels (never your own screenshots), fixing one section per upload until it is locked, then moving down. Stop at the minimum WITHOUT accepting - accepting rebases the baseline off the design. Use when building a page/component to match a provided design image, e.g. "implement this Figma", "build this design", "match the mockup", "reproduce this landing page and make the diff go away", "close the design-baseline diff". Not for accept/deny triage of a normal regression build (that is triage-visual-changes)./making-ui-changesRead before changing any component, page, or styles. Six moves to change UI without silently breaking another screen - pick up open review notes, reuse before you create, cover every state, check the blast radius, prove it with a visual test, kill flake at the source./playwright-visual-testingMake @uiverify/playwright (archive-replay) captures deterministic so real-page visual tests stop coming back "changed" without a real change (flaky diffs). Use when driving a real page — your app under test, a staging build, or live production — and the diff flakes. A symptom-to-lever checklist for the run-to-run variation you probably have - feature flags, live data, the clock, third-party widgets, and dynamic layouts. The lever is almost always "stop the variation at record time" — the archive bakes in whatever the page was.Other plugins' skills for the same job