Skip to content

test(storybook): re-add play() interaction tests for PR #94 stories #103

@luandro

Description

@luandro

Summary

PR #94 (feat(storybook): @storybook/addon-vitest + CI matrix) added @storybook/addon-vitest to the CI matrix but had to remove 10 play() interaction tests across 6 stories because the Storybook 10 vitest-browser integration hangs in the sb-preparing-story state (upstream issue: storybookjs/storybook#18663).

Lost play() tests (per commit 45673c1)

Story file Removed story What it exercised
src/components/ui/button.stories.tsx Test (renamed → ClickHandler) Spy registered on click; assert called on press, ignored when loading
src/components/ui/button.stories.tsx LoadingBlocksClicks (renamed → LoadingClickHandler) Spy registered but never called when loading: true
src/screens/ObservationDetailScreen.stories.tsx WithObservation Back-nav affordance click path
src/screens/SettingsScreen.stories.tsx InviteFormFilled Form input → submit → results flow
src/screens/SettingsScreen.stories.tsx WithInviteResults Results list rendering after submit
src/screens/SettingsScreen.stories.tsx InviteFormError Server-error state after submit
src/screens/SettingsScreen.stories.tsx ClearDataDialogOpen Confirm dialog open + accept path
src/components/shared/ExportObservationsButton.stories.tsx Open Dropdown open + select option
src/components/shared/FilterSheet.stories.tsx Open (×3 play() blocks) Sheet expand + filter apply + reset
src/screens/InviteScreen.stories.tsx Connected Connection state transition

The ClickHandler / LoadingClickHandler stories were renamed (not removed) in commit 46c5db3 with JSDoc clarifying they are visual-stories-only and that the spy is registered but never asserted (since play() is gone).

Acceptance criteria

When upstream storybookjs/storybook#18663 is fixed and Storybook 10 vitest-browser can run play() blocks in CI, this issue tracks restoring ALL 10 deleted play() blocks:

  1. Re-add the play: async ({ canvasElement, args, step }) => { ... } bodies to the 6 stories above.
  2. Re-convert ClickHandler / LoadingClickHandler from "visual-stories-only" JSDoc back to real interaction tests that assert the spy is called / not called.
  3. Run the full test:storybook matrix locally and verify all 10 play() tests pass in CI.
  4. Close this issue and update PR feat(storybook): enable @storybook/addon-vitest + CI matrix #94's description to remove the "(play() tests removed)" caveat.

Workaround applied in PR #94

  • New unit tests in tests/unit/ cover the same components in isolation (MapContainer, MediaPreview, DataScreen).
  • The visual-regression screenshot baseline in tests/e2e/storybook-screenshots-baseline/ still renders every story (including the ones that lost play()), so visual regressions are still caught.
  • The removed play() blocks are interaction tests, not rendering tests — the rendered DOM is unchanged.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:pr-openedImplementation PR has been opened for this issue.backlogdifficulty:mediumModerate issue requiring planning, tests, and review.storybookStorybook stories and visual testing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions