installApp, removeApp, clearAppData
Installs, uninstalls, or resets the data of the app under test.
Functions
| function | description |
|---|---|
installApp(appPackageFile?) |
Installs the app (iOS: .app, Android: .apk or .apks; .apks needs bundletool on the Mac). Without appPackageFile, the app profile's <platform>.appPath (the app profile that the run profile's app points to) is used (an explicit path always wins over the profile). |
removeApp(appID?) |
Uninstalls the app. appID defaults the same way as launchApp()'s appID when omitted. |
clearAppData(appID?) |
Keeps the app installed but clears its data and permissions, so onboarding and permission dialogs reappear. appID defaults the same way as launchApp()'s appID. |
Example
installApp() // path from the app profile's appPath
launchApp() // on iOS in `inapp-boost` mode, call it right after install
installApp("/path/to/MyApp.app")
clearAppData() // back to a first-run state
removeApp()
Notes
- On iOS in the default
inapp-boostmode, calllaunchApp()right afterinstallApp(). The install ends the bridge inside the app, and operations such astapdo not reach the app until the nextlaunchApp()reinjects it (the step carries the notethe in-app bridge will be reinjected on the next launchApp()). - Reinstalling does not restore permissions. On an iOS Simulator, uninstalling and
reinstalling an app leaves TCC permissions (location, etc.) granted, and the permission
dialogs do not reappear. A scenario that assumes "reinstall = first-run state" will not see
them — use
clearAppData()instead. clearAppData()also resets permissions (iOS TCC / Android runtime permissions) back to not-granted, so permission dialogs appear again. This is the command to reach for when testing onboarding or first-run permission flows.- A physical iPhone has no way to clear only the app's data, so
clearAppData()reinstalls the app there (it takes as long as an install; notereinstalled-to-clear-data). Set a device build in the app profile'sappPathPhysicalas the source to reinstall from, and run with--profile. If it cannot reinstall — no source, a different app (another bundle ID), or a Simulator build (which a physical device rejects) — it fails without uninstalling. clearAppData()clearsNSUserDefaults/SharedPreferences, but does not clear the Keychain (iOS) / Keystore (Android). If an app stores its "has been onboarded" flag there, first-run cannot be reproduced this way.- fleetest's own bridge cannot be the target. Passing the bridge's ID (Android
com.example.ftbridge, or the iOS runner whose ID ends in.ftrunner,.ftrunner.uitestsor.ftrunner.uitests.xctrunner) toremoveApp/clearAppDatafails without sending anything — removing or wiping it would stop the bridge the run drives the device through. - Removing the app under test breaks the rest of the run — call
removeApp()on your own test target only when you mean to end the scenario there. - On Android (physical devices and Emulators alike),
adb installverification (Play Protect's "Send app for a security check?") is turned off for the duration of the install and the device setting is restored afterwards. The app under test is never sent to Google (with verification on, a release-signed APK leavesadb installblocked on that dialog — on an Emulator with Google Play just the same). SetplayProtectBypassin the run profile to false (default true) to stop this.