Skip to content

test(e2e): add combined-listings recipe e2e tests#3544

Open
itsjustriley wants to merge 7 commits intorecipe-test-bundlesfrom
recipe-test-combined-listings
Open

test(e2e): add combined-listings recipe e2e tests#3544
itsjustriley wants to merge 7 commits intorecipe-test-bundlesfrom
recipe-test-combined-listings

Conversation

@itsjustriley
Copy link
Contributor

@itsjustriley itsjustriley commented Mar 6, 2026

WHY are these changes introduced?

Adds e2e test coverage for the combined-listings recipe, which enables displaying and managing combined listings created with the Shopify Combined Listings app. This continues the systematic testing of recipes to ensure all user-facing changes are validated.

This PR is stacked on #3543 (bundles tests).

WHAT is this pull request doing?

Adds e2e/specs/recipes/combined-listings.spec.ts with 6 tests covering:

  • "Add to cart" button hidden on parent combined listing products
  • Price range display (From $X To $Y) for combined listings
  • Variant selection URL navigation behavior
  • Parent products filtered from collection listings
  • Regular products show "Add to cart" button normally
  • Regular products don't display price ranges

Tests use role-based selectors, .toHaveCount(0) for robust absence testing, and follow established patterns from existing recipe tests.

The combined-listings recipe allows grouping separate products together into a single product listing using a shared option like color or size. Parent products are hidden from collection listings by default.

HOW to test your changes?

# Run combined-listings recipe tests only
npx playwright test --project=recipes combined-listings

# Run all recipe tests
npx playwright test --project=recipes

All tests pass (25 total: 6 bundles + 6 combined-listings + 7 infinite-scroll + 6 markets).

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@shopify
Copy link
Contributor

shopify bot commented Mar 6, 2026

Oxygen deployed a preview of your recipe-test-combined-listings branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment March 9, 2026 1:54 PM

Learn more about Hydrogen's GitHub integration.

@itsjustriley itsjustriley force-pushed the recipe-test-combined-listings branch from 2bf6cfa to 0aada99 Compare March 6, 2026 16:45
@itsjustriley itsjustriley changed the title Add combined-listings recipe e2e tests test(e2e): add combined-listings recipe e2e tests Mar 6, 2026
Change absence testing from .not.toBeVisible() to .toHaveCount(0) for more robust validation following gift card test patterns. Also simplify price range absence test to use getByText directly.
@itsjustriley itsjustriley marked this pull request as ready for review March 6, 2026 18:35
@itsjustriley itsjustriley requested a review from a team as a code owner March 6, 2026 18:35

await firstVariantLink.click();

await expect.poll(() => page.url()).not.toBe(initialUrl);

Choose a reason for hiding this comment

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

Over-broad “first link in main” click can be unstable/non-deterministic

This selects any link under <main> and clicks the first:

const variantLinks = page.getByRole('main').getByRole('link');
const firstVariantLink = variantLinks.first();
await firstVariantLink.click();

On many pages, the first link could be breadcrumbs, nav links, or other unrelated links. DOM ordering changes can make the test flaky and/or stop validating variant selection.

@binks-code-reviewer
Copy link

binks-code-reviewer bot commented Mar 6, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ 1 findings → ✅ No issues → ✅ No issues

Comment on lines +60 to +61
expect(mainText).toContain('$500');
expect(mainText).toContain('$700');
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be part of the KNOWN_COMBINED_PRODUCT constant? just in case we want to change the product, we should also easily find anything attached to it like formatted prices


await firstVariantOptionLink.click();

await expect.poll(() => page.url()).not.toBe(initialUrl);
Copy link
Contributor

Choose a reason for hiding this comment

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

if we could test for the positive instead of negative it’d be better

what does it do to the url? add a search param? maybe we can test that instead

await page.goto('/collections/all');

const parentProductCard = page.getByRole('link', {
name: new RegExp(KNOWN_COMBINED_LISTING.name, 'i'),
Copy link
Contributor

Choose a reason for hiding this comment

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

does this only work if made a regex?
technically the exact name could also match no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants