test(e2e): add custom-cart-method recipe e2e tests#3546
Open
itsjustriley wants to merge 6 commits intorecipe-test-subscriptionsfrom
Open
test(e2e): add custom-cart-method recipe e2e tests#3546itsjustriley wants to merge 6 commits intorecipe-test-subscriptionsfrom
itsjustriley wants to merge 6 commits intorecipe-test-subscriptionsfrom
Conversation
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
This was referenced Mar 6, 2026
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ 1 findings → ✅ No issues → ✅ No issues |
d4cf926 to
21cf381
Compare
96db938 to
3077329
Compare
21cf381 to
ab4981c
Compare
3077329 to
ac5373e
Compare
kdaviduik
previously requested changes
Mar 16, 2026
8cb5406 to
68e5086
Compare
83f70e6 to
9fd5b97
Compare
Adds end-to-end tests for the custom-cart-method recipe covering: - Custom cart with product variant selection - Cart quantity management (increase, decrease, remove) - Variant change verification in cart - Empty option filtering in cart variant selector Also adds shared cart-utils fixture with reusable cart assertion helpers (getCartLineItemByIndex, quantity checks).
68e5086 to
9ee6a3c
Compare
- Remove type assertion: use typed parameter `(el: HTMLSelectElement)` in evaluate callback instead of `as HTMLSelectElement` - Promote `getFirstLineItem` free function to `CartUtil.getFirstLineItem()` method for better discoverability - Strengthen first test assertion from `> 0` to `>= 2` to verify the recipe renders selectors for multiple product options - Remove redundant `increaseButton.toBeEnabled()` assertion irrelevant to the test's purpose of verifying option selectors exist
The method blocks on a visibility assertion before returning, making it a blocking wait rather than a pure getter. Renaming signals this to callers and is consistent with the naming conventions of other action methods in CartUtil (vs. pure locator getters like getLineItems). Renaming now while only one spec uses it avoids a multi-file rename once more recipe tests adopt this shared utility.
6e3a8af to
d1b6b5a
Compare
…eservation properties
Tests 3 ("maintains single line item") and 4 ("updates without page reload")
previously asserted preservation/no-reload properties that were already true
before the variant change. If updateLineByOptions was completely broken, both
tests would pass vacuously since selectDifferentOption only confirms the DOM
<select> value changed, not that the async cart API round-trip completed.
Each test now captures the product link's initial href and polls for it to
change before asserting its core properties. This proves the cart update
completed — if the recipe is broken, the poll times out and the test fails.
Also tightened the productLink selector in all three tests from
getByRole('link').first() to getByRole('link', {name: ...}) so it targets the
product link specifically rather than relying on positional ordering.
Co-authored-by: Claude <claude@anthropic.com>
fredericoo
reviewed
Mar 19, 2026
fredericoo
reviewed
Mar 19, 2026
fredericoo
reviewed
Mar 19, 2026
fredericoo
reviewed
Mar 19, 2026
Move waitForOptionSelectors and selectDifferentOption into a dedicated CustomCartMethodUtil class. These methods are only used by the custom-cart-method recipe tests and don't belong in the generic cart utility, which caused confusion about whether they were shared helpers. Addresses fredericoo's review feedback on PR #3546. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of https://github.com/Shopify/developer-tools-team/issues/1057
WHY are these changes introduced?
Adds e2e test coverage for the custom-cart-method recipe, which enables customers to change product variants directly within the cart using inline dropdown selectors. This continues the systematic testing of recipes to ensure all user-facing changes are validated.
This PR is stacked on #3545 (subscriptions tests).
WHAT is this pull request doing?
Adds
e2e/specs/recipes/custom-cart-method.spec.tswith 4 comprehensive tests covering:Tests use
locator('select')for dropdown elements, verify URL changes to confirm variant updates, check cart dialog visibility to ensure no reload, reuseCartUtilfor cart operations, and follow established patterns from existing recipe tests.The custom-cart-method recipe implements the
updateLineByOptionscart method, allowing customers to change product variants (size, color, etc.) without removing and re-adding items.HOW to test your changes?
All tests pass (34 total: 6 bundles + 6 combined-listings + 5 subscriptions + 4 custom-cart-method + 7 infinite-scroll + 6 markets).
Checklist