clearState
Clear app data, cache, and preferences to reset to a fresh install state.
Clears all data for a specified mobile application.
Usage examples
To clear the state of the current app, use add the clearState command alone.
- clearStateIf you want to clear the state of a specific app by its ID, add the app ID:
- clearState: app.idYou can also add a label when invoking clearState to improve the readability of the report.
- clearState:
appId: app.id
label: Reset ExampleAppPlatform-specific behavior
The command's behavior differs based on the mobile operating system.
Android
On Android, the clearState command is equivalent to running:
adb shell pm clear {package name}It removes all app-related data from the device, such as shared preferences, databases, and accounts.
iOS
On iOS, the clearState command causes the runner to reinstall the entire app (on an iOS device, from the build in use in Astra Scout), resulting in a completely fresh install and removing all existing data folders.
As described in Stack Overflow discussion, it's also possible to xcrun simctl to perform the same action.
