Reset device state (Android)
Automate the Android Files app to purge stale media and downloads. Ensure a clean device state for every test run to prevent false results.
The workflow
1. Cleanup Flow
# clean_device_android.yaml
# Strategy: Use the native Files app to remove Images and Downloads.
# Step 1: Launch the Files app
- pressKey: home
- swipe:
direction: UP
- tapOn: Files
# Step 2: Delete images
- tapOn: Show roots # The hamburger menu
- tapOn:
text: Images
index: 1 # Skips the filter chip on the main page
- tapOn: Pictures
# Step 3: Conditional cleanup
# Only proceed if thumbnails (icon_thumb) are visible.
- runFlow:
when:
visible:
id: "com.google.android.documentsui:id/icon_thumb"
commands:
- tapOn: More options
- tapOn: Select all
- tapOn: Delete
- tapOn: OK
# Step 4: Delete downloads
- tapOn: Show roots
- tapOn: Downloads
- runFlow:
when:
visible:
id: "com.google.android.documentsui:id/icon_thumb"
commands:
- tapOn: More options
- tapOn: Select all
- tapOn: Delete
- tapOn: OK2. Implementation
Related content
Last updated