---
title: Mobile app testing
description: Test native Android and iOS apps, and the WebViews inside them, with YAML tests that run through Appium on emulators, simulators, Android devices, or a remote Appium endpoint.
---

# Mobile app testing

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Shiplight tests native Android and iOS apps with the same YAML format it uses for web tests. A mobile test names its platform and app, and its steps tap, type, swipe, and assert on the app's own UI. Hybrid apps work too: a test can switch into a WebView page, act on its DOM, and switch back.

Shiplight drives the app through [Appium](https://appium.io): the UiAutomator2 driver on Android and the XCUITest driver on iOS. You run the Appium server and the devices; Shiplight opens the sessions, installs your app, and runs the steps.

::: tip Testing a website on a phone-sized screen?
That is browser emulation, not native app testing. See [Check mobile layout](/guides/check-mobile-layout).
:::

## What you can test

| Target                 | Supported                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------- |
| Android emulators      | Yes                                                                                     |
| Android devices (USB)  | Yes                                                                                     |
| iOS simulators         | Yes                                                                                     |
| Remote Appium endpoint | Yes, Android and iOS: a device service or Appium grid that you or a vendor runs         |
| WebViews               | Android WebView and iOS `WKWebView` pages inside your app. See [Hybrid apps](/mobile/hybrid-apps) |

iOS tests run on simulators. Shiplight does not provide devices: tests run on emulators, simulators, and devices that you connect, or on a remote Appium service that you choose.

## What needs a Shiplight account

- **Explicit steps don't.** A step with an `action:` and a `locator:` runs through Appium on your machine and calls no AI model. A test made only of explicit steps and `assert_*` actions runs with no Shiplight account.
- **AI steps do.** An `intent:` without an `action:`, `VERIFY:`, `WAIT_UNTIL:`, `ai_extract`, AI conditions in `IF:` and `WHILE:`, and self-healing of a broken locator run on Shiplight's hosted service. They need a Shiplight API token. Run this once in your test project:

  ```bash
  bun run shiplight setup-api-token
  ```

  It signs you in through the browser and writes `SHIPLIGHT_API_TOKEN` to the project's `.env`. In CI, set `SHIPLIGHT_API_TOKEN` as a secret. See [API Tokens](/cloud_v2/api-tokens).
- **The visual debugger does.** `shiplight debug` on an Android or iOS test downloads the debugger and mobile components with your API token.
- **Authoring with your coding agent doesn't.** The MCP server opens native sessions and acts on element indices without any AI calls of its own. See [Author with your agent](/mobile/author-with-agent).

## Prerequisites

Install these on the machine that runs Appium:

- **Node.js 22 or newer and Bun**, as for any Shiplight test project. See [Run Locally](/local/run-locally).
- **Appium 2** and the driver for each platform you test:

  ```bash
  npm install --global appium
  appium driver install uiautomator2   # Android
  appium driver install xcuitest       # iOS
  ```

  Shiplight is tested with Appium 2.11, the UiAutomator2 driver 3.8, and the XCUITest driver 7.28.
- **For Android:** the Android SDK with platform tools (`adb`) and, for emulators, the emulator and a system image. Set `ANDROID_HOME` for Appium. To test WebViews, Appium also needs a Chromedriver that matches the device's WebView version; see [Hybrid apps](/mobile/hybrid-apps#android-chromedriver).
- **For iOS:** a Mac with Xcode and an iOS simulator runtime. The first session on a simulator builds WebDriverAgent, which can take several minutes.

Start Appium before you run tests. By default it listens on `http://127.0.0.1:4723`:

```bash
appium
```

## Configure devices

Device profiles go in `shiplight.config.json` at the root of your test project, next to `playwright.config.ts`. Each profile names an Appium server and the devices behind it. A test picks a profile with `app.device`, or uses `defaultDevice`.

If the project has no `devices`, tests use a local Appium at `http://127.0.0.1:4723` and whichever single device it finds. Add a profile when you need another Appium URL, a specific device, more than one device, or extra Appium capabilities.

### Android emulator

```json
{
  "devices": {
    "emulator": { "type": "local", "appiumUrl": "http://127.0.0.1:4723" }
  }
}
```

With no `udids`, the profile uses the one device Appium finds. `platform` defaults to `android`.

### Android device

Connect the device over USB with USB debugging on, and find its serial with `adb devices`. List it in `udids`:

```json
{
  "devices": {
    "pixel": {
      "type": "local",
      "platform": "android",
      "appiumUrl": "http://127.0.0.1:4723",
      "udids": ["R5CT1234567"]
    }
  }
}
```

### iOS simulator

Boot a simulator and find its UDID with `xcrun simctl list devices booted`:

```json
{
  "devices": {
    "sim": {
      "type": "local",
      "platform": "ios",
      "appiumUrl": "http://127.0.0.1:4723",
      "udids": ["8F3C2A6E-1B4D-4C7A-9E2F-5D6B7A8C9E0F"],
      "sessionOpenTimeoutSec": 300
    }
  },
  "defaultDevice": "sim"
}
```

`sessionOpenTimeoutSec` (default 120) is how long a test waits for its session to open. Raise it for iOS, where the first session builds WebDriverAgent.

### Remote Appium endpoint

A `remote` profile sends sessions to an Appium URL that a device service or your own grid serves. You pass the capabilities that pick the device, and `maxSessions` limits how many sessions a run opens at once:

```json
{
  "devices": {
    "cloud-android": {
      "type": "remote",
      "platform": "android",
      "appiumUrl": { "$env": "DEVICE_SERVICE_URL" },
      "capabilities": {
        "appium:deviceName": "Pixel 8",
        "appium:platformVersion": "14"
      },
      "maxSessions": 2,
      "label": "Device service"
    }
  }
}
```

On a remote profile, the app is one that you have already uploaded to the service. The test names it with `app.appId` instead of `app.path`; see [The app block](/mobile/write-tests#the-app-block). `label` is shown in reports.

### Several devices and profiles

- **More than one device on one Appium server:** list them all in `udids`. Each device runs one session at a time, so set Playwright's `workers` to the number of devices. When all devices are busy, a test waits for one.
- **More than one profile:** set `defaultDevice` to the profile that tests use when their `app.device` is not set. It is required when there is more than one profile.
- **Driver ports:** with several devices, each device's session gets its own driver ports by default (Android `systemPort` 8200 and up; iOS `wdaLocalPort` 8100 and up and `mjpegServerPort` 9100 and up). To choose them, write the device as an object, such as `{ "udid": "emulator-5556", "systemPort": 8210 }`.

### Profile reference

| Field                   | Profiles | Description                                                                                                   |
| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| `type`                  | All      | `local` for an Appium server you run, `remote` for a device service                                          |
| `platform`              | All      | `android` (default) or `ios`. A profile serves one platform                                                   |
| `appiumUrl`             | All      | The Appium server URL                                                                                         |
| `udids`                 | Local    | The devices to use, one session each: a UDID or adb serial, or an object with `udid` and driver ports. Default: the one device Appium finds |
| `capabilities`          | All      | Appium capabilities, passed as they are. Required for `remote`                                                |
| `maxSessions`           | Remote   | How many sessions a run may open at once                                                                      |
| `label`                 | Remote   | A name for the service, shown in reports                                                                      |
| `sessionOpenTimeoutSec` | All      | How long a test waits for its session to open, in seconds. Default: 120                                       |

Any string value can be read from an environment variable with `{ "$env": "NAME" }`, so URLs with credentials and device IDs stay out of the file. Shiplight sets the app, reset, and launch capabilities itself; if a profile sets one of them, Shiplight ignores it and prints a warning. iOS profiles reject capabilities that would change the browser or context Shiplight controls.

## Next steps

- [Write mobile tests](/mobile/write-tests): the app block, locators, actions, and AI steps.
- [Hybrid apps](/mobile/hybrid-apps): switch into a WebView and back.
- [Author with your agent](/mobile/author-with-agent): let your coding agent explore the app and write the test.
- [Run mobile tests](/mobile/run-tests): run locally and in CI.
