Storybook's Visual Tests addon entering private alpha
Tags: webdev, testing, react, storybook
Published: 2023-09-01 12:37:31

Earlier this month, [I shared the first look at Storybook’s upcoming Visual Tests addon](https://storybook.js.org/blog/visual-tests-addon-sneak-peek/). In one click, it will let you automatically test your stories for visual changes across all browsers and viewports.

Today, I’m excited to share the private alpha and highlight the progress we’ve made so far. The project is now being worked on by six core developers with the goal to launch by the end of the year.

Read on to preview the addon’s UI and [find out more about signing up for early access](https://docs.google.com/forms/d/e/1FAIpQLSdWah_4M3VtNevxkrN9cYXRpFos7f15hXOmd_ELwOM4ps-_0A/viewform).

## Addon developer experience
You’ll be able to access all the functions of the Visual Test addon through a new UI panel in Storybook. Here, you’ll be able to set up your tests, run them, and view results that highlight changes down to the pixel.

Let’s break down how this works, step by step.

![The addon UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9y3ryh1cy9fstq0xt6x.png)

## Story status API to indicate changes
We’re introducing a new experimental API to Storybook that shows the test status of each story in Storybook’s sidebar.
Inspired by VSCode, it lets you see which stories have visual changes and need review without you having to open each story.

![Storybook sidebar showing tested and untested stories](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eejzkktmcm0zdcjtfrrv.png)

## Run visual tests on-demand

Press this button to run visual tests on-demand for all your stories. Behind the scenes, the button will kick off a static build and upload it to the cloud for testing.

![Run tests in the Visual Tests addon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7toet2k0rlk336kcsx40.png)

Each story can be tested in different combinations of browsers, themes, viewports, a11y preferences, and other global settings.

![A diagram showing the way in which each component leads to hundreds of variations – through the variations of stories, different browser engines, and viewport sizes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k735bfuym6i0ks1w98jy.png)

## Accept results and set new baselines

Visual tests take screenshots of your stories and compare them to previous versions to catch any visual changes. In the addon, the latest screenshot of the story will be shown beside the live story. If there are visual differences, they’ll get highlighted in neon green so you can see them at a glance.

After you’ve run tests, accept a story’s snapshot as a new baseline. When you test in the future, the story will be compared to that baseline.

![View results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hscytvasatx4hhs63kz.png)

## How to get the private alpha

The Visual Test addon is currently in private alpha, which means that it’s rolling out to a limited number of users.  If you’re interested:

[👉 Sign up for early access
](https://docs.google.com/forms/d/e/1FAIpQLSdWah_4M3VtNevxkrN9cYXRpFos7f15hXOmd_ELwOM4ps-_0A/viewform)

If you’ve already signed up for early access, we’ll be emailing you over the next few weeks. Priority is given to developers with ongoing development on small-medium sized projects.

We hope you’re as excited as we are about the Visual Test addon. We’ll continue shipping regular updates in anticipation for our public alpha.

https://twitter.com/storybookjs/status/1697190521490256277

## What’s so great about visual testing?

Visual tests are a pragmatic way to ensure that UI stays pixel-perfect by combatting UI regressions. Visual tests complement other types of tests, such as unit tests, interaction tests, and accessibility tests, to provide a comprehensive coverage for UI. [Learn more](https://storybook.js.org/tutorials/visual-testing-handbook/).

## Does this replace Chromatic?
Nope. This addon is powered by [Chromatic](https://www.chromatic.com/). It gives you the ability to run tests in parallel using dedicated browser infrastructure, all from the convenience of Storybook.