freshyo/tests/e2e/subflows/pick-image.yaml
2026-09-15 23:59:59 +05:30

79 lines
2.5 KiB
YAML

appId: ${APP_ID || "in.freshyo.adminui"}
---
# Android system picker adapter.
#
# The picker is OS-level UI in a separate window, so it cannot be targeted with
# app testIDs. Selectors here are system ids/text, and every step is `optional`
# so different OS versions fall through until one matches.
#
# Confirmed from AOSP MediaProvider (activity_photo_picker.xml):
# thumbnail : @id/icon_thumbnail
# confirm : @id/button_add (Button, text "Add", bottom-right)
# The provider package is `com.google.android.providers.media.module` on Google
# Play images and `com.android.providers.media.module` on AOSP images.
- runFlow:
when:
platform: Android
commands:
# Runtime permission prompt (older Android / first launch).
- tapOn:
text: 'Allow'
optional: true
# Select the first thumbnail: Android 13/14 Photo Picker, then the older
# DocumentsUI gallery.
- tapOn:
id: 'com.google.android.providers.media.module:id/icon_thumbnail'
index: 0
optional: true
- tapOn:
id: 'com.android.providers.media.module:id/icon_thumbnail'
index: 0
optional: true
- tapOn:
id: 'com.google.android.documentsui:id/thumbnail'
index: 0
optional: true
- tapOn:
id: 'com.android.documentsui:id/thumbnail'
index: 0
optional: true
- waitForAnimationToEnd
# Confirm the selection by its exact id.
- tapOn:
id: 'com.google.android.providers.media.module:id/button_add'
optional: true
- tapOn:
id: 'com.android.providers.media.module:id/button_add'
optional: true
- tapOn:
id: 'com.google.android.documentsui:id/button_add'
optional: true
# Give the picker a moment to close.
- extendedWaitUntil:
visible:
id: app-root
timeout: 3000
optional: true
# Fallbacks run ONLY while the picker is still open (app root not visible),
# so they can never tap in-app controls like "Add Variant".
- runFlow:
when:
notVisible:
id: app-root
commands:
- tapOn:
text: '.*(Add|Done|Select|Open|OK).*'
optional: true
- tapOn:
point: '90%,92%'
# The picker must be closed before the rest of the flow can continue.
- extendedWaitUntil:
visible:
id: app-root
timeout: 15000