test(e2e): add third-party-api recipe e2e tests#3549
Open
itsjustriley wants to merge 4 commits intorecipe-test-metaobjectsfrom
Open
test(e2e): add third-party-api recipe e2e tests#3549itsjustriley wants to merge 4 commits intorecipe-test-metaobjectsfrom
itsjustriley wants to merge 4 commits intorecipe-test-metaobjectsfrom
Conversation
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
Add tests verifying Rick and Morty character data from external GraphQL API displays on homepage, demonstrating cached third-party API integration.
Refactored tests to be more specific and follow best practices: WHY: - Initial implementation had weak assertions and duplicate setup - Tests should verify specific user-facing elements, not just string presence - Following Playwright best practices for test organization WHAT CHANGED: - Added beforeEach hook to eliminate duplicate setup - Removed redundant second test that checked generic content length - Added specific assertion for heading with exact text match - Verified character list structure and count (20 characters) - Tests now validate the specific section the recipe adds HOW: - Use role-based selectors for heading and list items - Use class selector for the specific third-party-api-example section - Assert on the exact heading text the recipe introduces - Verify API returns 20 characters as expected
Replace brittle class and fixed-count assertions with resilient, user-facing checks scoped to the recipe section. Add a regression check that existing homepage content still renders alongside third-party API content to better reflect real UX impact.
Harden the recipe coverage so it asserts meaningful user-visible outcomes without relying on broad page-level assumptions. Scope list checks to the recipe section anchored by its heading, require multiple visible character items with non-empty text, and verify Recommended Products renders as a visible landmark with links.
2556403 to
d2dbaaa
Compare
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ No issues |
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?
Adds e2e test coverage for the third-party-api recipe, which demonstrates integrating external GraphQL APIs (Rick & Morty API) with Oxygen's caching system. This continues the systematic testing of recipes to ensure user-facing recipe behavior is validated.
This PR is stacked on #3548 (metaobjects tests).
WHAT is this pull request doing?
Adds
e2e/specs/recipes/third-party-api.spec.tswith 3 tests covering:Tests verify that the recipe successfully:
HOW to test your changes?
Checklist