Mobile Tests in CI
TestFly's own workflow, .github/workflows/mobile-emulator-smoke.yml (Mobile Emulator Smoke), is a working template. It runs on pushes to development that touch the mobile code or examples, and on demand. It never gates the main CI workflow.
| Job | Runner | What it does |
|---|---|---|
| Android emulator smoke (API 30, 34) | ubuntu-latest with KVM | boots an emulator with reactivecircus/android-emulator-runner, runs scripts/ci/android-mobile-smoke.sh |
| iOS simulator smoke | macos-latest | boots an iPhone simulator, runs scripts/ci/ios-mobile-smoke.sh |
Steps of a job
-
Java 21 and Node;
npm install -g [email protected](pin the version you tested with). -
Build:
mvn -DskipTests install. -
Boot the device. Android: enable KVM, then the emulator runner with
disable-animations: true. iOS:xcrun simctl boot <udid>andxcrun simctl bootstatus <udid> -b. -
Start mobilecli and wait for
server.info. The scripts start it explicitly to keep its log (target/mobilecli-server.log); withautoStartServerTestFly would start it too. -
Install the agent:
mobilecli agent install --device <id>. -
iOS only: warm up DeviceKit. The first screen read on a fresh simulator can take longer than a minute while DeviceKit starts. The script reads the view tree once with a 180 s limit before Maven runs:
curl -sf --max-time 180 -X POST http://localhost:12000/rpc -H 'Content-Type: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"device.dump.ui\",\"params\":{\"deviceId\":\"$udid\"}}" -
Run the tests with the device id:
MOBILE_DEVICE_ID=<id> mvn test -Dtestfly.profile=<profile> -Dtest=<Class>. -
Upload
target/surefire-reports/,target/reports/screenshots/and the mobilecli log as artifacts, also when the job fails.
Tips
- Emulators on CI are slow to settle: the example profiles use
actionMs: 30000,pollMs: 500,rpcMs: 60000. - Settings-app texts depend on the device language; CI images are English.
- A job that reports
Skippedtests did not reach the device; treat it as a failure. - Device ids: on Android the AVD name (from
mobilecli devices), on iOS the simulator UDID. - Secrets for a login test go into the CI secret store and reach the test as environment variables.