Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e574bd4 to
e55998a
Compare
There was a problem hiding this comment.
Pull request overview
Completes the E2E infra migration by converting the remaining TOML/dev-related E2E specs to create and clean up fresh apps at runtime, removing reliance on pre-provisioned apps and SHOPIFY_FLAG_CLIENT_ID.
Changes:
- Migrates the remaining E2E specs to use
appTestFixture+createApp()and runtime TOML injection. - Adds
extractClientId()/injectFixtureToml()helpers and removes the legacytoml-appfixture. - Updates TOML fixtures and CI workflow to remove
SHOPIFY_FLAG_CLIENT_ID/E2E_SECONDARY_CLIENT_ID.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/e2e/tests/toml-config.spec.ts | Creates fresh apps per test, injects full TOML fixture, deploys/devs, cleans up via dashboard. |
| packages/e2e/tests/toml-config-invalid.spec.ts | Stops injecting real client id; uses dummy client id in invalid TOMLs. |
| packages/e2e/tests/multi-config-dev.spec.ts | Creates fresh app, injects TOML fixture, adds staging config, validates -c config selection behavior. |
| packages/e2e/tests/dev-hot-reload.spec.ts | Creates fresh app, injects TOML fixture, verifies dev hot-reload via TOML edits and extension create/delete. |
| packages/e2e/setup/toml-app.ts | Deletes the old pre-provisioned TOML app fixture. |
| packages/e2e/setup/env.ts | Simplifies E2EEnv and requireEnv() (drops client id / partners token fields). |
| packages/e2e/setup/app.ts | Adds TOML helpers; removes FRESH_APP_ENV env-stripping from CLI helpers. |
| packages/e2e/data/valid-app/shopify.app.toml | Switches placeholders to __CLIENT_ID__ / __NAME__ for runtime injection. |
| packages/e2e/data/invalid-tomls/* | Replaces client_id placeholder with a dummy value. |
| .github/workflows/tests-pr.yml | Removes SHOPIFY_FLAG_CLIENT_ID and E2E_SECONDARY_CLIENT_ID from E2E job env. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
07eee8f to
91ac6a4
Compare
3b4a51b to
1d49241
Compare
b931123 to
bf1e8b6
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/common/version.d.ts@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "3.93.0";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "3.92.0";
\ No newline at end of file
|
bf1e8b6 to
de26577
Compare
1d49241 to
8be6206
Compare
de26577 to
9649836
Compare
8be6206 to
3a642b1
Compare
9649836 to
8e05272
Compare
3a642b1 to
a7567f7
Compare
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| timeout-minutes: 30 |
There was a problem hiding this comment.
Locally, the full suite takes ~12-13 min. In CI it went over the original 15 min limit, 19 min on this PR, mainly due to per-test teardown. To prevent CI from killing the run mid-suite, I increased the timeout. But I agree 30 min might be too much. Will set it to 20 min now.
The follow-up stacked PR #7171 optimizes the teardown process a bit, which should bring CI times down further, will evaluate this again on that PR!
packages/e2e/setup/app.ts
Outdated
| // Strip CLIENT_ID so the CLI creates a new app instead of linking to a pre-existing one | ||
| env: {FORCE_COLOR: '0', ...FRESH_APP_ENV}, | ||
| // Disable color output and strip CLIENT_ID to prevent leaking from parent process.env | ||
| env: {FORCE_COLOR: '0', SHOPIFY_FLAG_CLIENT_ID: undefined}, |
There was a problem hiding this comment.
let's just remove SHOPIFY_FLAG_CLIENT_ID
There was a problem hiding this comment.
Thanks for spottig this! Removed, but added SHOPIFY_FLAG_CLIENT_ID: undefined in pe2e/setup/env.ts to avoid errors if SHOPIFY_FLAG_CLIENT_ID is set in local .env
| /** | ||
| * Read the client_id from a shopify.app.toml file. | ||
| */ | ||
| export function extractClientId(appDir: string): string { |
There was a problem hiding this comment.
won't block on this, but we can use @shopify/toml-patch for this in the same manner that the cli does to extract toml fields. as much as possible we should avoid writing our own parsers
There was a problem hiding this comment.
Thanks for the suggestions. Switched extractClientId from regex to @iarna/toml, which parses TOML into a JS object so we can access client_id directly. @shopify/toml-patch only works with TOML strings in/out — it doesn't expose parsed values as JS objects, so it can't be used for reading fields.
| } | ||
|
|
||
| /** | ||
| * Overwrite a created app's shopify.app.toml with a fixture TOML template. |
There was a problem hiding this comment.
same comment re: @shopify/toml-patch
There was a problem hiding this comment.
Thanks for the suggestions. Now used toml-patch for injectFixtureToml. The fixture TOML now uses valid placeholder values instead of __CLIENT_ID__/__NAME__ — toml-patch patches them surgically at runtime, preserving comments and formatting.
packages/e2e/setup/app.ts
Outdated
| if (ctx.message) args.push('--message', ctx.message) | ||
| if (ctx.config) args.push('--config', ctx.config) | ||
| return ctx.cli.exec(args, {env: FRESH_APP_ENV, timeout: 5 * 60 * 1000}) | ||
| return ctx.cli.exec(args, {timeout: 5 * 60 * 1000}) |
There was a problem hiding this comment.
it's probably a good time to register a default timeout and add constants for areas that need more time
There was a problem hiding this comment.
Thanks for the suggestions! Now added setup/constants.ts. All magic numbers in e2e are replaced. Few older files are not processed because the files are planned to be removed completely later.
| // Edit scopes in the TOML to trigger a reload | ||
| const tomlPath = path.join(appDir, 'shopify.app.toml') | ||
| const original = fs.readFileSync(tomlPath, 'utf8') | ||
| fs.writeFileSync( |
There was a problem hiding this comment.
same comment re: toml patch
There was a problem hiding this comment.
Thanks for the suggestions. Updated!
| } | ||
| } finally { | ||
| proc.kill() | ||
| fs.rmSync(parentDir, {recursive: true, force: true}) |
There was a problem hiding this comment.
i think cli also has tmp dir utils for setting up ephemeral temporary directories that we can leverage here
There was a problem hiding this comment.
Thanks for the suggestions. Looked into this — cli-kit has inTemporaryDirectory and tempDirectory in @shopify/cli-kit/node/fs. Our env fixture already creates a single worker-scoped temp root (env.tempDir) that holds both XDG dirs and per-test app dirs. This gives us one place to inspect during debugging and one cleanup path on worker teardown. cli-kit's inTemporaryDirectory would scatter dirs across /tmp and always cleans up in its finally block — no way to preserve files for debugging. So keeping the current approach for now.
packages/e2e/playwright.config.ts
Outdated
| reporter: isCI ? [['html', {open: 'never'}], ['list']] : [['list']], | ||
| timeout: 3 * 60 * 1000, // 3 minutes per test | ||
| globalTimeout: 15 * 60 * 1000, // 15 minutes total | ||
| globalTimeout: 30 * 60 * 1000, // 30 minutes total |
There was a problem hiding this comment.
i'd encourage us to increment these in smaller portions, and try to use data when available to inform the decision
ryancbahan
left a comment
There was a problem hiding this comment.
Looking good overall! i think there are a few quality of life things that would be good to take a pass on, then ship. lmk what you think.
a7567f7 to
0e2a505
Compare
04cbb24 to
57c09aa
Compare
57c09aa to
9aa7b21
Compare

WHY are these changes introduced?
This is a follow-up to #7147 (E2E infra refactor). That PR migrated the app tests (scaffold, deploy, dev-server) to create fresh apps from scratch. This PR completes the migration by converting the remaining 4 test files that still depended on pre-provisioned apps via
SHOPIFY_FLAG_CLIENT_ID.After this PR, all E2E tests are self-contained — each test creates its own app, runs its assertions, and cleans up. No test depends on a pre-provisioned app or a fixed
SHOPIFY_FLAG_CLIENT_ID.WHAT is this pull request doing?
TOML helpers in
setup/app.ts:extractClientId(appDir)— readsclient_idfromshopify.app.tomlusing@iarna/tomlparser (same parser cli-kit uses internally viadecodeToml)injectFixtureToml(appDir, template, name)— patchesclient_idandnameinto fixture TOML using@shopify/toml-patch(updateTomlValues), preserving comments and formattingTOML editing in tests:
dev-hot-reload.spec.ts— scopes edit now usesupdateTomlValuesfrom@shopify/toml-patchinstead of string replaceShared timeout constants (
setup/constants.ts):TEST_TIMEOUT— per-test Playwright timeouts:default(3 min),long(10 min)CLI_TIMEOUT— CLI command execution:short(1 min),medium(3 min),long(5 min)BROWSER_TIMEOUT— browser interactions:short(1s),medium(3s),long(5s),max(60s)Migrated tests:
dev-hot-reload.spec.ts— creates fresh app, injects fully populated TOML fixture, tests hot reload (edit scopes, create/delete extensions mid-dev)multi-config-dev.spec.ts— creates fresh app, injects fixture TOML, creates staging config with sameclient_id, tests-cflag config selectiontoml-config.spec.ts— creates fresh app, injects fixture TOML, tests deploy and dev with fully populated configtoml-config-invalid.spec.ts— uses hardcoded dummyclient_id(CLI rejects invalid TOMLs at validation before any API call, so no real app needed)Cleaned up:
setup/toml-app.ts— thetomlAppFixtureis no longer usedSHOPIFY_FLAG_CLIENT_IDandE2E_SECONDARY_CLIENT_IDfrom CI workflowSHOPIFY_FLAG_CLIENT_IDglobally inenv.tsso it can't leak from local.envfilesclientId,secondaryClientId,partnersTokenfromE2EEnvinterfaceFRESH_APP_ENVfromsetup/app.tsdata/valid-app/shopify.app.tomluses valid placeholder values patched at runtime byupdateTomlValuesHow to test your changes?
Ensure
SHOPIFY_FLAG_CLIENT_IDis NOT in.env(no longer used).Measuring impact
Checklist