|
| 1 | +--- |
| 2 | +name: mobile-e2e |
| 3 | +description: Run apps/mobile Maestro end-to-end tests in this repo. Use when an agent needs to validate mobile auth flows on iOS Simulator or Android Emulator. Current maintained coverage is register, sign out, and sign in. |
| 4 | +disable-model-invocation: true |
| 5 | +allowed-tools: Bash, Read, Write, Edit, Glob, Grep |
| 6 | +--- |
| 7 | + |
| 8 | +# Mobile E2E |
| 9 | + |
| 10 | +Run the mobile Maestro tests for `apps/mobile`. |
| 11 | + |
| 12 | +## Files that matter |
| 13 | + |
| 14 | +- Runner: `apps/mobile/e2e/run-maestro.sh` |
| 15 | +- iOS auth flow: `apps/mobile/e2e/flows/ios/auth.yaml` |
| 16 | +- Android auth flow: `apps/mobile/e2e/flows/android/core.yaml` |
| 17 | +- Shared auth flows: `apps/mobile/e2e/flows/shared/*.yaml` |
| 18 | +- Artifacts: `apps/mobile/e2e/artifacts/` |
| 19 | + |
| 20 | +## Always do first |
| 21 | + |
| 22 | +From repo root: |
| 23 | + |
| 24 | +```bash |
| 25 | +cd apps/mobile |
| 26 | +pnpm run e2e:doctor |
| 27 | +pnpm run typecheck |
| 28 | +``` |
| 29 | + |
| 30 | +## iOS |
| 31 | + |
| 32 | +Use a simulator `.app` build, not an Expo development client. |
| 33 | + |
| 34 | +### Preferred simulator |
| 35 | + |
| 36 | +Prefer the **latest installed iOS runtime** and a **latest-generation iPhone simulator**. |
| 37 | + |
| 38 | +When multiple simulators are available, bias toward the newest iPhone model on the newest installed iOS version. |
| 39 | + |
| 40 | +### Boot simulator |
| 41 | + |
| 42 | +```bash |
| 43 | +xcrun simctl boot <IOS_UDID> |
| 44 | +xcrun simctl bootstatus <IOS_UDID> -b |
| 45 | +open -a Simulator --args -CurrentDeviceUDID <IOS_UDID> |
| 46 | +``` |
| 47 | + |
| 48 | +### App bundle |
| 49 | + |
| 50 | +`run-maestro.sh` can resolve the app bundle from one of these sources: |
| 51 | + |
| 52 | +- `MAESTRO_IOS_APP_PATH` |
| 53 | +- a local `build-*.tar.gz` in `apps/mobile` |
| 54 | +- an existing `DerivedData/.../Release-iphonesimulator/Folo.app` |
| 55 | + |
| 56 | +If none of those exist, build one first. |
| 57 | + |
| 58 | +### Build simulator app when missing |
| 59 | + |
| 60 | +If `Folo.app` is not available yet: |
| 61 | + |
| 62 | +```bash |
| 63 | +cd apps/mobile/ios |
| 64 | +pod install |
| 65 | +xcodebuild -workspace Folo.xcworkspace \ |
| 66 | + -scheme Folo \ |
| 67 | + -configuration Release \ |
| 68 | + -sdk iphonesimulator \ |
| 69 | + -destination 'id=<IOS_UDID>' \ |
| 70 | + build |
| 71 | +``` |
| 72 | + |
| 73 | +### Apple Silicon simulator optimization |
| 74 | + |
| 75 | +When running on an Apple Silicon Mac and building only for the simulator used in the current run, prefer compiling only the active `arm64` simulator architecture: |
| 76 | + |
| 77 | +```bash |
| 78 | +xcodebuild ... \ |
| 79 | + ONLY_ACTIVE_ARCH=YES \ |
| 80 | + ARCHS=arm64 |
| 81 | +``` |
| 82 | + |
| 83 | +Use this optimization only for local self-test / e2e simulator builds tied to the current machine. Do not use it when you need a universal simulator app for other machines or when running on Intel Macs. |
| 84 | + |
| 85 | +Expected output pattern: |
| 86 | + |
| 87 | +```bash |
| 88 | +~/Library/Developer/Xcode/DerivedData/.../Build/Products/Release-iphonesimulator/Folo.app |
| 89 | +``` |
| 90 | + |
| 91 | +### Run iOS auth flow |
| 92 | + |
| 93 | +```bash |
| 94 | +cd apps/mobile |
| 95 | +MAESTRO_IOS_DEVICE_ID=<IOS_UDID> \ |
| 96 | +MAESTRO_IOS_APP_PATH=<PATH_TO_Folo.app> \ |
| 97 | +pnpm run e2e:ios |
| 98 | +``` |
| 99 | + |
| 100 | +## Android |
| 101 | + |
| 102 | +Use a **release APK**, not an Expo development build. |
| 103 | + |
| 104 | +### Java |
| 105 | + |
| 106 | +Use Android Studio bundled JBR: |
| 107 | + |
| 108 | +```bash |
| 109 | +export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" |
| 110 | +export PATH="$JAVA_HOME/bin:$PATH" |
| 111 | +``` |
| 112 | + |
| 113 | +### Android SDK |
| 114 | + |
| 115 | +```bash |
| 116 | +export ANDROID_HOME="$HOME/Library/Android/sdk" |
| 117 | +export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk" |
| 118 | +``` |
| 119 | + |
| 120 | +If `apps/mobile/android/local.properties` is missing, create it with: |
| 121 | + |
| 122 | +```bash |
| 123 | +echo "sdk.dir=$HOME/Library/Android/sdk" > apps/mobile/android/local.properties |
| 124 | +``` |
| 125 | + |
| 126 | +### Build release APK |
| 127 | + |
| 128 | +If `apps/mobile/android` does not exist locally, generate it first with Expo prebuild / run-android tooling. |
| 129 | + |
| 130 | +Then build the release APK: |
| 131 | + |
| 132 | +```bash |
| 133 | +cd apps/mobile/android |
| 134 | +./gradlew app:assembleRelease --console=plain |
| 135 | +``` |
| 136 | + |
| 137 | +Expected APK path: |
| 138 | + |
| 139 | +```bash |
| 140 | +apps/mobile/android/app/build/outputs/apk/release/app-release.apk |
| 141 | +``` |
| 142 | + |
| 143 | +### Install to emulator |
| 144 | + |
| 145 | +```bash |
| 146 | +adb -s emulator-5554 install -r apps/mobile/android/app/build/outputs/apk/release/app-release.apk |
| 147 | +``` |
| 148 | + |
| 149 | +### Run Android auth flow |
| 150 | + |
| 151 | +Start a booted emulator first, then: |
| 152 | + |
| 153 | +```bash |
| 154 | +cd apps/mobile |
| 155 | +pnpm run e2e:android |
| 156 | +``` |
| 157 | + |
| 158 | +## Result checks |
| 159 | + |
| 160 | +Successful auth validation means: |
| 161 | + |
| 162 | +- register flow finishes |
| 163 | +- sign-out reaches `login-screen` |
| 164 | +- login flow makes `login-screen` disappear |
| 165 | + |
| 166 | +## Debugging output |
| 167 | + |
| 168 | +Inspect these folders after a run: |
| 169 | + |
| 170 | +```bash |
| 171 | +apps/mobile/e2e/artifacts/ios/ |
| 172 | +apps/mobile/e2e/artifacts/android/ |
| 173 | +``` |
| 174 | + |
| 175 | +For a one-off focused run, invoke Maestro directly against a single flow and a custom debug directory. |
0 commit comments