Skip to content

feat(atomic): migrate IPX button and modal stories to MSW#7601

Merged
alexprudhomme merged 1 commit into
mainfrom
msw-ipx
May 21, 2026
Merged

feat(atomic): migrate IPX button and modal stories to MSW#7601
alexprudhomme merged 1 commit into
mainfrom
msw-ipx

Conversation

@alexprudhomme
Copy link
Copy Markdown
Contributor

Problem

The atomic-ipx-button and atomic-ipx-modal Storybook stories were not using MSW to mock API calls. Instead, they relied on direct getSampleSearchEngineConfiguration() calls or missing mock handlers, making them dependent on live API availability.

Solution

Migrated both stories to use MockSearchApi with MSW handlers:

  • atomic-ipx-button: Replaced manual interface initialization with wrapInSearchInterface() decorator and added MSW handlers
  • atomic-ipx-modal: Added MockSearchApi instance and MSW handler configuration

All 7 IPX stories now consistently use MSW for API mocking.

Replace direct API calls with MSW mock handlers for:
- atomic-ipx-button: Replace manual getSampleSearchEngineConfiguration()
  with wrapInSearchInterface() decorator and MockSearchApi handlers
- atomic-ipx-modal: Add MockSearchApi handlers to intercept API calls

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: ee0080f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svcsnykcoveo
Copy link
Copy Markdown

svcsnykcoveo commented May 21, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 21, 2026

Important

Testing in progress…

🟢 UI Tests: 366 tests unchanged
UI Review: Comparing 366 stories…
Storybook icon Storybook Publish: 366 stories published

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 21, 2026

Tip

All tests passed and all changes approved!

🟢 UI Tests: 366 tests unchanged
🟢 UI Review: 366 stories published -- no changes
Storybook icon Storybook Publish: 366 stories published

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 21, 2026

@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@7601

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@7601

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@7601

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@7601

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@7601

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@7601

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@7601

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@7601

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@7601

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@7601

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@7601

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@7601

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@7601

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@7601

commit: ee0080f

@alexprudhomme alexprudhomme added this pull request to the merge queue May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Atomic IPX Storybook stories so they no longer rely on live API availability, by switching atomic-ipx-button and atomic-ipx-modal to MSW-backed mocks via MockSearchApi and the existing wrapInSearchInterface() utilities.

Changes:

  • Added MockSearchApi instances and MSW handlers to both story files.
  • Migrated atomic-ipx-button away from manual atomic-search-interface initialization to the shared wrapInSearchInterface({skipFirstSearch: true}) decorator/play flow.
  • Added per-story beforeEach cleanup to clear queued mock search responses between story runs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/atomic/src/components/ipx/atomic-ipx-modal/atomic-ipx-modal.new.stories.tsx Adds MockSearchApi + MSW handlers and resets mock search state per story run.
packages/atomic/src/components/ipx/atomic-ipx-button/atomic-ipx-button.new.stories.tsx Uses wrapInSearchInterface + MSW handlers instead of manual interface initialization, and clears mock search state per story run.

Merged via the queue into main with commit c35db21 May 21, 2026
77 checks passed
@alexprudhomme alexprudhomme deleted the msw-ipx branch May 21, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants