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
3be5740 to
96e0270
Compare
96e0270 to
68d2d07
Compare
de46b8d to
3a6b042
Compare
68d2d07 to
d98268a
Compare
3a6b042 to
5a5c2f7
Compare
5a5c2f7 to
60d2a44
Compare
d98268a to
d8abeab
Compare
byrichardpowell
approved these changes
Apr 23, 2026
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
The per-app mechanics delegate to the shared
setup/building blocks (uninstallAppFromStore,deleteAppFromDevDashboard,refreshIfPageError) — same primitives used by per-test teardown. The script adds bulk discovery, pagination, and per-app retry on top.Discovery phase:
completeLoginhelperrefreshIfPageErrorup to 3× as extra resilience on 500/502 (hard-fails after 3 attempts)a[href*=\"/apps/\"]selectorsE2E-)a[href*=\"next_cursor\"];refreshIfPageErrorruns at the top of every iteration so error-page returns throw instead of silently yielding 0 appsUninstall (per app):
{appUrl}/installspage.content())button#nextURLand repeat 2–3 on each pageuninstallAppFromStore(page, slug, appName)— the shared setup helper navigates to the store's/settings/apps, clicks the ⋯ menu → Uninstall → confirm, then reloads and verifies the app is gone. Returnstrueif gone (or already absent),falseif still listed.falseor throws: markallUninstalled = falseand log the store slug + error{appUrl}/installs, scan every row across all pages — any non-empty row → returnfalseallUninstalledDelete (per app):
deleteAppFromDevDashboard(page, appUrl)— the shared setup helper navigates to{appUrl}/settings, clicks Delete app (scroll + reload-once fallback for the button's propagation lag), types "DELETE" if the confirm input is present, clicks confirm, then reloads and returnstrueon 404 (deleted) orfalseotherwise. ThrowsSTILL_HAS_INSTALLSif the Delete button stays disabled after reload (fail-fast signal — retries won't help).falseas "deletion could not be verified" and retry via the outer loop.Per-app retry wrapper:
(N/3) failed: ...), wait, re-navigate to dashboard, retry the full uninstall + delete flowSTILL_HAS_INSTALLSshort-circuits the retry loop → record as skipped(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:
setup/building blocks — single source of truth for per-store uninstall and per-app delete semantics (shared with per-test teardown)refreshIfPageErrorhelper — hard-fails after 3 consecutive 500/502 responsesSTILL_HAS_INSTALLS(fail-fast skip)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 test `finally` blocks.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