Skip to content

E2E: Cleanup scripts for leftover test resources #7319

@phyllis-sy-wu

Description

@phyllis-sy-wu

Problem:

E2E tests create apps and dev stores that sometimes fail to be torn down (500 errors, timeouts, CI cancellation). These leftovers accumulate and need to be cleaned up periodically.

Proposed solution:

Two standalone scripts that use browser automation to find and remove leftover resources:

  • cleanup-apps.ts — Finds apps matching E2E- prefix on the dev dashboard, uninstalls from all stores, and deletes them
  • cleanup-stores.ts — Finds stores matching e2e-w prefix, uninstalls all apps, and deletes the stores

Modes:

  • --list — List matching resources without action
  • --delete — Delete only resources with 0 installs/apps
  • --headed — Show browser window for debugging
  • --pattern X — Custom name pattern match

Usage:

npx tsx packages/e2e/scripts/cleanup-stores.ts --list
npx tsx packages/e2e/scripts/cleanup-apps.ts --list
# Full cleanup: stores first, then apps
pnpm test:e2e-cleanup

Implementation notes:

  • Scripts handle dashboard pagination for both app discovery and store admin apps page
  • Reuses dismissDevConsole and completeLogin from existing test infra
  • Stores should be cleaned before apps (uninstall from stores first, then delete apps)
  • Could later be integrated into CI as a post-test step (see E2E: Auto-cleanup leftover resources if teardown failures #7318)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions