* docs: add specification for shadcn storybook migration
Add comprehensive planning documents for design system migration:
- spec.md: Feature specification with 5 user stories
- plan.md: Implementation plan with technical context
- research.md: MSW, Chromatic, and story pattern findings
- data-model.md: Component inventory schema
- tasks.md: 117 implementation tasks organized by user story
- quickstart.md: Developer guide for creating stories
- contracts/: Story templates for UI, common, and page components
This establishes the foundation for systematic Storybook coverage
to enable designer collaboration on the shadcn migration.
* feat: add MSW fixture infrastructure for Storybook stories
## MSW Infrastructure
- Add fixture-based handlers using real API data from staging CGW
- Create fixtures for balances, portfolio, positions, safes, chains
- Support 5 scenarios: efSafe, vitalik, spamTokens, safeTokenHolder, empty
- Add feature flag testing via chain config overrides (POSITIONS, PORTFOLIO_ENDPOINT)
- Include fetch-fixtures.ts script to refresh fixture data
## Storybook Decorators
- Add LayoutDecorator for page-level stories with sidebar/header
- Add MockProviderDecorator for Redux/context providers
## Component Inventory Tool
- Create AST-based scanner for component discovery
- Add coverage tracking and dependency analysis
- Implement priority scoring for story creation order
- Add inventory and coverage-report CLI commands
## Documentation Updates
- Update plan.md, spec.md, tasks.md to reflect fixture-based approach
- Update quickstart.md with fixtureHandlers usage examples
* chore: complete Phase 4 MSW fixture expansion (User Story 2)
- Add Safe Apps fixtures fetched from staging CGW (mainnet.json)
- Add createSafeAppsHandlersFromFixture to MSW handlers
- Update createHandlersFromFixture to include Safe Apps by default
- Create dependency-audit.ts script for analyzing fixture coverage gaps
- Add msw-fixtures.md documentation for fixture system
- Fix inventory scanner path resolution for workspace execution
- Rename scripts to storybook:inventory, storybook:coverage, storybook:dependencies
Phase 4 checkpoint complete:
- Core fixtures: balances, portfolio, positions, safes, chains, safe-apps
- Utility handlers: transactions, auth, relay, messages, web3 RPC
- Scripts: storybook:inventory, storybook:coverage, storybook:dependencies
* docs: remove shadcn references, focus on existing component coverage
- Rename spec from "shadcn migration" to "Storybook Coverage Expansion"
- Remove all shadcn/ui component tasks (will be added in future phase)
- Expand Phase 5 tasks to cover existing MUI components by category
- Update component counts to match current inventory (330 total, 14 with stories)
- Fix Storybook version: 8.x → 10.x
- Add current coverage status section to tasks.md
* feat: add sidebar component stories (T042-T044)
- SafeHeaderInfo.stories.tsx: Default, Loading, LargeBalance, ZeroBalance,
MultipleOwners, Counterfactual, PolygonChain variants
- MultiAccountContextMenu.stories.tsx: Default, WithoutAddNetwork,
MultipleChains, LongName, NoName, TestnetOnly variants
- QrModal.stories.tsx: Default, WithChainPrefix, and multiple network
variants (Polygon, Arbitrum, Optimism, Base)
Phase 5.1 complete - sidebar stories now enable page-level stories.
* docs: add MSW best practices for Storybook stories
- Document regex URL patterns (wildcard strings unreliable in MSW v2)
- Add mswLoader requirement for docs mode
- Document RTK Query requirements (deployed: true, loaded: true)
- Update story template with MSW best practices and valid TS syntax
- Fix AssetsTable story to work with MSW fixtures
- Add mockServiceWorker.js to eslint ignores
- Fix MSW index exports to only include working fixtures
* feat: add real component stories for Dashboard, Assets, Overview, PendingTxs, SafeAppList, and OwnerList
- Dashboard stories render real Dashboard component directly (no mock layout)
- Overview stories include wallet connected and no wallet states
- OwnerList stories include ENS names and address book entries
- Assets and PendingTxs stories with realistic MSW fixtures
- SafeAppList stories with real app data
- Add localhost:6006 to OFFICIAL_HOSTS for Storybook logo display
- Fix LayoutDecorator structure and preview padding for fullscreen layouts
- Add CLAUDE.storybook.md with Storybook patterns knowledge base
* feat: add 12 family-based stories with full-page-first ordering
Add mockup-based stories for component families to achieve comprehensive
Storybook coverage without complex Redux/context dependencies:
Components:
- AddressBook: Full page, table, dialogs (create/edit/import/remove)
- Batch: Full UI, indicator, sidebar states
- NFTs: Full page, grid, loading/empty, preview modal, collections
- NotificationCenter: Bell with popover, notification variants
- SafeMessages: Full page, message types, signers, signing flow
- Welcome: Welcome screen and onboarding states
Features:
- Bridge: Full page, widget, disabled/in-progress states, history
- NoFeeCampaign: Dashboard banner, gas warning, eligibility states
- Proposers: Full list, chips, edit/delete dialogs
- Speedup: Modal, in-progress/success states, gas slider
- TargetedOutreach: Popup overlay, survey, announcement variants
- TxNotes: History view, input, character limit states
Documentation:
- Add "Story Export Order" section to quickstart.md documenting
that full-page/comprehensive stories should be exported first
to appear at the top of Storybook sidebar
* chore: update spec to family and page based stories
* feat: add 7 family-based stories for 100% top-level coverage
Add mockup-based stories with full-page-first pattern for:
- tx-flow: Token transfer, sign message, swap flows
- recovery: Recovery page, status variants, settings
- myAccounts: Account list, pinned safes, multi-chain
- new-safe: Create/load flows, owner configuration
- walletconnect: Connection form, sessions, proposals
- safe-shield: Security analysis, severity levels
- counterfactual: Activation flow, balance states
This completes Phase 10 T121-T128, achieving 100% coverage
of non-skipped top-level component groups.
* chore: update tasks.md with Phase 10 completion status
Mark T121-T128 as complete:
- T121: tx-flow stories
- T122: recovery stories
- T123: myAccounts stories
- T124: new-safe stories
- T125: walletconnect stories
- T127: safe-shield stories
- T128: counterfactual stories
Update coverage status:
- 36/41 groups covered (88%)
- 5 groups intentionally skipped
- 100% coverage of non-skipped groups achieved
* feat: add scrollable all-states stories with docs-style wrappers
Add AllStates/AllSteps stories as first export in each multi-step feature:
- NewSafe: CreateSafeAllSteps (4 steps)
- TxFlow: TokenTransferAllSteps (4 steps)
- WalletConnect: WalletConnectAllStates (6 states)
- Counterfactual: ActivationAllStates (6 states)
- SafeShield: SafeShieldAllStates (6 states)
- Recovery: RecoveryAllStates (5 states)
- MyAccounts: MyAccountsAllStates (6 states)
Each state wrapped with StateWrapper showing:
- State/step name heading
- Description of the state
- Grey background container with full UI
* tests: update story snapshots after all-states story additions
Update snapshots affected by new scrollable all-states stories:
- AssetsTable: story ordering changed
- DateTime: snapshot format update
- TxStatusChip: removed obsolete story snapshots
- HnSignupIntro: new snapshot
- SwapOrderConfirmationView: snapshot update
* chore: add storybook coverage generation script
* chore: update storybook coverage scripts and documentation
* chore: add tests for storybook scripts
* chore: deterministic output of storybook coverage by order and prettier
* chore: use emotion cache in storybook to align design themes of app and storybook
* chore: add full layout to dashboard story
* chore: tx queue to PendingTxsList
* chore: move story mocking to separate file
* chore: use createMockStory on bigger stories
* chore: use createMockStory in more story files
* chores: enable portfolio and positions feature on all dashboard stories
* chore(storybook): use default feature flags in all stories
- Remove explicit features: { portfolio: false, positions: false } overrides
- All stories now use DEFAULT_FEATURES (portfolio, positions, swaps enabled)
- Update Dashboard stories to use wallet: 'owner' for swap button visibility
- Update documentation to clarify feature flag defaults
* chore(storybook): add page stories and improve mock infrastructure
- Add stories for all pages in src/stories/pages/ directory
- Add spaces feature support with auth state and API mocks
- Add useIsOfficialHost mock for Storybook
- Add query parameter support to createMockStory
- Document decorator stacking behavior in AGENTS.md
- Remove Dashboard.stories.tsx (duplicate of home)
- Include .storybook in tsconfig.json for ESLint
* chore(storybook): add Chromatic visual regression testing
- Add GitHub Actions workflow for Chromatic on PRs and pushes to dev/main
- Configure Chromatic with TurboSnap for cost optimization
- Add light/dark theme modes for visual testing
- Fix Storybook build by mocking next/image loader that caused
"unsupported file type" errors with static image imports
* chore(storybook): enable junit report for Chromatic
* chore(storybook): add chromatic package and local run script
* fix(storybook): remove incompatible junitReport option from chromatic config
junitReport and exitOnceUploaded are incompatible options in Chromatic CLI.
* chore(storybook): auto-accept chromatic changes on dev and main
* fix(storybook): exclude SVGs from asset/resource rule for Chromatic
SVGs were being treated as asset URLs instead of React components,
causing createElement errors in Chromatic. Now SVGs are excluded
so they go through SVGR loader instead.
* chore(storybook): set chromatic viewport to 1280px for full-page layouts
* fix(storybook): deep merge safeInfo.data in story overrides
Allows partial overrides like `data: { deployed: false }` to work
correctly by spreading the base safeInfo data instead of replacing it.
* docs: add Chromatic visual regression testing section (#7081)
* docs: add Chromatic visual regression testing section
* chore: trigger chromatic workflow
* chore: trigger chromatic
* fix(storybook): remove viewports from chromatic config
Chromatic does not support viewports and modes on the same story.
Remove viewports config and rely on modes only for light/dark theme testing.
Also fix StoreOverrides type for safeInfo.data property access.
* fix(storybook): add emotion insertion point for correct CSS ordering
Add preview-head.html with emotion-insertion-point meta tag to ensure
MUI styles are loaded first in production builds. This fixes sidebar
styling issues in Chromatic snapshots.
Also update Home story to use safeTokenHolder scenario (smaller balance)
and add chromatic viewport modes.
* chore(storybook): optimize Chromatic snapshots
- Add theme toolbar switcher with light/dark mode toggle
- Disable Chromatic snapshots for feature documentation stories
- Add !chromatic tags to high-variance story variants
- Reduces redundant snapshots while maintaining visual coverage
* chore: fix prettier formatting in chromatic.config.json
---------
* chore(storybook): add Vite-based Storybook configuration
- Add .storybook-vite/ with Vite-specific config (main.ts, preview.tsx)
- Add custom Vite plugin for @/public/* imports (SVGs via SVGR, images as next/image-compatible objects)
- Add querystring polyfill mock for browser compatibility
- Rename storybook:full to storybook:lazy and make lazy compilation opt-in
- New commands: storybook (normal), storybook:lazy (with lazy compilation), storybook:vite (Vite build)
- Update tsconfig.json to include .storybook-vite files
* chore(chromatic): limit snapshots to 3 core page stories
Only snapshot Home, Balances, and Transactions/History pages
to reduce Chromatic usage during development.
* fix(storybook): add transaction handlers for queue and history pages
Add MSW handlers for transaction-related API endpoints:
- Transaction history list handler
- Transaction details handler with txData: null to avoid parsing errors
- Updated createMockStory to include transaction handlers
The txData is set to null because the Receipt component's data parsing
logic throws errors with mock transaction data structures.
* chore(chromatic): snapshot transaction queue instead of history
Update Chromatic config to capture the Queue page rather than History,
as it better demonstrates the transaction handling with pending items.
* docs: document transaction mocking limitations in AGENTS.md
Add a "Known Limitation" section noting that transaction page stories
have basic MSW handlers but txData mocking is incomplete. Expanding
transaction details may show errors or incomplete data. Further work
is needed to match the CGW response format expected by UI components.
* chore: remove unused storybook script references
Remove storybook:inventory, storybook:coverage, and storybook:dependencies
scripts that reference non-existent files. Only storybook:generate-coverage
is needed and points to the actual generate-storybook-coverage.ts file.
* fix(chromatic): remove onlyChanged flag conflicting with onlyStoryNames
Chromatic CLI doesn't allow both --only-changed and --only-story-names
to be used together. Since we want to limit snapshots to specific stories
to save credits, remove the onlyChanged option.
* tests(storybook): update snapshots for MUI class name changes
Update 196 snapshots to reflect MUI CSS class name changes
from css-* to mui-style-* prefix format.
* fix(chromatic): remove onlyChanged from workflow to use config file
The Chromatic action was passing onlyChanged: true which conflicts with
onlyStoryNames in chromatic.config.json. Remove from workflow since
config file settings take precedence.
* refactor(scripts): reduce cyclomatic complexity in storybook utilities
- Extract lookup tables (PACKAGE_DETECTORS, API_PATTERNS, CATEGORY_PATTERNS, EXPORT_EXTRACTORS) to replace conditional chains
- Add helper functions for isolated concerns (isExternalPackage, detectPackageTypes, categorizeImport, etc.)
- Use switch statements for type discrimination in formatCoverageSource
- Add Code Complexity Guidelines section to AGENTS.md
* refactor(scripts): extract helpers to reduce complexity in storybook utilities
- family.ts: Extract resolveStoryPath and extractStoryExportNames helpers
- generate-storybook-coverage.ts: Extract buildGroupInfoMap and determineCoverageType helpers
- fetch-fixtures.ts: Extract parseSafeArg, fetchSingleSafe, fetchAllFixtures helpers
- chromatic.config.json: Remove invalid externals option causing CI failure
* refactor(scripts): extract generateTopLevelSection helpers to fix CodeScene
Extract formatCoveredGroupRow, formatUncoveredGroupRow, formatSkippedGroupRow,
generateUncoveredGroupsSection, and generateSkippedGroupsSection helpers
to eliminate nested conditional logic in generateTopLevelSection.
---------
Co-authored-by: Hanzo Dev <[email protected]>
17 KiB
Feature Specification: Storybook Coverage Expansion
Feature Branch: 001-shadcn-storybook-migration
Created: 2026-01-29
Status: Draft
Input: User description: "Comprehensive Storybook coverage for existing MUI components, MSW mocking infrastructure, and visual regression testing via Chromatic to enable designer collaboration"
User Scenarios & Testing (mandatory)
User Story 1 - Component Inventory & Story Coverage (Priority: P1)
As a developer working on the design system migration, I need a complete inventory of all existing components mapped to their required states and data dependencies, so that I can systematically create Storybook stories for each component with proper mocking.
Why this priority: Without a complete component map, the migration will be haphazard. This is the foundation for all subsequent work - we cannot create stories for components we haven't inventoried, and we cannot mock data we haven't identified.
Independent Test: Can be fully tested by running an audit script that produces a component inventory report showing: component count, story coverage percentage, and identified data dependencies per component.
Acceptance Scenarios:
- Given the apps/web/src directory, When the inventory process runs, Then a complete list of all React components is produced with their file paths
- Given a component inventory, When cross-referenced with existing stories, Then components without stories are clearly identified with a coverage percentage
- Given a component file, When analyzed for dependencies, Then all hooks, API calls, and Redux selectors used by that component are documented
User Story 2 - MSW Mock Database Infrastructure (Priority: P2)
As a developer creating Storybook stories, I need a comprehensive mock database that provides realistic data for all API endpoints and hooks, so that components can be rendered in isolation with production-like data.
Why this priority: Most components depend on data from hooks and API calls. Without proper mocking, stories either fail to render or show empty states. This unblocks the actual story creation work.
Independent Test: Can be fully tested by creating a sample story for a data-dependent component (e.g., a transaction list) that renders with mock data from MSW handlers.
Acceptance Scenarios:
- Given the existing MSW handlers in config/test/msw/, When reviewed against actual API usage, Then missing endpoints are identified and documented
- Given a component that uses the Safe Transaction Service API, When rendered in Storybook, Then MSW intercepts the request and returns realistic mock data
- Given mock data requirements, When creating new handlers, Then handlers follow established patterns in the codebase and cover success, error, and loading states
User Story 3 - Individual Component Stories (Priority: P3)
As a designer reviewing the design system, I need Storybook stories for every component showing all their visual states, so that I can verify the current implementation and plan future design system improvements.
Why this priority: Stories are the deliverable that enables designer collaboration. Once we have inventory (P1) and mocking (P2), we can systematically create stories.
Independent Test: Can be fully tested by running Storybook and navigating through the component hierarchy, verifying each component renders in its documented states.
Acceptance Scenarios:
- Given a UI component, When a story is created, Then it shows default, hover, active, disabled, loading, and error states as applicable
- Given a feature component, When a story is created, Then it renders with mocked data and shows primary user flows
- Given any component story, When viewed in Storybook, Then it includes documentation of props, usage examples, and design notes
User Story 4 - Page-Level Stories with Layout (Priority: P4)
As a designer reviewing full page designs, I need Storybook stories that render complete pages including sidebar and header, so that I can review the full user experience and catch layout issues.
Why this priority: Component-level stories show parts in isolation, but designers need to see how components work together in actual page layouts. This is essential for spotting spacing, alignment, and responsive issues.
Independent Test: Can be fully tested by viewing a page story in Storybook that includes the sidebar, header, and main content area with realistic data.
Acceptance Scenarios:
- Given a page component (e.g., Dashboard), When rendered as a story, Then it includes the full layout with sidebar, header, and content
- Given a page story, When the viewport is resized, Then responsive behavior is visible and matches production
- Given multiple page stories, When navigating between them, Then shared layout elements (sidebar, header) remain consistent
User Story 5 - Visual Regression Testing with Chromatic (Priority: P5)
As a developer making design changes, I need automated visual regression tests that catch unintended visual changes, so that I can confidently refactor components without breaking the design.
Why this priority: Once we have comprehensive story coverage, visual regression testing prevents regressions during the migration. This is the safety net that enables rapid iteration.
Independent Test: Can be fully tested by making a visual change to a component and verifying Chromatic detects and reports the change in CI.
Acceptance Scenarios:
- Given a component with a story, When a PR modifies that component, Then Chromatic runs and captures visual snapshots
- Given an unintended visual change, When Chromatic compares snapshots, Then the change is flagged for review before merge
- Given an intentional visual change, When approved in Chromatic, Then the new baseline is accepted and future PRs compare against it
User Story 6 - Family-Based Coverage Strategy (Priority: P6)
As a developer, I need the inventory tool to group components by family so I can track coverage at the family level instead of individual components, enabling a cleaner Storybook sidebar with ~50 entries instead of 330+ flat entries.
Why this priority: Component families (components in the same directory) are typically covered by a single story file with multiple exports. This approach keeps Storybook organized while still achieving comprehensive visual regression testing.
Independent Test: Can be fully tested by running yarn workspace @safe-global/web storybook:inventory --family and verifying it produces a grouped report showing family coverage instead of individual component coverage.
Acceptance Scenarios:
- Given the apps/web/src directory, When the inventory runs with --family flag, Then components are grouped by their parent directory as families
- Given a family with a story file, When story exports are counted, Then the family shows the correct number of exports
- Given the family report, When coverage is calculated, Then families with stories covering multiple states are marked as "complete"
Edge Cases
- What happens when a component has circular dependencies with other components?
- Document the dependency and create stories for leaf components first, working up the tree
- How do we handle components that require wallet connection or blockchain state?
- Create MSW handlers that mock Web3 provider responses and use Storybook decorators to inject mock wallet state
- What happens when a component relies on Next.js router or server-side features?
- Use Storybook's Next.js framework integration which provides router mocking; document components requiring special handling
- How do we handle dynamic imports and lazy-loaded features?
- Test both loading states and loaded states; use Storybook's async loading support
Requirements (mandatory)
Functional Requirements
Component Inventory & Mapping
- FR-001: System MUST produce an automated inventory of all React components in apps/web/src/
- FR-002: System MUST identify which components have existing Storybook stories
- FR-003: System MUST document data dependencies (hooks, API calls, Redux selectors) for each component
- FR-004: System MUST categorize components by type: UI primitives, common components, feature components, page components
MSW Mocking Infrastructure
- FR-005: System MUST extend existing MSW handlers to cover all API endpoints used by components
- FR-006: System MUST provide fixture-based mock data using real API responses from staging CGW for realistic test scenarios
- FR-007: System MUST support multiple mock scenarios: success, error, loading, empty states
- FR-008: System MUST mock Web3 provider responses for wallet-dependent components
Storybook Stories
- FR-009: Every component MUST have at least one Storybook story
- FR-010: Stories MUST demonstrate all significant visual states (default, hover, disabled, loading, error)
- FR-011: Stories MUST use MSW for data mocking, not inline mock data
- FR-012: Stories MUST include autodocs for automatic documentation generation
- FR-013: Interactive components MUST have stories demonstrating user interactions
Page-Level Stories
- FR-014: Page stories MUST render with full application layout (sidebar, header)
- FR-015: Page stories MUST support viewport testing for responsive design
- FR-016: Page stories MUST use Storybook decorators to provide layout wrapper
Visual Regression Testing
- FR-017: All stories MUST be included in Chromatic visual regression testing by default
- FR-018: System MUST allow opting out specific stories from visual testing via parameters
- FR-019: Visual regression MUST run on every PR as part of CI pipeline; PRs with visual changes MUST be blocked until reviewed
- FR-020: System MUST provide clear documentation for reviewing and approving visual changes
- FR-021: Intentional visual changes MUST be approved by a designer via Chromatic's in-PR review workflow before merge
Family-Based Coverage
- FR-022: Inventory tool MUST support a
--familyflag to group components by directory - FR-023: Family grouping MUST count story exports (not just story files) to accurately measure coverage
- FR-024: Family coverage status MUST be reported as "complete", "partial", or "none"
- FR-025: Family report MUST include category breakdown with story export counts per category
Key Entities
- Component: A React component with a file path, type (UI/common/feature/page), and list of data dependencies
- Story: A Storybook story file associated with a component, containing one or more story exports showing different states
- Mock Handler: An MSW request handler that intercepts API calls and returns mock data
- Visual Baseline: A Chromatic snapshot representing the approved visual state of a story
Success Criteria (mandatory)
Measurable Outcomes
- SC-001: 100% of visually-rendered sidebar components have Storybook stories (critical for page-level stories)
- SC-002: 100% of visually-rendered components in /components/common/ have Storybook stories (excludes providers, HOCs, utility wrappers)
- SC-003: At least 80% of feature components have Storybook stories
- SC-004: At least 5 page-level stories exist demonstrating full layouts (Dashboard, Settings, Transactions, etc.)
- SC-005: All API endpoints used by components are covered by MSW handlers
- SC-006: Chromatic visual regression runs on every PR with less than 2% flaky test rate
- SC-007: New component PRs include Storybook stories as part of the definition of done
- SC-008: Designer can review any component's visual states in Storybook without developer assistance
- SC-009: Family-based coverage reports at least 50% of families as "complete" (have stories with multiple exports covering key states)
Migration Strategy (mandatory)
Phase 1: Foundation (Inventory & Infrastructure)
Objective: Establish infrastructure and complete component inventory
-
Component Audit
- Run automated inventory of all components
- Cross-reference with existing stories
- Identify coverage gaps (currently 330 components, 14 stories = 4% coverage)
- Categorize components by priority based on:
- User-facing visibility
- Complexity of data dependencies
- Importance for page-level stories
-
MSW Enhancement
- Audit existing handlers against actual API usage
- Add missing endpoints using fixture-based handlers
- Create mock data fixtures from staging CGW for realistic test scenarios
- Document mocking patterns for team
Phase 2: Sidebar & Critical Components
Objective: Complete story coverage for sidebar components (required for page stories)
-
Current state: 3 sidebar components, 0 have stories
-
Priority: These are critical for page-level stories
-
Components:
- SafeHeaderInfo
- MultiAccountContextMenu
- QrModal
-
Deliverable: Each story includes all states and integrates with existing theme system
Phase 3: Common & Balance Components
Objective: Story coverage for common and balance components
-
Common components (16 components, 4 stories - 25% coverage):
- Tier 1: Address display, balance display, token amounts, copy buttons
- Tier 2: Tables, lists, network indicators
- Tier 3: Modals, toasts, errors, loading states
-
Balance components (10 components, 0 stories):
- TokenAmount, FiatValue, TokenIcon, BalanceList
- Use fixture handlers for realistic data
-
Data mocking: Leverage enhanced MSW infrastructure from Phase 1
Phase 4: Feature Area Components
Objective: Story coverage for feature-specific components
-
Priority by feature importance:
- Tier 1: Transactions (38 components), Dashboard (18 components)
- Tier 2: Settings (14 components), Balance components
- Tier 3: Feature components (4 components)
-
Approach: Work with feature teams to identify critical paths and states
Phase 5: Page-Level Stories
Objective: Create full-page stories with layout
- Target pages: Dashboard, Transaction list, Transaction details, Settings, Safe Apps
- Implementation: Create layout decorator that wraps stories with sidebar/header
- Responsive testing: Each page story tested at mobile, tablet, desktop viewports
Phase 6: Visual Regression & CI
Objective: Production-ready visual testing pipeline
- Chromatic setup: Configure project, set up GitHub integration
- Baseline capture: Run initial capture for all stories
- CI integration: Add Chromatic to PR workflow with required approval
- Documentation: Team training on reviewing visual changes
Recommended Starting Order
Based on analysis of the current codebase, here is the recommended order for creating stories:
Immediate Priority (Start Here)
-
Sidebar components (3 components, 0 stories)
- Critical for page-level stories later
- Includes SafeHeaderInfo, MultiAccountContextMenu, QrModal
-
Balance components (10 components, 0 stories)
- High user visibility
- Core to the wallet experience
-
Common components (16 components, 4 stories)
- Fill gaps in existing coverage
- Focus on high-visibility components first
Secondary Priority
- Dashboard components (18 components, 1 story)
- Transaction components (38 components, 0 stories)
- Settings components (14 components, 0 stories)
Clarifications
Session 2026-01-29
- Q: Should Chromatic visual regression failures block PR merges? → A: Block PRs, require designer sign-off for intentional visual changes via Chromatic's in-PR review workflow
- Q: Should 100% coverage include internal helper components with no visual output? → A: Only visually-rendered components require stories; skip providers, HOCs, and utility wrappers
Assumptions
- The existing Storybook configuration (Next.js framework, theme system, addons) is stable and suitable
- MUI components follow consistent patterns that allow templated story generation
- Designer collaboration will use Storybook's published URL for reviews
- Chromatic's free tier or existing plan provides sufficient snapshots for the project
- Future design system changes will happen incrementally after story coverage is complete
Dependencies
- Chromatic account setup and GitHub integration
- Designer availability for component state documentation and review
- Team agreement on component priority order
- CI/CD pipeline access for adding Chromatic step
Out of Scope
- Actual component refactoring from MUI to shadcn (this spec covers the preparation/documentation phase)
- Mobile app (apps/mobile) component stories
- E2E testing changes
- Performance optimization of Storybook build times
- Accessibility testing automation (can be added later)