If your team builds UI in Storybook, you already have the hard part of visual testing done. Every component sits in a known state, isolated, at a stable URL. What Storybook doesn’t do on its own is take a screenshot of each story and tell you when it changed. For that you need a second tool, and the choice comes down to where you want the screenshots taken, where the baselines live and what you want to pay.
This guide covers five options: Chromatic (the official route), the Storybook test runner with jest-image-snapshot, Loki, Happo and Diffy. Prices and versions were checked on the vendors’ own pages on 19 November 2026.
Your options at a glance
| Tool | How it captures | Where baselines live | Browsers | Cost |
|---|---|---|---|---|
| Chromatic (Visual Tests addon) | Builds your Storybook and renders every story in its cloud | Chromatic, tied to Git branches | Chrome on Free; Chrome, Safari, Firefox, Edge on paid plans | Free for 5,000 snapshots/mo; Starter $179/mo for 35,000 |
| Storybook test runner + jest-image-snapshot | Playwright screenshots each story from a running Storybook | PNG files in your repository | Chromium, Firefox or WebKit (Playwright) | Free, open source |
| Loki | Chrome in Docker, local Chrome, Chrome on AWS Lambda, or an iOS/Android emulator | .loki/reference in your repository | Chrome, plus iOS and Android for React Native | Free, MIT |
| Happo | Builds your Storybook and renders it in its cloud | Happo, per commit | Chrome, Firefox, Safari, Edge | $4 per 1,000 snapshots pay as you go; Team $199/mo for 66,000 |
| Diffy | Screenshots the story URLs of a deployed Storybook | Diffy, per environment | Chrome, WebKit | Free for 500 screenshots/mo; from $67/mo (billed annually) for 2,000 |
The first three run from your repository and your CI. Happo and Chromatic are services that also run from your repository. Diffy is the odd one out: it doesn’t read your stories at all. It treats a published Storybook as a website and screenshots its URLs, which is why it can test the full pages built from those components too.
Chromatic and the Visual Tests addon
Chromatic is made by the Storybook maintainers, and the Storybook docs present it as the native way to visually test stories. You install the addon with:
npx storybook@latest add @chromatic-com/storybook
A Visual Tests panel appears in Storybook. Each story becomes a test: the first build creates baselines, later builds are compared against them, and changed stories are highlighted in the sidebar so you can review and accept them. Accepted baselines sync when you push the branch, and pull requests get a “UI Tests” check you can make required. If you already use the Vitest addon, visual tests show up in the same testing widget and run together with your component tests.
How Chromatic counts. Billed visual snapshots are tests × builds × browsers × modes. A story in four browsers and two themes is eight snapshots per build. Accessibility tests are billed per mode, interaction tests aren’t billed.
TurboSnap cuts that down. It uses Git history and the Webpack or Vite dependency graph to work out which stories a change could have affected. Those are captured at full price; the rest are copied from the baseline at 0.2 of a snapshot, or bypassed at zero when nothing a test depends on changed.
Pricing. Free includes 5,000 snapshots a month in Chrome only, and testing pauses when you hit the limit. Starter is $179/month for 35,000 snapshots, with extra snapshots at $0.008. Pro is $399/month for 85,000. Paid plans add Safari, Firefox and Edge. Users and collaborators are unlimited.
If your design system lives in Storybook and your developers live in pull requests, Chromatic is the path of least resistance.
The Storybook test runner with jest-image-snapshot
The test runner (@storybook/test-runner) turns every story into a test. It’s powered by Jest and Playwright: it visits each story in a running Storybook, fails on render errors, and runs play functions and their assertions. It doesn’t compare screenshots by itself, but its postVisit hook gives you the Playwright page after the story has rendered, and the Storybook docs include a recipe that adds jest-image-snapshot:
npm install --save-dev @storybook/test-runner jest-image-snapshot
// .storybook/test-runner.ts
import type { TestRunnerConfig } from '@storybook/test-runner';
import { waitForPageReady } from '@storybook/test-runner';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
const customSnapshotsDir = `${process.cwd()}/__snapshots__`;
const config: TestRunnerConfig = {
setup() {
expect.extend({ toMatchImageSnapshot });
},
async postVisit(page, context) {
// Waits for the page and its assets, including fonts
await waitForPageReady(page);
const image = await page.screenshot();
expect(image).toMatchImageSnapshot({
customSnapshotsDir,
customSnapshotIdentifier: context.id,
});
},
};
export default config;
Add "test-storybook": "test-storybook" to your package.json scripts, start Storybook, and run npm run test-storybook in a second terminal. The first run writes baselines to __snapshots__, later runs fail when a story no longer matches. To accept a change, run npm run test-storybook -- -u to re-record the failing snapshots, and commit them. The --browsers flag runs the tests in Chromium, Firefox or WebKit.
Two things to know before you pick this route. First, the Storybook docs now say the test runner has been superseded by the Vitest addon, and recommend the Vitest addon for Vite-based Storybook frameworks. The test runner still works and still documents this recipe, but it isn’t where new work is going. Vitest 4 added a native toMatchScreenshot assertion in browser mode, and a few community addons connect it to the Storybook Vitest addon. The Storybook docs themselves still point to Chromatic’s Visual Tests addon for visual testing.
Second, screenshots taken on a Mac and in a Linux CI runner won’t match pixel for pixel because of font rendering. Teams that go this way usually generate and check baselines in the same Docker image everywhere. Our guide to Playwright screenshots in CI and Docker covers that setup, and it applies here because the test runner uses Playwright.
This is the right choice if you want everything in your repository, no third-party service and no bill, and you’re happy to maintain it.
Loki
Loki is an open-source tool built only for Storybook. You install it with yarn add loki --dev, run yarn loki init, start Storybook yourself, and work with three commands:
loki updatecaptures the reference images.loki testcaptures again and compares.loki approveaccepts the changes as the new references.
References are stored in .loki/reference, with current screenshots and diffs in neighbouring folders, so they can be committed alongside your code. Loki can capture in Chrome running in Docker (the recommended option), a local Chrome, Chrome on AWS Lambda, an iOS simulator or an Android emulator, which makes it one of the few options for React Native stories.
Check the maintenance status before you commit to it. The latest release on npm is 0.35.1, and its peer dependency range for @storybook/react is versions 5 to 8. The current Storybook docs are for version 10, so test Loki against your Storybook version first. There’s more detail in Diffy vs Loki.
Happo
Happo is a hosted cross-browser screenshot service that integrates with Storybook, Playwright, Cypress and Vitest. For Storybook, you install the happo package, add a happo.config.ts with integration: { type: 'storybook' } and your browser targets, add a "happo": "happo" script to package.json, and run npm run happo in CI. Happo builds your Storybook, renders the stories in real browsers and posts a status on the pull request: failure when there’s a diff, success once the diffs are accepted. It finds the baseline by starting at the merge base of the pull request branch.
Partial runs render only the stories you list with --only (or exclude with --skip) and carry the rest over from a base commit. Only newly rendered snapshots count against your plan.
How Happo counts. Its own estimate is stories × targets × runs. Each browser is a target, the accessibility check is a target, and the same browser in dark mode or at another size is another target.
Pricing. Happo changed its pricing recently, and its pricing page no longer lists a free plan. Every account starts with a 14-day free calibration period with no limits, then moves to a plan. Pay as you go costs $4 per 1,000 snapshots with no monthly fee. Team is $199/month for 66,000 snapshots, then $3 per 1,000. Pro is $599/month for 300,000, then $2 per 1,000, and adds SAML single sign-on. Every plan includes Chrome, Firefox, Safari and Edge, accessibility and animation testing, and unlimited users.
Happo is the strongest choice here if you need real Firefox, Safari and Edge on every plan, or accessibility checks on every component. See Diffy vs Happo for the full comparison.
Diffy: testing a deployed Storybook by URL
Diffy takes a different approach. Every story in a built Storybook has its own URL, which renders the story on its own without Storybook’s interface:
https://storybook.example.com/iframe.html?id=components-button--primary&viewMode=story
To Diffy, that’s just a page. You create a project, set the Storybook from your main branch as the production environment, add the story URLs as pages, pick your breakpoints and run. Diffy loads each one in Chrome or WebKit, captures it and compares it with the other environment or with an earlier run. One story at one breakpoint is one screenshot.
You don’t have to type the URLs in. A built Storybook publishes an index.json with every story’s id, so a short script can produce the page list:
// stories-to-diffy.mjs
// Usage: node stories-to-diffy.mjs https://storybook.example.com
const base = process.argv[2].replace(/\/$/, '');
const index = await fetch(`${base}/index.json`).then((r) => r.json());
Object.values(index.entries)
.filter((entry) => entry.type === 'story')
.forEach((entry) =>
console.log(` - '/iframe.html?id=${entry.id}&viewMode=story'`)
);
Download your project’s config file from the Project Settings page, paste the output under pages:, and apply it with the Diffy CLI:
diffy project:update PROJECT_ID ./project-settings.yaml
Then compare the main-branch Storybook with a preview build from a pull request:
diffy project:compare PROJECT_ID prod custom --env2Url="https://pr-123.storybook.example.com"
The API and CLI are included in every plan, the free one too. The free plan has production and staging environments, so you can point staging at a preview build and compare. Comparing a pull request preview with custom, as above, needs a paid plan, because a preview is a custom environment. The GitHub Actions and GitLab CI guides show how to report the result back on the pull request.
Where this really pays off is beyond the components. A component can look perfect in its story and still break on the site, once it meets real content, real menus and third-party scripts. The bugs in our study of 100 visual bugs that reached production came from comparisons of real website pages, not isolated components. The same Diffy project, or a second one, can screenshot your site’s real pages, so the component library and the website are tested with one tool and one review queue.
That’s how Capellic, a Drupal agency that builds sites for nonprofits, uses it. During a new build, each component is approved in Storybook and then captured with Diffy, so later changes are checked against that baseline. As the site comes together, Diffy tests the full pages to confirm approved components still look right wherever they’re used. After launch, a script pulls in updates every month, pushes them to a Pantheon multidev and runs Diffy against it.
Be clear about the trade-offs. Diffy doesn’t integrate with Storybook beyond its URLs: it doesn’t read story files, follow Git to decide which stories changed, or run play functions. New stories have to be added to the page list (rerunning the script above does that), and your Storybook has to be deployed somewhere Diffy can reach. For a story behind a login or basic auth, Diffy can log in or pass credentials first.

Making story screenshots stable
Whichever tool you choose, the same things cause false positives:
Animations and transitions. Freeze them before the screenshot. In Diffy you can inject CSS from the project settings, for example *, *::before, *::after { animation: none !important; transition: none !important; }.
Dates, random data and network content. Give stories fixed data through args or mocks. A story that shows “3 minutes ago” will never match its baseline. In Diffy, the mock content setting replaces the contents of a selector with placeholder text.
Fonts. Make sure web fonts have loaded before the capture. The test runner’s waitForPageReady waits for them. In Diffy you can set a delay before each screenshot.
Story padding and backgrounds. Changing Storybook’s global decorators or layout parameters changes every screenshot at once. Expect one big review when you do it.
Which one should you pick?
Your team works in pull requests and wants the official route: Chromatic.
You want real Firefox, Safari and Edge, accessibility checks and unlimited users: Happo.
You want it free, in your repository, with no service: the test runner with jest-image-snapshot, or Vitest’s screenshot assertion if you’re already on the Vitest addon.
You test React Native stories: Loki, after checking it works with your Storybook version.
You maintain websites built from your components, and want to test both: Diffy. It’s also the simplest start if you’d rather not write test code: paste URLs, run, review.
Frequently asked questions
Does Storybook have built-in visual regression testing?
Not on its own. The Visual Tests addon is official, but the comparisons run on Chromatic, a paid cloud service with a free tier. Without it, you add a tool like the test runner with jest-image-snapshot, Loki, Happo or Diffy.
Is the Storybook test runner deprecated?
The Storybook docs say it has been superseded by the Vitest addon and recommend the Vitest addon for Vite-powered frameworks. The test runner is still documented, including its image snapshot recipe.
Can I test Storybook visually without uploading my code?
Yes. The test runner and Loki run on your own machines or CI. Diffy doesn’t need your code either, only the URL of a deployed Storybook, but the screenshots are taken and stored by Diffy.
How many snapshots will my Storybook use?
Roughly stories × browsers × viewports (or modes) × runs. 200 stories in two browsers, run on 50 pull requests a month, is 20,000 snapshots before partial runs or TurboSnap. In Diffy, one story at one breakpoint is one screenshot: 200 stories captured ten times a month is 2,000 screenshots, the $67 plan. A comparison between two environments captures both, so it counts twice.
Can Diffy test the pages built from my components too?
Yes. That’s what Diffy was built for: comparing production, staging and preview environments of a whole website. See visual regression testing for how it works.
Try it
Point Diffy at your published Storybook, paste in a few story URLs and run your first comparison. The free plan includes 500 screenshots a month.
Start free: 500 screenshots a month
Related reading: Chromatic alternatives · Diffy vs Chromatic · Cypress visual regression testing · Playwright visual regression testing
