test(e2e): add custom-cart-method recipe e2e tests#3546
test(e2e): add custom-cart-method recipe e2e tests#3546itsjustriley wants to merge 5 commits intorecipe-test-subscriptionsfrom
Conversation
Add comprehensive tests for inline variant editing in cart including option selector display, variant changes, and quantity maintenance after changes.
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
Add tests to verify line item URL updates and no page reload occurs when variants change, making tests more thorough and meaningful.
Eliminates non-deterministic variant selection and removes conditional branches that could let tests pass without exercising recipe behavior. Moves cart option-selection helpers into CartUtil, switches to role-based combobox selectors, and strengthens checks for URL updates, quantity stability, and no-reload user-visible behavior.
Use quantity control state instead of matching "Quantity: 2" text so recipe coverage remains stable across copy or localization changes. The test now verifies the decrease control stays enabled before and after variant changes while preserving the single-line-item assertion.
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ 1 findings → ✅ No issues |
|
|
||
| const nextValue = enabledOptionValues.find( | ||
| (value) => value !== initialValue, | ||
| ); |
There was a problem hiding this comment.
selectDifferentOption can accidentally select placeholder/empty option
The helper builds enabledOptionValues from all non-disabled options and selects the first value different from initialValue. If the <select> contains an enabled placeholder option like <option value="">Select…</option>, nextValue may become an empty string. Selecting "" may be a no-op, fail validation, or cause UI reversion, leading to intermittent failures depending on product configuration.
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