monitoring: GUI-AUTOMATION-NOTES + AUTO_ANDROID/AUTO_GUI flags

Document minimal variant; Linux defaults to Android-only automation;
macOS can enable both ecosystems later via flags.
This commit is contained in:
Hernâni Marques 2026-07-17 21:24:05 +02:00
parent cf349bfdb6
commit 07045ca388
No known key found for this signature in database
6 changed files with 231 additions and 193 deletions

View file

@ -1,187 +1,4 @@
# Automated GUI notes — Android wallet (vanilla level) # Moved
Goal: tests for **two systems** (GOA / hacktivism and stage TESTPAYSAN) that Canonical document: **[GUI-AUTOMATION-NOTES.md](./GUI-AUTOMATION-NOTES.md)**
exercise the wallet **graphically in the UI** as far as practical, not only (minimal variant, platform flags `AUTO_ANDROID` / `AUTO_GUI`, Linux defaults).
CLI/`adb` deep-links into wallet-core.
## Vanilla level (this tree)
| Layer | What we do | Tooling |
|-------|------------|---------|
| **A — Install** | Install published F-Droid APK **or** APK built from `taler-android` master | `adb install` |
| **B — Entry (shortcut)** | Deliver withdraw / pay as `taler://…` intents | `adb shell am start -a VIEW -d …` |
| **C — Graphical UI** | Dump hierarchy, tap Confirm / ToS / Pay-like buttons, dismiss ANR | `uiautomator dump` + `input tap` (`lib_ui.py`) |
| **D — Evidence** | Screenshots + UI XML + logcat + JSON status | `android-test/out-gui/` |
Scripts:
| Script | Role |
|--------|------|
| `run-android-pay-smoke.sh` | Install + deep-link + light taps (hybrid / CLI-heavy) |
| `run-android-gui-smoke.sh` | **Vanilla GUI path**: deep-link entry + multi-round UI driving |
| `run-android-build-and-smoke.sh` | Build latest source APK → same smoke (set `GUI=1` to call GUI script) |
| `lib_ui.py` | Shared dump/tap/ANR helpers |
```bash
cd scripts/taler-monitoring/android-test
# Published APK, graphical drive, both stacks
STACK=goa ./run-android-gui-smoke.sh
STACK=stage ./run-android-gui-smoke.sh
# From-source APK + GUI
APK_PATH=~/taler/taler-android/wallet/build/outputs/apk/fdroid/debug/wallet-fdroid-debug.apk \
PKG=net.taler.wallet.fdroid.debug \
STACK=goa ./run-android-gui-smoke.sh
```
## Legitimate shortcuts (document, do not hide)
These are **not** full human UX, but they are the same contracts as QR scan /
paywall open on the landings:
| Shortcut | Replaces | Why legitimate |
|----------|----------|----------------|
| `adb` `VIEW` `taler://withdraw/…` | Camera QR scan of communal / demo withdraw | Identical URI payload as landings (`demo-withdraw.json`) |
| `adb` `VIEW` `taler://pay…` / `pay-template/…` | Scan shop/paywall QR or open “pay with Taler” | Same URI merchant/backend would show |
| Host-side `POST …/templates/{id}` then pay URI | Browser shop UI to create order | Stage farmer templates are public; order create is API, pay is still wallet UI |
| Multi-language label list for taps | Human reading the button | Same visible buttons; brittle if copy changes |
| Skip full ToS reading | User scrolling long TOS | Tap “Accept” if shown; no legal review automation |
**Not automated yet (out of vanilla scope):**
- Typing personal bank passwords into the wallet webview
- NFC
- Real camera / vision-based QR
- Biometric unlock
- Full onboarding wizard every time (we force-stop + re-intent)
## Two systems under test
| Stack | Withdraw source | Pay source |
|-------|-----------------|------------|
| **GOA** (`STACK=goa`) | `https://bank.hacktivism.ch/intro/demo-withdraw.json` | `taler://pay-template/taler.hacktivism.ch/instances/goa-shop/paivana` (Paivana) |
| **stage** (`STACK=stage`) | `https://stage.bank.lefrancpaysan.ch/intro/demo-withdraw.json` | Public template e.g. `fermes-des-collines` / `panier-legumes``taler://pay/…` |
Both use the **same** GUI driver (`lib_ui.py`); only URLs and package under test differ.
## GUI driver behaviour (`lib_ui.gui_drive`)
1. Every round: `uiautomator dump` + optional screencap.
2. If **“System UI isnt responding”** → tap **Wait** (prefer over Close).
3. Else try exact taps on Confirm / Withdraw / Accept / Pay / DE/FR synonyms.
4. Else regex partial match on those words.
5. Repeat `GUI_ROUNDS` times (default 10), `GUI_SLEEP` seconds apart.
Success signals (layered):
- **Intent delivered**`am start` OK
- **wallet-core** — logcat `prepareBankIntegratedWithdrawal` / pay-related ops
- **GUI taps** — non-empty `taps` in `gui-*-status.json`
- **Screenshots** — human-readable progress under `gui-withdraw/` / `gui-pay/`
A run can be “vanilla-partial” if intents + some taps succeed but final
balance/settlement is not asserted (settlement still better covered by
`taler-monitoring.sh e2e` CLI wallet).
## Host limits (clementine, 2026-07)
| Constraint | Effect |
|------------|--------|
| ~3.7GiB RAM | Emulator ANRs; GUI rounds often only dismiss ANR |
| Prefer physical phone or ≥68GiB host | Real Confirm/Pay taps complete more often |
| No root required | User SDK + adb + F-Droid/source APK |
## Relation to CLI e2e
| Suite | Strength |
|-------|----------|
| `taler-monitoring.sh e2e` / `ladder` | Full withdraw+pay **settlement** via `taler-wallet-cli` |
| `run-android-gui-smoke.sh` | **Android app UI** surface for the same stacks |
| Combined | CLI = money path green; GUI = app UX green as far as taps go |
## Upstream: `taler-android` `dev/hernani-inference/*`
Branch name is **`hernani-inference`** (not “inferenced”). Remote:
`git@git.taler.net:taler-android.git`.
| Branch | Relevance for automation |
|--------|---------------------------|
| **`dev/hernani-inference/gui-workflows`** | **Primary:** macOS emulator helpers + **GOA GUI chain** (`scripts/goa-chain-emu.sh`, `docs/gui-workflows.md`, `setup-avds.sh`, `start-emulators.sh`). Deep-link + `uiautomator` text taps + bank API mint + shop templates. |
| **`fix/bank-withdraw-auto-exchange`** | App fix: resolve exchange when bank omits it (needed for GOA withdraw UI). |
| **`fix/withdraw-spinner-fallback`** | App fix: stop endless withdraw spinner (+ OIM UI work). |
| **`experimental-oim` / `experimental-oim-pos`** | Experimental cash denomination UI; optional for demos, not required for chain. |
### Port into this tree (Linux-capable)
| Upstream (gui-workflows) | Here (`android-test/`) |
|--------------------------|-------------------------|
| `goa-chain-emu.sh` | **`run-goa-gui-chain.sh`** (goa + stage, Linux paths, explorer secrets as monitoring ladder) |
| `tap_text` / `click_through` | same idea in chain + `lib_ui.py` |
| `mint_withdraw` explorer API | same (Basic → token → POST withdrawals) |
| `mint_pay` public templates | same (goa-shop products / stage fermes templates) |
| `android-env.sh` Homebrew | use `$HOME/Android/Sdk` + system `adb` (see GIT-AUTOMATION-NOTES) |
| macOS-only docs | **Linux supported** for chain/smoke; AVD setup still DIY on Linux |
Open issues mirrored from upstream `ISSUES.md` (gui-workflows):
- **I-and-gui-001** — taps still best-effort; ToS/confirm may need human
- **I-and-gui-003**`EXP_PW_FILE` required for mint
- **I-and-gui-004** — emulator RAM cost (this host ~3.7GiB)
- **I-and-gui-007** — for reliable withdraw GUI, build/install app from **fix/bank-withdraw-auto-exchange** or **fix/withdraw-spinner-fallback**, not plain master alone
### Ground rule (ops)
1. **Bring it to run** first (scripts + live stack).
2. **App code changes only if needed**, and **minimal**.
3. Prefer **existing** `dev/hernani-inference/*` branches over new ones; extend them rather than forking random trees.
### Recommended demo stack (2026-07)
```text
1) taler-android checkout:
dev/hernani-inference/fix-bank-withdraw-auto-exchange
(or fix/withdraw-spinner-fallback for spinner + OIM)
2) ./gradlew :wallet:assembleFdroidDebug # package net.taler.wallet.fdroid.debug
3) Boot emulator / phone (prefer ≥68GiB host RAM; 4GiB → System UI ANR)
4) android-test/run-goa-gui-chain.sh # STACK=goa|stage
```
`run-android-build-and-smoke.sh` defaults `BRANCH=dev/hernani-inference/fix-bank-withdraw-auto-exchange`
so source smokes pick up the GOA exchange auto-add fix without manual checkout.
### Runtime note (clementine)
On ~3.7GiB hosts the emulator often shows **System UI isnt responding** before Confirm is tappable. Chain script now prioritizes **Wait** over hunting Confirm. For a green end-to-end GUI path use a physical device or more RAM — the **mint + deep-link + fix-branch APK** path is otherwise ready.
```bash
# GOA chain (explorer mint + GUI taps)
EXP_PW_FILE=$HOME/src/koopa/koopa-admin-secrets/koopa/host-root/taler-bank/bank-explorer-password.txt \
STACK=goa PKG=net.taler.wallet.fdroid.debug \
./run-goa-gui-chain.sh
# Stage TESTPAYSAN (explorer via stagepaysan SSH if EXP_PW_FILE unset)
STACK=stage ./run-goa-gui-chain.sh
```
## Future upgrades (not required for vanilla)
- Maestro / Appium flows with stable resource-ids
- Explicit wait for text “Withdrawal complete” / balance
- Port Paivana unlock scripts (upstream I-and-gui-002)
- Dual AVD wallet+POS (upstream I-and-gui-008)
- Record video (`adb shell screenrecord`) on failure
## Checklist — “vanille erreicht?”
- [x] Two stacks parameterized (goa / stage)
- [x] Published APK path
- [x] Source-build path (same smoke after build)
- [x] Deep-link shortcuts documented
- [x] Multi-round **graphical** taps (uiautomator)
- [x] GOA-style **chain** (multi withdraw + multi pay) from inference branch
- [x] Screenshots + UI XML + logcat artifacts
- [x] Inference branch mapping documented
- [ ] Fully reliable unattended Confirm→settled on low-RAM emulator (host-limited)
- [ ] App built from withdraw-fix branch by default in build script (optional)
- [ ] Assert final balance in app UI (optional next step)

View file

@ -0,0 +1,179 @@
# GUI automation notes (Android wallet)
Canonical notes for **graphical** Android wallet tests against GOA / stage.
Older name `AUTOMATED-GUI-NOTES.md` redirects here.
---
## Minimal variant (implemented first) — status 2026-07
This is the **minimal vanilla** path we actually shipped; full dual-platform
GUI is planned via flags (below), not required to use these scripts today.
| Piece | Status | Notes |
|-------|--------|--------|
| F-Droid published APK install | **done** | `net.taler.wallet.fdroid` 1.6.1 / 854 |
| Source build + same smoke | **done** | `:wallet:assembleFdroidDebug``net.taler.wallet.fdroid.debug` |
| Default source branch | **done** | `dev/hernani-inference/fix-bank-withdraw-auto-exchange` (minimal GOA exchange auto-add) |
| Deep-link entry (≡ QR) | **done** | `adb` `VIEW` `taler://withdraw/…` / `taler://pay…` |
| Explorer API mint (chain) | **done** | `run-goa-gui-chain.sh` (GOA + stage) |
| UI taps via uiautomator | **done** | best-effort Confirm/ToS/Pay; ANR → prefer **Wait** |
| Screenshots / logcat artifacts | **done** | under `out*`, `out-gui-chain/` (gitignored) |
| Host CLI e2e settlement | **separate** | `taler-monitoring.sh e2e` / `ladder` (not Android UI) |
| Reliable unattended Confirm on 4GiB Linux host | **limited** | System UI ANR; use phone or more RAM |
| iOS GUI | **not in this tree** | see taler-ios `dev/hernani-inference/gui-workflows` |
| macOS full dual AVD helpers | **upstream** | taler-android `gui-workflows` (Homebrew); ported ideas here for Linux |
**Ground rule:** bring it to run; app diffs only if needed and **minimal**; prefer
extending existing `dev/hernani-inference/*` branches over new trees.
```bash
cd scripts/taler-monitoring/android-test
# Minimal hybrid (install + deep-link + light taps)
STACK=goa ./run-android-pay-smoke.sh
# GUI multi-round taps
STACK=goa ./run-android-gui-smoke.sh
STACK=stage ./run-android-gui-smoke.sh
# Explorer mint + multi withdraw/pay chain (from gui-workflows)
EXP_PW_FILE=$HOME/src/koopa/koopa-admin-secrets/koopa/host-root/taler-bank/bank-explorer-password.txt \
STACK=goa PKG=net.taler.wallet.fdroid.debug \
./run-goa-gui-chain.sh
# Build fix-branch APK then smoke (GUI=1 for gui smoke)
./run-android-build-and-smoke.sh
GUI=1 ./run-android-build-and-smoke.sh
```
---
## Platform capability flags (planned + defaults)
Automation can run on hosts that support **Android only**, **GUI tooling only**
(conceptual), or **both**. Flags keep that explicit for CI and laptops.
### Proposed env flags
| Variable | Values | Meaning |
|----------|--------|---------|
| `AUTO_ANDROID` | `0` / `1` | Run Android wallet automation (adb, APK, emulator/device) |
| `AUTO_GUI` | `0` / `1` | Drive **graphical** UI (uiautomator taps, multi-round). If `0`, deep-link/CLI-only install smoke. |
| `AUTO_PLATFORM` | `auto` / `linux` / `macos` / `ios` | Host family (optional override) |
**Semantics:**
| `AUTO_ANDROID` | `AUTO_GUI` | Behaviour |
|----------------|------------|-----------|
| `1` | `0` | Android install + deep-link smoke only (no multi-round taps) |
| `1` | `1` | Android + graphical drive (vanilla GUI / chain) |
| `0` | `1` | Reserved (e.g. future desktop/web GUI); currently **no-op** with a clear message |
| `0` | `0` | Skip mobile automation |
### Defaults by host (when flags unset)
| Host (`uname -s`) | Default `AUTO_ANDROID` | Default `AUTO_GUI` | Rationale |
|-------------------|------------------------|--------------------|-----------|
| **Linux** | **`1`** | **`1`** if device/emulator present, else scripts exit 3 | This repos day-to-day path; **Android only** (no iOS here) |
| **Darwin (macOS)** | `1` | `1` | Can run Android emulators **and** (separately) taler-ios GUI helpers; both flags on for Android scripts; iOS is out of tree |
| **Other** | `0` | `0` | Fail closed |
**Linux default = Android** (no second mobile platform in this suite).
**macOS** may enable both ecosystems in the wider monorepo sense; for *these*
scripts only Android is implemented — set `AUTO_ANDROID=1` (default) and keep
iOS under `taler-ios`.
### Resolution helper (convention for future wrappers)
```bash
# Example for a future run-all-mobile.sh
os=$(uname -s)
: "${AUTO_PLATFORM:=auto}"
case "$AUTO_PLATFORM" in
auto) case "$os" in Linux) AUTO_PLATFORM=linux ;; Darwin) AUTO_PLATFORM=macos ;; *) AUTO_PLATFORM=other ;; esac ;;
esac
case "$AUTO_PLATFORM" in
linux)
: "${AUTO_ANDROID:=1}"
: "${AUTO_GUI:=1}"
# no iOS
;;
macos)
: "${AUTO_ANDROID:=1}"
: "${AUTO_GUI:=1}"
# optional later: AUTO_IOS=1 for taler-ios scripts
;;
*)
: "${AUTO_ANDROID:=0}"
: "${AUTO_GUI:=0}"
;;
esac
```
Scripts **today** implement Android only; they should honour:
- `AUTO_ANDROID=0` → exit 0 with “skipped (AUTO_ANDROID=0)”
- `AUTO_GUI=0` → call deep-link smoke without multi-round GUI (or set `GUI_ROUNDS=0`)
---
## Vanilla layers (detail)
| Layer | What | Tooling |
|-------|------|---------|
| **A — Install** | F-Droid or from-source APK | `adb install` |
| **B — Entry (shortcut)** | `taler://withdraw/…` / `taler://pay…` | `adb am start -a VIEW` |
| **C — Graphical UI** | Confirm / ToS / Pay taps; ANR Wait | `uiautomator` + `lib_ui.py` / chain |
| **D — Evidence** | Screenshots, XML, logcat, URIs | `out*/` |
### Legitimate shortcuts
| Shortcut | Replaces |
|----------|----------|
| Deep-link withdraw/pay | Camera QR / opening paywall |
| Host `POST` template → pay URI | Browser shop checkout UI |
| Label-list taps | Human reading button text |
| Skip full ToS scroll | Tap Accept if shown |
### Scripts
| Script | Role |
|--------|------|
| `run-android-pay-smoke.sh` | Hybrid: install + deep-link + light taps |
| `run-android-gui-smoke.sh` | Multi-round GUI drive |
| `run-goa-gui-chain.sh` | Multi mint/withdraw/pay (gui-workflows port) |
| `run-android-build-and-smoke.sh` | Build inference fix branch + smoke (`GUI=1` optional) |
| `lib_ui.py` | Dump/tap/ANR helpers |
---
## Stacks under test
| Stack | Withdraw | Pay |
|-------|----------|-----|
| **GOA** | explorer mint / `demo-withdraw.json` @ bank.hacktivism.ch | goa-shop templates / Paivana pay-template |
| **stage** | explorer / demo-withdraw @ stage.bank… | fermes / jardin public templates |
---
## Upstream branches (`taler-android` `dev/hernani-inference/*`)
| Branch | Role |
|--------|------|
| `gui-workflows` | macOS emulator helpers + original `goa-chain-emu.sh` |
| `fix/bank-withdraw-auto-exchange` | **Minimal** GOA exchange auto-add (default build branch) |
| `fix/withdraw-spinner-fallback` | Spinner + OIM; use if spinner still hangs |
| `experimental-oim*` | Optional cash UI |
---
## Checklist
- [x] Minimal variant documented
- [x] Two stacks (goa / stage)
- [x] Flags design (`AUTO_ANDROID` / `AUTO_GUI` / platform defaults)
- [x] Linux default = Android suite only
- [x] Inference-branch policy
- [ ] Wrapper enforces flags in every entry script (incremental)
- [ ] Reliable unattended Confirm on low-RAM Linux emulator

View file

@ -51,6 +51,13 @@ EXP_PW_FILE=$HOME/src/koopa/koopa-admin-secrets/koopa/host-root/taler-bank/bank-
STACK=stage ./run-goa-gui-chain.sh STACK=stage ./run-goa-gui-chain.sh
``` ```
Documented shortcuts, inference branches, limits: **[AUTOMATED-GUI-NOTES.md](./AUTOMATED-GUI-NOTES.md)**. Canonical notes (minimal variant, **flags**, Linux defaults):
**[GUI-AUTOMATION-NOTES.md](./GUI-AUTOMATION-NOTES.md)**.
| Flag | Linux default | Meaning |
|------|---------------|---------|
| `AUTO_ANDROID` | `1` | Run Android adb/APK automation |
| `AUTO_GUI` | `1` | Graphical uiautomator drive (else deep-link only) |
| `AUTO_PLATFORM` | `auto``linux` | Host family; macOS can later pair with iOS out of tree |
See also parent [GIT-AUTOMATION-NOTES.md](../GIT-AUTOMATION-NOTES.md). See also parent [GIT-AUTOMATION-NOTES.md](../GIT-AUTOMATION-NOTES.md).

View file

@ -8,12 +8,23 @@
# Systems: STACK=goa | stage | auto # Systems: STACK=goa | stage | auto
# APK: published F-Droid or APK_PATH=… (from-source) # APK: published F-Droid or APK_PATH=… (from-source)
# #
# See AUTOMATED-GUI-NOTES.md # See GUI-AUTOMATION-NOTES.md
# #
set -euo pipefail set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd) ROOT=$(cd "$(dirname "$0")" && pwd)
# shellcheck source=run-android-pay-smoke.sh
# We re-use install/URI resolution by calling common pieces inline. # Platform flags (GUI-AUTOMATION-NOTES.md). Linux → Android only.
os=$(uname -s)
case "${AUTO_PLATFORM:-auto}" in
auto) case "$os" in Linux|Darwin) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; *) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;; esac ;;
linux|macos) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
*) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;;
esac
[ "${AUTO_ANDROID}" = "1" ] || { echo "skipped: AUTO_ANDROID=${AUTO_ANDROID}"; exit 0; }
if [ "${AUTO_GUI}" != "1" ]; then
echo "AUTO_GUI=0 → deep-link smoke only"
exec env AUTO_ANDROID=1 "$ROOT/run-android-pay-smoke.sh"
fi
export OUT_DIR="${OUT_DIR:-$ROOT/out-gui}" export OUT_DIR="${OUT_DIR:-$ROOT/out-gui}"
export GUI_ROUNDS="${GUI_ROUNDS:-10}" export GUI_ROUNDS="${GUI_ROUNDS:-10}"
@ -169,4 +180,4 @@ else
fi fi
echo "artifacts: $OUT_DIR/" echo "artifacts: $OUT_DIR/"
ls -la "$OUT_DIR" | sed 's/^/ /' ls -la "$OUT_DIR" | sed 's/^/ /'
echo "Documented shortcuts → AUTOMATED-GUI-NOTES.md" echo "Documented shortcuts → GUI-AUTOMATION-NOTES.md"

View file

@ -20,6 +20,20 @@
# #
set -euo pipefail set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd) ROOT=$(cd "$(dirname "$0")" && pwd)
# Platform flags (see GUI-AUTOMATION-NOTES.md). Linux default: Android only.
os=$(uname -s)
case "${AUTO_PLATFORM:-auto}" in
auto) case "$os" in Linux) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; Darwin) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; *) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;; esac ;;
linux) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
macos) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
*) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;;
esac
if [ "${AUTO_ANDROID}" != "1" ]; then
echo "skipped: AUTO_ANDROID=${AUTO_ANDROID} (platform flags — see GUI-AUTOMATION-NOTES.md)"
exit 0
fi
APK_DIR="${APK_DIR:-$ROOT/apks}" APK_DIR="${APK_DIR:-$ROOT/apks}"
APK_URL="${APK_URL:-https://f-droid.org/repo/net.taler.wallet.fdroid_854.apk}" APK_URL="${APK_URL:-https://f-droid.org/repo/net.taler.wallet.fdroid_854.apk}"
APK_NAME="${APK_NAME:-net.taler.wallet.fdroid_854.apk}" APK_NAME="${APK_NAME:-net.taler.wallet.fdroid_854.apk}"

View file

@ -19,7 +19,7 @@
# Env: ANDROID_SERIAL, PKG, EXP_PW_FILE, BANK, MERCHANT, INSTANCE, # Env: ANDROID_SERIAL, PKG, EXP_PW_FILE, BANK, MERCHANT, INSTANCE,
# WITHDRAW_AMOUNTS, PRODUCTS, PAY_LIMIT, SHOTDIR, PAUSE # WITHDRAW_AMOUNTS, PRODUCTS, PAY_LIMIT, SHOTDIR, PAUSE
# #
# See AUTOMATED-GUI-NOTES.md § "hernani-inference branches" # See GUI-AUTOMATION-NOTES.md
# #
set -euo pipefail set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd) ROOT=$(cd "$(dirname "$0")" && pwd)
@ -37,6 +37,16 @@ step() { echo; echo "======== $* ========"; }
info() { echo " $*"; } info() { echo " $*"; }
pause() { sleep "${1:-${PAUSE:-0.8}}"; } pause() { sleep "${1:-${PAUSE:-0.8}}"; }
# Platform flags — Linux default Android+GUI (see GUI-AUTOMATION-NOTES.md)
os=$(uname -s)
case "${AUTO_PLATFORM:-auto}" in
auto) case "$os" in Linux|Darwin) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; *) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;; esac ;;
linux|macos) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
*) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;;
esac
[ "${AUTO_ANDROID}" = "1" ] || { echo "skipped: AUTO_ANDROID=${AUTO_ANDROID}"; exit 0; }
[ "${AUTO_GUI}" = "1" ] || { echo "skipped: AUTO_GUI=${AUTO_GUI} (chain is GUI)"; exit 0; }
if ! command -v adb >/dev/null 2>&1; then if ! command -v adb >/dev/null 2>&1; then
[ -x "$HOME/Android/Sdk/platform-tools/adb" ] && export PATH="$HOME/Android/Sdk/platform-tools:$PATH" [ -x "$HOME/Android/Sdk/platform-tools/adb" ] && export PATH="$HOME/Android/Sdk/platform-tools:$PATH"
fi fi
@ -361,4 +371,4 @@ step "4 done → $SHOTDIR"
ls -la "$SHOTDIR" | tail -40 ls -la "$SHOTDIR" | tail -40
adb_sh dumpsys window 2>/dev/null | grep mCurrentFocus | head -1 || true adb_sh dumpsys window 2>/dev/null | grep mCurrentFocus | head -1 || true
info "PKG=$PKG amounts=${AMOUNTS[*]} pays(limit)=$PAY_LIMIT" info "PKG=$PKG amounts=${AMOUNTS[*]} pays(limit)=$PAY_LIMIT"
echo "See AUTOMATED-GUI-NOTES.md (ported from taler-android dev/hernani-inference/gui-workflows)" echo "See GUI-AUTOMATION-NOTES.md (ported from taler-android dev/hernani-inference/gui-workflows)"