Skip to content

Uninstall E2E apps via the Admin API instead of the store admin UI - #8309

Open
isaacroldan wants to merge 1 commit into
mainfrom
isaac/e2e-uninstall-via-admin-api
Open

Uninstall E2E apps via the Admin API instead of the store admin UI#8309
isaacroldan wants to merge 1 commit into
mainfrom
isaac/e2e-uninstall-via-admin-api

Conversation

@isaacroldan

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

E2E teardown uninstalls apps by clicking through the store admin UI in Playwright — Polaris selectors, an uninstall-reason survey modal, and hard-coded waits. It is the flakiest step of teardown, and because store deletion and app deletion are both gated on a successful uninstall, one flaky modal interaction leaks a store and an app. Leaked apps are what drive the test org toward the 5,000-app cap.

WHAT is this pull request doing?

Replaces the browser-driven uninstall with two HTTP requests in a new setup/admin-api.ts:

  1. Mint an app access token with the client credentials grant (POST /admin/oauth/access_token). The grant applies because the E2E org owns both the app and the dev store. The client secret comes from app env show.
  2. Call the appUninstall Admin API mutation, which uninstalls the calling app. No scopes required.

Details:

  • The token mint can transiently return application_cannot_be_found right after app creation while records propagate, so it retries briefly (3 attempts, 5s apart). Verified empirically: bad client_id → application_cannot_be_found, bad secret → invalid_request, not installed → app_not_installed.
  • No browser fallback. The API path is deterministic; a failure should fail the test loudly instead of hiding behind the flaky click-through. The per-run cleanup jobs remain the safety net.
  • Harness-side API requests now send the loadtest header (loadtestHeaderRecord()), matching what the Playwright browser context already does.
  • Store-flow specs pass appDir to teardownAll and remove the temp app dir after teardown, since the API path reads the app config from disk.

Validated locally end to end: teardown logs show app uninstalled via admin API followed by CLI-confirmed store deletion in repeated runs of toml-config.spec.ts.

Follow-up (separate PR): app deletion still drives the Dev Dashboard UI and remains the top flake/leak source (scrollIntoViewIfNeeded: Timeout 5000ms).

How to test your changes?

Run any store-flow spec with teardown logging, e.g.:

cd packages/e2e
DEBUG=1 pnpm exec playwright test tests/toml-config.spec.ts -g "dev starts with fully populated toml" --workers=1

The teardown section should log uninstalling app via admin APIapp uninstalled via admin APIstore deletion confirmed by CLI.

Measuring impact

  • n/a — internal test harness change, no user-facing impact

🤖 Generated with Claude Code

The E2E teardown uninstalled apps by driving the store admin UI in
Playwright: Polaris selectors, an uninstall-reason survey modal, and
hard-coded waits. It was the flakiest step of teardown, and because
store and app deletion are gated on it, one flaky modal leaked both
a store and an app.

Replace it with two HTTP requests: mint an app access token with the
client credentials grant (the E2E org owns both the app and the dev
store, so the grant applies) and call the appUninstall mutation, which
uninstalls the calling app. The client secret comes from `app env show`.

The token mint can transiently 400 with application_cannot_be_found
right after app creation while records propagate, so it retries briefly.
There is no browser fallback: the API path is deterministic, and a
failure should surface loudly instead of hiding behind the flaky
click-through. The per-run cleanup jobs remain the safety net.

Specs now pass appDir to teardownAll and remove the temp dir after
teardown, since the API path reads the app config from disk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@isaacroldan
isaacroldan requested a review from a team as a code owner August 11, 2026 12:12
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant