Run mobile tests
Mobile tests run with the same command as web tests. When a run includes Android or iOS tests, the CLI opens a session on a device from the test's profile, installs the app according to its reset policy, runs the steps, and closes the session.
Run locally
Start Appium and your emulator or simulator, or connect your Android device. See Prerequisites.
From your test project, run:
bashbun run shiplight testTo run one file:
bashbun run shiplight test tests/login.test.yaml
A project can hold web and mobile tests side by side. A run with no Android or iOS tests does not contact Appium.
Configure Playwright for devices
Each device runs one session at a time. Match Playwright's workers to the number of devices, and allow time for app installs and slow emulators:
import { defineConfig, shiplightConfig } from 'shiplight';
export default defineConfig({
...shiplightConfig(),
testDir: '.',
testMatch: ['**/*.test.ts', '**/*.yaml.spec.ts'],
// One emulator or simulator serves one session at a time.
workers: 1,
// A session opens with an app install; on iOS the first one also builds WebDriverAgent.
timeout: 300_000,
use: { video: 'retain-on-failure' },
});If more tests run at once than there are devices, the extra tests wait for a device to be free. If tests depend on each other's app data (resetPolicy: none), also set fullyParallel: false so files run in order.
Results
The HTML report shows each step with a screenshot of the device screen, and the device the test ran on: its name, OS version, and whether it was an emulator, a real device, or a remote device. With video on, the report includes a recording of the device screen. See Run Locally for reports and Shiplight Cloud for uploaded results.
Press Ctrl-C to stop a run. The CLI closes its Appium sessions before it exits.
Debug a test
Open a mobile test in the visual debugger to step through it on the device:
bun run shiplight debug tests/login.test.yamlThe debugger for Android and iOS tests downloads with your Shiplight API token. Run bun run shiplight setup-api-token first. See What needs a Shiplight account.
Run in CI
Mobile tests run on any CI that can host your devices or reach a remote Appium endpoint. The job installs the same things as your machine:
- Android: a Linux runner with hardware acceleration (KVM) for the emulator, the Android SDK, an emulator with a system image, and Appium with the UiAutomator2 driver. Start the emulator and wait for it to boot before
shiplight test. - iOS: a macOS runner with Xcode and an iOS simulator runtime, and Appium with the XCUITest driver. Build the app for the simulator in the job, boot a simulator, and pass its UDID to the profile through an environment variable.
- Remote Appium endpoint: any runner. The job needs no Appium or devices; pass the endpoint URL and its credentials as secrets through
{ "$env": "NAME" }in the profile.
For example, read the Appium URL and simulator UDID from the job's environment:
{
"devices": {
"sim": {
"type": "local",
"platform": "ios",
"appiumUrl": { "$env": "IOS_APPIUM_URL" },
"udids": [{ "$env": "IOS_SIM_UDID" }],
"sessionOpenTimeoutSec": 300
}
},
"defaultDevice": "sim"
}Start Appium in the background before the test step, for example appium --address 127.0.0.1 --port 4723 &, and wait until it answers.
Tests with only explicit steps need no secrets from Shiplight. For AI steps, self-healing, and report uploads, set SHIPLIGHT_API_TOKEN as a CI secret, as for web tests. See CI/CD for provider templates.
Troubleshooting
| Symptom | What to check |
|---|---|
| The session doesn't open in time | Raise sessionOpenTimeoutSec in the profile and the Playwright timeout. The first iOS session builds WebDriverAgent |
Device profile "…" is for android, but the app is ios | A profile serves one platform. Set the profile's platform, or select another profile with app.device |
… is remote, so the app needs an appId | Remote profiles install an app you uploaded to the service. Replace path with appId |
defaultDevice … is required with more than one device profile | Set defaultDevice in shiplight.config.json |
The app can't be updated in place and resetPolicy is none | Uninstall the app from the device, or use fresh or reinstall |
switch_context finds no WebView | Make the WebView inspectable, and on Android give Appium a matching Chromedriver. See Hybrid apps |
Related
- Mobile app testing: devices and setup
- CLI Reference: every command and flag