Add android e2e setup + simulator run iOS e2e#546
Conversation
…into beast/add-android-e2e-setup
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7c38e21. Configure here.
| xcrun simctl list devices available 2>/dev/null \ | ||
| | grep -F " $name (" \ | ||
| | tail -1 \ | ||
| | sed -E 's/^[[:space:]]+[^(]+ \(([A-F0-9-]+)\).*/\1/' |
There was a problem hiding this comment.
Wrong simulator runtime selected
Medium Severity
When several runtimes define the same simulator name, simulator_udid_for_name uses tail -1 on matching lines, which picks the last runtime block in simctl output. That usually maps to an older iOS runtime, not the newest one the comment describes, so -s can boot the wrong UDID and E2E runs on an unintended OS version.
Reviewed by Cursor Bugbot for commit 7c38e21. Configure here.
| exit 1 | ||
| fi | ||
| start_emulator "$AVD_NAME" | ||
| fi |
There was a problem hiding this comment.
Reused emulator skips boot wait
Medium Severity
If a running emulator is auto-selected or chosen with -d, the script never calls wait_for_emulator_boot, unlike the path that starts a new AVD. Patrol can start while sys.boot_completed is still unset, leading to flaky or failed instrumentation runs.
Reviewed by Cursor Bugbot for commit 7c38e21. Configure here.
n13
left a comment
There was a problem hiding this comment.
Review
Solid, well-documented E2E addition. The Android native Patrol wiring is correct (PatrolJUnitRunner + clearPackageData + AndroidX Orchestrator + parameterized MainActivityTest), package placement matches applicationId/patrol android.package_name (com.quantus.wallet), MainActivity import from the namespace package is right, .env.test is already gitignored, and the empty-array expansions correctly guard set -u on macOS Bash 3.2.
Requesting changes for two confirmed correctness bugs + a DRY concern before merge.
Correctness (agree with Bugbot)
-
Android reused emulator skips boot wait (
patrol_android_emulator.sh).wait_for_emulator_bootonly runs when a fresh AVD is booted. When an emulator is auto-selected or passed with-d, it's skipped.adb devicesreportsdevicebeforesys.boot_completed=1, so Patrol can start against a not-fully-booted emulator → flaky runs. Fix (also a DRY win): callwait_for_emulator_boot "$DEVICE_SERIAL"once after the serial is resolved, on every path. -
iOS wrong runtime selected (
patrol_ios_simulator.sh).simulator_udid_for_nameusestail -1, but the comment claims "prefer the newest runtime" —simctl list devicessection ordering isn't guaranteed, so-scan boot the wrong OS version (same non-determinism indefault_simulator_name). More robust: parsexcrun simctl list devices available -jand pick the highest runtime version.
DRY (repo rule)
The three patrol scripts now triplicate large verbatim blocks: the .env.test/TEST_IMPORT_MNEMONIC → DART_DEFINES block (~16 lines), the TARGET_ARGS builder, SCRIPT_DIR/APP_ROOT resolution, and the common arg-parse loop. Recommend extracting scripts/lib/patrol_common.sh (e.g. patrol_resolve_app_root, patrol_collect_dart_defines, patrol_build_target_args) sourced by all three scripts.
Minor nits
- Stale comment in
MainActivityTest.java: "...run/filtered individually by xcodebuild's Android equivalent (the orchestrator)" — "xcodebuild" is an iOS copy-paste leftover. patrol_ios_simulator.shpassesPATROL_DEVICE="${DEVICE_LABEL:-$DEVICE_ID}", preferring the possibly-ambiguous name over the already-resolved UDID; passing$DEVICE_IDis unambiguous when duplicate names exist.
Verdict: Request changes — prioritize the Android boot-wait fix and the DRY extraction; the iOS runtime selection and nits are quick follow-ups.


Summary
Added android emu and ios simu e2e test scripts.
The commit history shown here is buggy because I extend from other PR that already merged to main then I pull main to this branch. But the files changed should be correct. We can ignore and it will resolve it properly. Like how sometimes we have it before.
Note
Low Risk
Changes are limited to test automation (Gradle test runner settings, androidTest stub, and dev scripts); production app behavior is unaffected aside from standard instrumentation test dependencies.
Overview
Adds Patrol-native Android E2E wiring so
patrol_test/Dart tests run as instrumentation tests:PatrolJUnitRunner,clearPackageDatabetween runs, AndroidX Test Orchestrator, and a parameterizedMainActivityTestthat lists and runs each Dart test.Introduces
patrol_android_emulator.shandpatrol_ios_simulator.shfor local runs—auto-pick or boot an emulator/simulator, optional single-file or full-suite targets, debug/release builds, and test secrets via.env.testorTEST_IMPORT_MNEMONIC(--dart-define, not bundled assets). Both invokepatrol testin one step (unlike the existing physical-iOS device script).Reviewed by Cursor Bugbot for commit 7c38e21. Configure here.