fix(e2e): replace fragile collection name assertion with structural check#3633
Merged
itsjustriley merged 2 commits intomainfrom Mar 26, 2026
Merged
Conversation
…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>
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
fredericoo
reviewed
Mar 26, 2026
Co-authored-by: ✦ freddie <45042736+fredericoo@users.noreply.github.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.
WHY are these changes introduced?
The
third-party-api.spec.tsE2E test hardcodes'Winter Collection'as the expected featured collection title, but the skeleton homepage queriescollections(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?
KNOWN_FEATURED_COLLECTIONconstant and replaces the specific name assertion with a structuralgetByRole('heading', {level: 1})check. This matches the pattern already used byhome.spec.ts,b2b.spec.ts,metaobjects.spec.ts, andinfinite-scroll.spec.ts.e2e/CLAUDE.mdto 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.tsChecklist
🤖 Generated with Claude Code