Background
The clients/web/vite.config.ts already wires @storybook/addon-vitest's storybookTest plugin into a vitest project named storybook, so every story's play function is already runnable as a test under vitest run --project=storybook. What's missing is an npm script and a CI step to actually run them.
Today the only way to invoke the suite is to type npx vitest run --project=storybook by hand — which is what clients/web/src/components/.../InlineSamplingRequest/InlineSamplingRequest.stories.tsx's test plan in #1239 / PR #1250 ended up referencing. With nothing wired into CI, broken play functions land silently (see #1248, surfaced only because work on #1237 happened to run the suite locally).
Scope
Precondition
#1248 (the ambiguous findByText("config.json") failure in ResourcesScreen > ResourceSelected) must land first. Turning the CI gate on while v2/main has a known red play function would block every subsequent PR.
Acceptance criteria
Test plan
Out of scope
Related
Background
The
clients/web/vite.config.tsalready wires@storybook/addon-vitest'sstorybookTestplugin into avitestproject namedstorybook, so every story'splayfunction is already runnable as a test undervitest run --project=storybook. What's missing is an npm script and a CI step to actually run them.Today the only way to invoke the suite is to type
npx vitest run --project=storybookby hand — which is whatclients/web/src/components/.../InlineSamplingRequest/InlineSamplingRequest.stories.tsx's test plan in #1239 / PR #1250 ended up referencing. With nothing wired into CI, broken play functions land silently (see #1248, surfaced only because work on #1237 happened to run the suite locally).Scope
clients/web/package.jsonscripts:"test:storybook": "vitest run --project=storybook"— single-shot for CI / pre-commit / local check."test:storybook:watch": "vitest --project=storybook"— interactive iteration.test:storybookat the repo root (package.json) so it can be invoked from anywhere in the workspace.test:storybookinto CI as a separate step in.github/workflows/main.yml. Keepnpm run validate(format + lint + build) fast and synchronous; the storybook test step takes ~10s on a clean tree because it spins up headless Chromium via@vitest/browser-playwright, so it doesn't belong insidevalidate.test:storybookshould fail CI on a missing browser binary or silently skip — likely fail, given Playwright is already adevDependency.Precondition
#1248 (the ambiguous
findByText("config.json")failure inResourcesScreen > ResourceSelected) must land first. Turning the CI gate on while v2/main has a known red play function would block every subsequent PR.Acceptance criteria
npm run test:storybookfromclients/web/runs the suite and exits 0 on a clean tree.npm run test:storybookfrom the repo root delegates to the web client and behaves identically.test:storybookon every PR aftervalidate; failure blocks merge.test:storybookalongsidevalidatein the "Lint-fixed, Formatted code" / pre-push section.Test plan
npm run test:storybooklocally on a clean v2/main — passes.Out of scope
Related