feat: stubs out initial customer accounts e2e test#3532
Draft
feat: stubs out initial customer accounts e2e test#3532
Conversation
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
andguy95
commented
Mar 5, 2026
| import type {Page} from '@playwright/test'; | ||
| import {expect} from '@playwright/test'; | ||
|
|
||
| const LOADTEST_HEADER = '<ADD THE LOADTEST HEADER HERE>'; |
Collaborator
Author
There was a problem hiding this comment.
@itsjustriley here is the place to add in that header. Might have to add it to the secrets JSON. I wasnt able to get ejson working
Contributor
|
Couldn’t tophat it, can you help?
|
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.

Here's a draft PR summary:
E2E for Customer Account flows
Summary
Adds the E2E test infrastructure for testing customer account login, logout, and account page navigation against the skeleton template. This lays the foundation so a teammate can expand coverage to profile updates, address CRUD, order history, etc. without needing to solve the auth plumbing.
The tests use a benchmark shop OTP bypass (per Shawn Lee-Kwong's guidance in #hydrogen-headless) -- a special loadtest header +
@example.comemail makes the OTP always000000, no email sent.What changed
e2e/fixtures/customer-account-utils.ts(new) --CustomerAccountUtilfixture withlogin(),logout(), auth state assertions, and account page helperse2e/fixtures/index.ts-- AddedcustomerAccountfixture and store key;setTestStore()now accepts an options param forcustomerAccountPush: truee2e/specs/skeleton/customerAccount.spec.ts(new) -- 8 MVP tests: login, account nav, auth persistence, subpage navigation (orders/profile/addresses), logout, unauthenticated redirecte2e/envs/.env.customerAccount(new) -- Env config pointing at the[e2e] Customer Authbenchmark storesecrets.ejson-- Addedcustomer_account_email(the@example.comtest email)How to run
Tests are configured to run serially (
test.describe.configure({mode: 'serial'})) to avoid spawning multiple Cloudflare tunnels.Prerequisites
cd templates/skeleton && npx shopify auth login)cd templates/skeleton && npx shopify hydrogen link)Gotchas
Hosted login page selectors need validation -- The
login()method incustomer-account-utils.tsinteracts with Shopify's hosted login page (email input, OTP input, submit buttons). These selectors were written defensively with fallbacks, but haven't been validated against the real page yet. On your first successful run, the selectors for the OTP input in particular may need adjusting.Cloudflare tunnel rate limiting -- If you run the tests too many times in quick succession (or with
--workers>1), Cloudflare will return 429 and the tunnel won't start. Wait ~15-30 min for the rate limit to reset. The spec is configured for serial mode to mitigate this, but rapid re-runs can still trigger it. I think during testing I spawned to much and couldn't get passed this rate limit.The loadtest header -- The
LOADTEST_HEADERconstant incustomer-account-utils.tsis currently a placeholder (<ADD THE LOADTEST HEADER HERE>). This needs to be set to the real header name from the slack thread (X-Shopify-Loadtest-...).No
localhostfallback -- The Hydrogen SDK hard-rejects customer account OAuth requests that don't come from*.tryhydrogen.dev. There is no way to test customer account flows without the tunnel.Test customer creation -- A customer with the
@example.comemail needs to exist on the store. If the test customer gets deleted or the store is reset, you'll need to recreate it. With the benchmark bypass, signing in with a new@example.comemail should auto-create the account.Adding new tests is straightforward -- Use the
customerAccountfixture, callcustomerAccount.login(testEmail)inbeforeEach, and write assertions against the account pages. See the existingAccount Pagesdescribe block for the pattern.