test(e2e): add combined-listings recipe e2e tests#3544
test(e2e): add combined-listings recipe e2e tests#3544itsjustriley wants to merge 7 commits intorecipe-test-bundlesfrom
Conversation
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
2bf6cfa to
0aada99
Compare
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.
6fbb0ab to
51e560f
Compare
|
|
||
| await firstVariantLink.click(); | ||
|
|
||
| await expect.poll(() => page.url()).not.toBe(initialUrl); |
There was a problem hiding this comment.
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.
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ 1 findings → ✅ No issues → ✅ No issues |
| expect(mainText).toContain('$500'); | ||
| expect(mainText).toContain('$700'); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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'), |
There was a problem hiding this comment.
does this only work if made a regex?
technically the exact name could also match no?
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.tswith 6 tests covering: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?
All tests pass (25 total: 6 bundles + 6 combined-listings + 7 infinite-scroll + 6 markets).
Checklist