Repository navigation
Description
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
- Add
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.
- Surface
test:storybookat the repo root (package.json) so it can be invoked from anywhere in the workspace. - Wire
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. - Decide whether
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 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
-
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. - CI runs
test:storybookon every PR aftervalidate; failure blocks merge. - AGENTS.md mentions
test:storybookalongsidevalidatein the "Lint-fixed, Formatted code" / pre-push section.
Test plan
- Run
npm run test:storybooklocally on a clean v2/main — passes. - Push a PR with a deliberately broken play function — CI step fails.
- Push a PR with a fixed play function — CI step passes.
Out of scope
- Vitest unit-test infrastructure for components and core modules — that's Vitest unit-test infrastructure + 90% coverage for components and core modules #1245.
- Coverage thresholds for play-function tests — also Vitest unit-test infrastructure + 90% coverage for components and core modules #1245.
- Adding new play functions to existing stories — separate per-component issues.
Related
- Vitest unit-test infrastructure + 90% coverage for components and core modules #1245 — broader Vitest unit-test infrastructure (different scope: unit tests, not story tests).
- ResourcesScreen story 'ResourceSelected' fails: ambiguous findByText('config.json') #1248 — precondition: ResourceSelected story currently red on v2/main.
- PR feat(sampling): replace InlineSamplingRequest responseText with draftResult #1250 — surfaced this gap in its test plan.
Activity
fix(stories): scope ResourceSelected click to URIs region (#1248) (#1255
ci(storybook): wire test:storybook into CI (#1251) (#1297)
cliffhall commentedon May 10, 2026
Fixed in #1297