Storybook Visual Testing logo

Storybook Visual Testing

Organization
uiverify
storybook-visual-testing

Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs). Use when setting up story-level visual tests or debugging a story that diffs every run. Focuses only on the run-to-run variation the capturer can't neutralize from outside your app — the clock, infinite JS animations, live data, and non-Math.random randomness — and deliberately skips what UI Verify already handles for you.

Overview

Publisheruiverify
Repositoryuiverify
Skill namestorybook-visual-testing
Stars
27
Forks
1
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by uiverify on GitHub. Read the source before you install it.

Installation

Install the Storybook Visual Testing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/uiverify/uiverify/tree/main/packages/skills/skills/storybook-visual-testing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/uiverify/uiverify.git /tmp/uiverify
mkdir -p .claude/skills
cp -r /tmp/uiverify/packages/skills/skills/storybook-visual-testing .claude/skills/storybook-visual-testing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Storybook Visual Testing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Storybook Visual Testing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Storybook Visual Testing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Deterministic Storybook stories

Mental model — Storybook already removed most of the flake

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:

  • CSS animations & transitions (killed at render), and the Web Animations API (disabled).
  • 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).
  • Web fonts and <img> loading — waited for before capture (the fonts your story actually loads; see the preview.ts setup below).
  • Finite JS animations (a Recharts entry draw, react-smooth) — captured at their settled final frame. You don't need to disable these.

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:

ts
// .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:

bash
npm run build-storybook && uiverify upload --static-dir storybook-static

The checklist (only what the tool can't do for you)

1. Freeze the data — the one that actually matters

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:

  • fixed counts (stars, followers, downloads) — literal args, not a live fetch;
  • a fixed contributor/author list: fixed names and avatar URLs (or inlined avatars), in a fixed order;
  • a fixed set of tiles/rows in a fixed order (a live "trending" sort reorders every run);
  • fixed timestamps (pair with the clock, step 2).

Two ways to inject them, both fine:

  • args — the Storybook-native path: pass the component's data as fixed args on the story;
  • mock the fetch — when a story fetches internally, MSW via 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.

2. Freeze the clock

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:

ts
// .storybook/main.ts
addons: ['storybook-addon-mock-date'],
ts
// .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.

3. Infinite JS animations

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:

    tsx
    // .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:

    ts
    export const isUIVerify = () =>
      (typeof navigator !== 'undefined' && navigator.userAgent.includes('UIVerify')) ||
      (typeof window !== 'undefined' && '__UI_VERIFY__' in window);
    tsx
    <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.

4. Non-Math.random randomness

Math.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.

5. Dynamic layout

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).

6. Mask what you can't pin

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.

tsx
<aside data-uiverify-ignore style={{ width: 320, height: 256 }}><AdSlot /></aside>

Anti-patterns

  • A story that fetches live data → mock it (MSW).
  • Disabling CSS animations / seeding Math.random / waiting on fonts by hand → wasted effort; the capturer already does all three. Spend the effort on the clock and infinite loops.
  • Unseeded crypto/uuid/faker or a bare Date.now() → fixtures + freeze the clock.
  • Reaching for scroll-settle / A-B stubbing → wrong path; that's a real-page concern.

Frequently asked questions

What does the Storybook Visual Testing AI skill do?

Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs). Use when setting up story-level visual tests or debugging a story that diffs every run. Focuses only on the run-to-run variation the capturer can't neutralize from outside your app — the clock, infinite JS animations, live data, and non-Math.random randomness — and deliberately skips what UI Verify already handles for you.

Why use Storybook Visual Testing on TypingMind?

Because you install it once and use it with any model. Storybook Visual Testing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Storybook Visual Testing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/uiverify/uiverify/tree/main/packages/skills/skills/storybook-visual-testing. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Storybook Visual Testing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Storybook Visual Testing?

As many as you like. As long as a model supports skills, you can use Storybook Visual Testing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Storybook Visual Testing AI skill free?

Yes. It is published on GitHub by uiverify under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇