Storybook Journeys
Critical rules
- Journeys are products, not demos: mount real pages with real providers; MSW is the world;
playis the script. - Every journey needs ≥3 states: happy path, validation/client error, and server error / empty / edge.
- Prefer role/label queries; never brittle CSS selectors or fixed
setTimeoutdelays. - Centralize typed fixtures; small per-story MSW handlers — no live backends, no leaking globals.
- Story titles use product language (
Journeys/...); page journeys uselayout: 'fullscreen'by default. - Before WRONG/CORRECT samples or folder/naming choices, read the matching resource below.
Workflow
- Define journey boundary: entry screen, key actions, success criteria, error states.
- Before placing files or choosing storyboard shape, read references/conventions.md.
- Build a minimal Journey Harness (router, theme, auth, query client, flags) if the page needs it.
- Add MSW handlers per story state (success, 403/500, slow/empty as relevant).
- Write CSF: mount page/harness; keep args sparse; a11y-friendly selectors.
- Add
play:userEvent+waitFor; assert a meaningful end state on the happy path. - Optionally wire Storybook Test Runner for headless CI.
- For WRONG vs CORRECT patterns, read references/examples.md.
Resources
- references/examples.md — journey vs atomic, fixtures, selectors. Read when authoring.
- references/conventions.md — folders, naming, storyboard options, defaults. Read when structuring.
Validation
- [ ] Stories run offline via MSW
- [ ] Happy path
playreaches a meaningful end state - [ ] ≥1 error/edge story with distinct handlers
- [ ] Role/label queries only; fixtures centralized and typed
- [ ]
Journeys/…naming; fullscreen layout for pages - [ ] (If requested) Test Runner passes headless
Constraints
- Atomic component variants belong in
react-development/react-testable-storybookable, not here. - Adjacent:
testing-strategy(pyramid),validation-boundary/result-types(mock shapes),ui-design-principles,agent-browser,fn-args-deps,observability.