Skip to content

test(e2e): add subscriptions recipe e2e tests#3545

Open
itsjustriley wants to merge 8 commits intorecipe-test-combined-listingsfrom
recipe-test-subscriptions
Open

test(e2e): add subscriptions recipe e2e tests#3545
itsjustriley wants to merge 8 commits intorecipe-test-combined-listingsfrom
recipe-test-subscriptions

Conversation

@itsjustriley
Copy link
Contributor

WHY are these changes introduced?

Adds e2e test coverage for the subscriptions recipe, which enables selling subscription-based products using selling plan groups from the Shopify Subscriptions app. This continues the systematic testing of recipes to ensure all user-facing changes are validated.

This PR is stacked on #3544 (combined-listings tests).

WHAT is this pull request doing?

Adds e2e/specs/recipes/subscriptions.spec.ts with 5 tests covering:

  • Selling plan selector display with subscription options heading
  • Multiple subscription frequency options (weekly, monthly, etc.)
  • Subscription selection via navigation (URL includes selling_plan parameter)
  • Adding subscription products to cart
  • Subscription details display in cart line items
  • Verification that regular products don't show subscription UI

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

The subscriptions recipe implements selling plan groups, allowing customers to choose between one-time purchases or recurring subscriptions for products with available selling plans.

Note: These tests do NOT cover the /account/subscriptions management page, as that requires customer authentication.

HOW to test your changes?

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

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

All tests pass (30 total: 6 bundles + 6 combined-listings + 5 subscriptions + 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-subscriptions branch. Details:

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

Learn more about Hydrogen's GitHub integration.

@itsjustriley itsjustriley marked this pull request as ready for review March 6, 2026 18:42
@itsjustriley itsjustriley requested a review from a team as a code owner March 6, 2026 18:42
@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 → ✅ 1 findings → ✅ No issues → ✅ 1 findings → ✅ 1 findings → ✅ No issues → ✅ No issues → ✅ No issues

itsjustriley added a commit that referenced this pull request Mar 9, 2026
…ives

Addresses binks-code-reviewer feedback on PR #3545:

- Fix selling plan URL parameter switching to properly wait for value
  changes instead of just checking existence. Previously could capture
  same value twice if navigation was fast.

- Replace overly-broad cart assertion regex with specific getByText check
  for 'subscription' marker. Original regex matched any single word like
  'every', 'month', 'week' which could appear in unrelated UI copy.

- Scope cart assertion to specific line item using getByText().toBeVisible()
  instead of textContent() to avoid matching hidden text.

All 6 tests passing locally.

test.describe('Cart - Subscription Product', () => {
test('displays subscription details in cart line item', async ({page}) => {
const cart = new CartUtil(page);
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: This test repeats the full add-to-cart flow (~17 lines) that the previous test already exercises. CartUtil.addItem() encapsulates this with robustness guards (waits for Remove button). That said, explicit setup in each test is a valid e2e philosophy — fine either way.

@itsjustriley itsjustriley force-pushed the recipe-test-subscriptions branch from aaf0bcc to d4cf926 Compare March 10, 2026 18:54
@itsjustriley itsjustriley force-pushed the recipe-test-combined-listings branch from ad9efb6 to 33aded1 Compare March 11, 2026 14:25
itsjustriley added a commit that referenced this pull request Mar 11, 2026
…ives

Addresses binks-code-reviewer feedback on PR #3545:

- Fix selling plan URL parameter switching to properly wait for value
  changes instead of just checking existence. Previously could capture
  same value twice if navigation was fast.

- Replace overly-broad cart assertion regex with specific getByText check
  for 'subscription' marker. Original regex matched any single word like
  'every', 'month', 'week' which could appear in unrelated UI copy.

- Scope cart assertion to specific line item using getByText().toBeVisible()
  instead of textContent() to avoid matching hidden text.

All 6 tests passing locally.
@itsjustriley itsjustriley force-pushed the recipe-test-subscriptions branch from d4cf926 to 21cf381 Compare March 11, 2026 14:28
@itsjustriley itsjustriley force-pushed the recipe-test-combined-listings branch from 33aded1 to c5e7e6d Compare March 11, 2026 17:01
Add comprehensive tests for subscription product functionality including selling plan selector display, subscription frequency options, cart integration, and verification that regular products don't show subscription UI.
Convert 'Note: This test does NOT cover...' to a TODO for future work, since auth tests should be added to this file later.
Remove verbose and redundant comments from doc block and const declarations.
Tests that users can switch between subscription frequencies (monthly ↔ weekly)
and URL parameters update correctly for each selection.

Addresses audit recommendation for edge case coverage.
…ives

Addresses binks-code-reviewer feedback on PR #3545:

- Fix selling plan URL parameter switching to properly wait for value
  changes instead of just checking existence. Previously could capture
  same value twice if navigation was fast.

- Replace overly-broad cart assertion regex with specific getByText check
  for 'subscription' marker. Original regex matched any single word like
  'every', 'month', 'week' which could appear in unrelated UI copy.

- Scope cart assertion to specific line item using getByText().toBeVisible()
  instead of textContent() to avoid matching hidden text.

All 6 tests passing locally.
@itsjustriley itsjustriley force-pushed the recipe-test-subscriptions branch from 21cf381 to ab4981c Compare March 11, 2026 17:04
itsjustriley added a commit that referenced this pull request Mar 11, 2026
…ives

Addresses binks-code-reviewer feedback on PR #3545:

- Fix selling plan URL parameter switching to properly wait for value
  changes instead of just checking existence. Previously could capture
  same value twice if navigation was fast.

- Replace overly-broad cart assertion regex with specific getByText check
  for 'subscription' marker. Original regex matched any single word like
  'every', 'month', 'week' which could appear in unrelated UI copy.

- Scope cart assertion to specific line item using getByText().toBeVisible()
  instead of textContent() to avoid matching hidden text.

All 6 tests passing locally.
@itsjustriley itsjustriley requested a review from kdaviduik March 11, 2026 21:20
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