How it works
Storybook build
Chromatic builds the Storybook for
@node-core/ui-components. Every story becomes a test case.Screenshot capture
Chromatic renders each story in a cloud browser and takes a screenshot. It captures multiple viewport sizes and theme variants.
Comparison
The new screenshots are compared pixel-by-pixel against the last accepted baseline. Changed pixels are highlighted in the diff view.
What triggers a visual test
Chromatic runs automatically on pull requests via CI. A visual test is triggered whenever:- A component file in
@node-core/ui-componentsis modified - A story file (
index.stories.tsx) is added or updated - A CSS Module file (
index.module.css) is changed - The Storybook configuration changes
Relationship to Storybook
Chromatic uses the same stories you write for local development. No separate test files are needed — everyexport const MyStory: Story = { ... } automatically becomes a visual test.
Reviewing changes
When Chromatic detects visual diffs:- The CI check on the pull request will show a link to the Chromatic build.
- Open the build to see side-by-side comparisons of changed stories.
- For each diff:
- Accept if the change is intentional (Chromatic updates the baseline).
- Deny if the change is a regression (the CI check remains failed).
- All diffs must be reviewed before the Chromatic check passes.
Approving baselines
Baselines represent the last approved visual state of each story. When you make an intentional design change:- Open the Chromatic build for your pull request.
- Review every affected story.
- Click Accept on each change, or use Accept all if every diff is intentional.
- The CI check updates to green.
Local Storybook build
Before pushing, you can build Storybook locally to confirm your stories render correctly:http://localhost:6006 in development mode:
Adding new stories
Every new component added to@node-core/ui-components must include story files. This ensures Chromatic captures a baseline on the first pull request that introduces the component.
Related
Storybook
How to write stories for @node-core/ui-components.
Unit tests
Complement visual tests with programmatic assertions.