Repository navigation
chore(storybook): run stories as tests with vitest and a11y checks - #551
Merged
Merged
Conversation
|
|
|
View your CI Pipeline Execution ↗ for commit fb8e29c
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
Member
Author
Coverage report from istanbul
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs every story as a test, in a real browser, and adds accessibility checks. Results show up in Storybook itself and run on PRs.
Story tests
@storybook/addon-vitestruns the stories in headless Chromium (Playwright). A story passes when it renders without errors; once stories getplayfunctions, those run too and their steps show up in the Interactions panel, which is back on (hidden on the documentation stories).packages/core/vitest.config.mjs. It has to be avitest.configinside the package so the test widget in the sidebar can find it, and it extends the core Vite config for vanilla-extract. It also dedupes React: Storybook nests its own React 19, which can't render our React 18 elements.tags: ['!test']. That leaves 44 tests.components/.Accessibility
@storybook/addon-a11yadds the Accessibility panel and checks each story when it's tested.todomode, so violations are warnings for now: 22 stories have some, mostly fields without a label (in the stories) and Modal without an accessible name (aria-dialog-name). Switching toerroronce they're fixed makes them fail.Running them
yarn test:storybook(nx targettest-storybook).nx affectednow also runstest-storybookandbuild-storybook, so a story that breaks the Storybook build shows up before merging, not after. The agents install Chromium throughinstall-commands.test-storybookis its own target instead of part oftest, so the pre-push hook and the publish workflow keep running without a browser.This PR only has
choreandcicommits, so merging it does not trigger a release (confirmed withnx release --dry-run).