Test prep tools¶
Prepare a repeatable device and app state before running a flow. These tools are useful for fixtures, localization, permissions, and system state.
App files¶
Use putAppFile to write text, base64, or a host file into an app container:
{
"name": "putAppFile",
"arguments": {
"platform": "android",
"target": {
"domain": "app_containers",
"appId": "com.example.app",
"container": "documents"
},
"files": [
{
"destinationPath": "fixtures/settings.json",
"contentText": "{\"enabled\":true}"
}
]
}
}
Locale and device state¶
changeLocalizationsets language, region, time zone, and formatting for a device. Set the locale before launching the app.setDeviceStateconfigures supported system state such as biometric enrollment.biometricAuthsimulates a match or failure on supported emulators and iOS simulators.wakeAndUnlockwakes an Android device and unlocks it with an optional PIN.postNotificationcreates a notification for notification-flow tests.clipboardsets, reads, pastes, or clears clipboard content.
For a clean app start, use launchApp with clearAppData: true where the
platform supports it. Use observe after preparation to confirm the expected
state before continuing.
Device snapshots¶
Enable deviceSnapshot for the current connection, then capture a known-good
state before a destructive flow:
{
"name": "setToolEnabled",
"arguments": { "toolName": "deviceSnapshot", "enabled": true }
}
{
"name": "deviceSnapshot",
"arguments": {
"action": "capture",
"snapshotName": "signed-in",
"platform": "android",
"includeAppData": true,
"includeSettings": true
}
}
Android emulators can restore full VM snapshots. iOS simulators back up the specified app containers, so an iOS capture that includes app data must list the bundle IDs:
{
"name": "deviceSnapshot",
"arguments": {
"action": "capture",
"snapshotName": "signed-in",
"platform": "ios",
"appBundleIds": ["com.example.app"],
"includeAppData": true,
"includeSettings": true
}
}
For an iOS settings-only capture, set includeAppData to false. Physical
Android devices restore settings only. Restore with action: "restore" and the
same snapshotName.