Describe the bug
Launching an app with clearState or calling clearState directly doesn't reliably clear UserDefaults in an iOS app.
To Reproduce
- Write a value to
UserDefaults in an iOS app.
- Quit the app
- Launch an app with maestro using
- launchApp:
appId: "com.example.app"
clearState: true
or -clearState followed by -launchApp
4. Observe that UserDefaults still contains the previously written value.
Expected behavior
userDefaults should be cleared and the app should be launched as though it had not been used previously
Environment information (please complete the following information):
- Maestro version: 1.34.1
- Platform: iOS 17.0.1
- Framework: Native iOS
- Device model and OS version: iPhone 15 iOS 17.0.1
- Simulator
- Host: Mac M1
Workspace (if applicable)
MaestroUserDefaultsTestApp.zip
Additional context
A workaround I've found is using -clearState before running launchApp with the clearState option set to true as far as I can tell this should delete everything twice which seems to ensure that the app is fairly reliably launched with a completely clear state.
Describe the bug
Launching an app with
clearStateor callingclearStatedirectly doesn't reliably clearUserDefaultsin an iOS app.To Reproduce
UserDefaultsin an iOS app.or
-clearStatefollowed by-launchApp4. Observe that
UserDefaultsstill contains the previously written value.Expected behavior
userDefaultsshould be cleared and the app should be launched as though it had not been used previouslyEnvironment information (please complete the following information):
Workspace (if applicable)
MaestroUserDefaultsTestApp.zip
Additional context
A workaround I've found is using
-clearStatebefore runninglaunchAppwith theclearStateoption set totrueas far as I can tell this should delete everything twice which seems to ensure that the app is fairly reliably launched with a completely clear state.