Files
pezkuwi-wallet-android/.github/scripts/smoke-test.sh
T
SatoshiQaziMuhammed 5a6eb62a1b ci(release): smoke-test the release APK on an emulator, drop the BrowserStack trigger (#25)
* ci(release): smoke-test the release APK on an emulator, drop the BrowserStack trigger

The release workflow ended by triggering BrowserStack tests in
appium-mobile-tests with a personal token. The token expired on 2026-10-17, so
every release build since is red, and the BrowserStack run behind it had never
produced a result (it fails uploading the app, KeyError 'app_url', since
2026-08-03). Its tests mostly asserted nothing.

In its place, every release build now installs the APK on an x86_64 API 34
emulator on a GitHub-hosted runner, launches it, and fails unless the
first-run welcome screen appears with both its create and restore buttons and
the app has neither crashed nor exited. The screen is matched by view id, so
it holds in any locale. A screenshot, the view tree and logcat are kept as an
artifact. It needs no account and no stored secret, and it can be run by hand
against the APK of an earlier run.

* ci: run the emulator smoke test on pull requests that change it, against main's latest release APK

* TEMP: nail check, expect red

* Revert "TEMP: nail check, expect red"

This reverts commit 7f804317b4.
2026-10-18 19:23:15 +04:00

40 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Installs a release APK on the running emulator, launches it and waits for the
# first-run welcome screen. Fails if the app crashes, dies, or never shows the
# screen. Matches the screen by view id, not text, so it holds in any locale.
set -euo pipefail
APK="$1"
PKG="io.pezkuwichain.wallet"
OUT="${SMOKE_OUT:-smoke-out}"
TIMEOUT=120
mkdir -p "$OUT"
fail() {
echo "::error::$1"
adb exec-out screencap -p > "$OUT/screen.png" || true
adb shell uiautomator dump /sdcard/ui.xml >/dev/null 2>&1 && adb pull /sdcard/ui.xml "$OUT/ui.xml" >/dev/null || true
adb logcat -d > "$OUT/logcat.txt" || true
exit 1
}
adb install -r "$APK" >/dev/null || fail "install failed"
adb logcat -c
adb shell monkey -p "$PKG" -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1 || fail "launch failed"
for _ in $(seq 1 $((TIMEOUT / 3))); do
sleep 3
if adb logcat -d -b crash | grep -q "Process: $PKG"; then
fail "the app crashed on launch"
fi
adb shell pidof "$PKG" >/dev/null || fail "the app process is gone"
adb shell uiautomator dump /sdcard/ui.xml >/dev/null 2>&1 || continue
if adb exec-out cat /sdcard/ui.xml | grep -q "$PKG:id/welcomeCreateWalletButton" &&
adb exec-out cat /sdcard/ui.xml | grep -q "$PKG:id/welcomeRestoreWalletButton"; then
echo "welcome screen shown, both create and restore buttons present"
adb exec-out screencap -p > "$OUT/screen.png" || true
exit 0
fi
done
fail "the welcome screen did not appear within ${TIMEOUT}s"