Connect the phones
Phones plug into the Mac that runs the Mobile Controller. Only real devices are supported: no iOS simulators, no Android emulators.
iPhone
- Connect it by USB to the Mac and tap Trust on the phone.
- Turn on Developer Mode in Settings → Privacy & Security → Developer Mode (the phone restarts). The option appears after the phone has been connected to Xcode once.
- Keep it unlocked and awake during tests: set Auto-Lock to Never and keep it on power. A locked iPhone black-screens every capture; the runner refuses to start and reports it, because WebDriverAgent can't enter a passcode or Face ID.
- Add its UDID to your provisioning profile. The app's IPA must be signed for this phone; MonkeyTester only installs it (
devicectl). Simulator builds can't install on a phone. - Check it is listed:
xcrun devicectl list devicesandcurl -s localhost:8090/deviceson the Mac. Its id in MonkeyTester is the UDID.
The first iOS run builds WebDriverAgent onto the phone. That takes several minutes and needs the signing identity unlocked in the keychain for the controller's LaunchAgent.
iOS behaviour to know
- No live stream. The run page polls fresh screenshots instead of MJPEG.
- No
pm clear. App data survives restarts. For a clean state useREINSTALL_APP: truein a case'sINSTRUCTION.txt, or anUNINSTALLstep. - System prompts (e.g. Local Network permission) appear only on iOS. Handle them with
IF IOS:steps, see Writing tests. - Recording uses the XCUITest recorder, so Appium must allow
xcuitest:xctest_screen_record(the controller sets this when it starts Appium).
Android phone
On the phone, enable Developer options (tap Build number seven times) and turn on USB debugging. Keep the screen awake while charging (Stay awake in Developer options).
Over USB
Plug it into the Mac and accept the Allow USB debugging prompt on the phone (tick Always allow from this computer). Check with ~/Library/Android/sdk/platform-tools/adb devices -l.
Over wireless debugging
Pairing is per host: the phone must be paired with the Mac, not with your laptop or the Linux host.
# On the phone: Developer options → Wireless debugging → Pair device with pairing code
~/Library/Android/sdk/platform-tools/adb pair <phone-ip>:<pairing-port> # enter the 6-digit code
Paired phones advertised over mDNS are connected automatically every 30 s. To keep others connected by address, set ADB_CONNECT=<ip>:<port>[,…] on the controller. Wireless device ids look like IP:PORT.
Android behaviour to know
- Live view is an MJPEG stream (
screenrecord | ffmpegon the Mac). - App data is cleared before every test by default. Use
CLEAR_DATA: firstto chain tests in one case. - Input goes straight through
adb shell input: fast, with no server to build first. - For
ASSERT_LAYOUT, the app must settestTagsAsResourceId = trueon a root semantics node so test tags are visible.
Both platforms in one run
A run submitted with an .apk and an .ipa tests every case on every connected Android phone and iPhone, one device after another, with a device switcher on the result page. If a platform has no device when the run starts, the run waits up to 5 minutes (MT_DEVICE_CONNECT_WAIT_SECS on the viewer) and then fails with "Gave up after 300s waiting for an iPhone to connect".
When a test fails on a device, that device's remaining tests are marked Cancelled; other devices still run everything.