Skip to content

fix(e2e): replace fragile collection name assertion with structural check#3633

Merged
itsjustriley merged 2 commits intomainfrom
worktree-fix+third-party-api-collection-assertion
Mar 26, 2026
Merged

fix(e2e): replace fragile collection name assertion with structural check#3633
itsjustriley merged 2 commits intomainfrom
worktree-fix+third-party-api-collection-assertion

Conversation

@itsjustriley
Copy link
Contributor

@itsjustriley itsjustriley commented Mar 26, 2026

WHY are these changes introduced?

The third-party-api.spec.ts E2E test hardcodes 'Winter Collection' as the expected featured collection title, but the skeleton homepage queries collections(first: 1, sortKey: UPDATED_AT, reverse: true) — the result changes whenever any collection is updated in the preview store. This caused the test to fail in CI when a different collection became the most recently updated.

WHAT is this pull request doing?

  • Removes the fragile KNOWN_FEATURED_COLLECTION constant and replaces the specific name assertion with a structural getByRole('heading', {level: 1}) check. This matches the pattern already used by home.spec.ts, b2b.spec.ts, metaobjects.spec.ts, and infinite-scroll.spec.ts.
  • Adds a "Dynamic Store Data" guideline to e2e/CLAUDE.md to prevent this anti-pattern in future tests: assert structure rather than specific names when testing dynamically-queried store data.

HOW to test your changes?

npx playwright test --project=recipes e2e/specs/recipes/third-party-api.spec.ts

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

🤖 Generated with Claude Code

…heck

The third-party-api recipe test hardcoded 'Winter Collection' as the
expected featured collection title, but the skeleton homepage queries
collections sorted by UPDATED_AT — meaning the result changes whenever
any collection is updated in the preview store.

Replace the specific name assertion with a structural h1 check, matching
the pattern already used by home.spec.ts, b2b.spec.ts, metaobjects.spec.ts,
and infinite-scroll.spec.ts. Also add "Dynamic Store Data" guidance to
e2e/CLAUDE.md to prevent this anti-pattern in future tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shopify
Copy link
Contributor

shopify bot commented Mar 26, 2026

Oxygen deployed a preview of your worktree-fix+third-party-api-collection-assertion branch. Details:

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

Learn more about Hydrogen's GitHub integration.

@itsjustriley itsjustriley marked this pull request as ready for review March 26, 2026 16:40
@itsjustriley itsjustriley requested a review from a team as a code owner March 26, 2026 16:40
Co-authored-by: ✦ freddie <45042736+fredericoo@users.noreply.github.com>
Copy link
Contributor

@fredericoo fredericoo left a comment

Choose a reason for hiding this comment

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

lfg

@itsjustriley itsjustriley merged commit 05f11ae into main Mar 26, 2026
20 of 21 checks passed
@itsjustriley itsjustriley deleted the worktree-fix+third-party-api-collection-assertion branch March 26, 2026 17:38
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