Add End-to-End Testing Infrastructure with Playwright#986
Open
IliasHad wants to merge 1 commit intoShopify:mainfrom
Open
Add End-to-End Testing Infrastructure with Playwright#986IliasHad wants to merge 1 commit intoShopify:mainfrom
IliasHad wants to merge 1 commit intoShopify:mainfrom
Conversation
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.
Add End-to-End Testing Infrastructure with Playwright
Summary
This PR adds a comprehensive end-to-end testing infrastructure to the Shopify Remix template using Playwright. It includes MSW (Mock Service Worker) for mocking Shopify API responses, a custom Shopify test harness for authentication, and initial test examples.
Motivation
End-to-end testing is essential for ensuring the reliability of Shopify apps. This implementation allows developers to:
Implementation Details
Core Components:
Mock Service Worker Configuration:
Custom Shopify Test Harness:
Environment Configuration:
.env.testingsupport for test-specific environment variablesExample Tests:
File Changes:
tests/constants/index.ts: Added constants for test shop and API versiontests/mocks/node.ts: Setup MSW server for Node.js environmenttests/mocks/handlers.ts: Implemented GraphQL and REST API mock handlerstests/global/shopify.ts: Created custom Shopify test harnesstests/e2e/example.spec.ts: Added example test cases.env.testing.example: Added example environment file for testingHow to Test
.env.testing.exampleto.env.testingand fill in your Shopify API credentialsnpm run test