E2E: utility - cleanup apps#7356
Open
phyllis-sy-wu wants to merge 1 commit intopsyw-0420-E2E-utility-cleanup-storesfrom
Open
E2E: utility - cleanup apps#7356phyllis-sy-wu wants to merge 1 commit intopsyw-0420-E2E-utility-cleanup-storesfrom
phyllis-sy-wu wants to merge 1 commit intopsyw-0420-E2E-utility-cleanup-storesfrom
Conversation
4 tasks
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 21, 2026
613e20c to
bf4a32b
Compare
67d2e41 to
97411c9
Compare
bf4a32b to
a7f4fd5
Compare
97411c9 to
7b3f2da
Compare
a7f4fd5 to
47a7f22
Compare
7b3f2da to
c9fc623
Compare
47a7f22 to
1c6838f
Compare
1c6838f to
73d2cae
Compare
c9fc623 to
4e400ce
Compare
This was referenced Apr 22, 2026
73d2cae to
de46b8d
Compare
91e2ac6 to
3be5740
Compare
3be5740 to
96e0270
Compare
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?
E2E tests create apps that can accumulate when tests fail mid-run, CI times out, or teardown fails. This script automates bulk-clean for leftover apps.
WHAT is this pull request doing?
cleanup-apps.tsStandalone cleanup script that finds leftover E2E test apps on the Dev Dashboard, uninstalls them from all stores, and deletes them.
Logic
Discovery phase:
completeLoginhelpera[href*="/apps/"]selectorsE2E-)a[href*="next_cursor"]and repeat 3–5 on each pageUninstall (per app):
{appUrl}/installspage.content())button#nextURLand repeat 2–3 on each pagea. Navigate to
admin.shopify.com/store/{slug}/settings/appsb. Dismiss Dev Console if visible
c. Find app by name via
span:has-text("{appName}"):not([class*="Polaris"])d. If not visible → already uninstalled, skip to next store
e. Click
⋯menu button (next sibling) → click "Uninstall" → click confirmf. Verify: reload page, check the app span is no longer visible
g. If still visible → mark
allUninstalled = falseh. On error: log store slug and error message, mark
allUninstalled = false{appUrl}/installs, scan every row across all pagesfalseallUninstalledDelete (per app):
{appUrl}/settingstrue); 500/502 → throw to retryisEnabled()returns false, reload once as a fallback for propagation lag;click({timeout: 2 * BROWSER_TIMEOUT.long})'s auto-wait handles the rest at ~100ms granularity{appUrl}/settings, check for 404 (success) or 500/502 (throw to retry)Per-app retry wrapper:
maxRetries + 1attempts (default: 3 total)(Xs)); summary printed at end:X succeeded, Y skipped, Z failed (Xs total)--listmode: runs discovery only, prints app names and install counts.--uninstallmode: runs uninstall only, skips apps with 0 installs.--deletemode: runs delete only, skips apps with installs > 0.Features:
cleanupAllApps()for use as a Playwright globalTeardown or from other scriptsHow is this different from per-test teardown?
setup/teardown.ts) — knows the specific app name and store FQDN, uses direct URLs, no discovery. Runs automatically in testfinallyblocks.cleanup-apps.ts(bulk, manual) — discovers all matching apps via dashboard pagination, discovers stores via installs page. Safety net for orphaned apps from failed/interrupted test runs.How to test your changes?
pnpm --filter e2e exec tsx scripts/cleanup-apps.ts --listpnpm --filter e2e exec tsx scripts/cleanup-apps.ts --headedExample
pnpm --filter e2e exec tsx scripts/cleanup-apps.ts --headedcleanup-apps.mov
Expand for complete log
Post-release steps
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add