Detox icon indicating copy to clipboard operation
Detox copied to clipboard

device.resetAppState([bundleId])

Open noomorph opened this issue 6 months ago • 0 comments

Describe your idea

Proposal

Introduce a method:

await device.resetAppState(optionalBundleId);

This will:

  • iOS (simulator): Use xcrun simctl get_app_container to locate the installed .app, back it up, uninstall the app, then reinstall from the backup — all without triggering a Detox build.

  • Android (emulator): Either:

    • Use adb shell pm clear <package> if sufficient
    • Or: back up the APK path via adb shell pm path, uninstall, and reinstall with adb install, avoiding any Detox-managed build artifacts.

This enables full app state reset without rebuild. Faster, cleaner, reusable in both CI and local dev.

noomorph avatar May 21 '25 15:05 noomorph