CONTRIBUTOR-DOCS / Contributor guides / 2nd gen testing
In this doc
2nd gen components use three types of tests: Storybook play functions for interaction tests, Playwright for accessibility tests, and visual regression testing through stories. The full testing guide — including file structure, test patterns, assertion conventions, accessibility testing, coverage thresholds, flaky test prevention, and more — lives in the Testing guide.
- Keep docs stories in
2nd-gen/packages/swc/components/<component>/stories/<component>.stories.ts. - Add test stories in
2nd-gen/packages/swc/components/<component>/test/<component>.test.ts. - Add accessibility tests in
2nd-gen/packages/swc/components/<component>/test/<component>.a11y.spec.ts. - Reuse the base stories and metadata from the main doc stories file.
- Test stories run in development Storybook only and are excluded from
storybook:build.