Skip to content

Author mobile tests with your agent ​

Your coding agent can explore a native app the same way it explores a website: it opens a session on a device, reads the screen, acts on elements, and checks the result. Each action it takes comes back as a YAML step with a locator, so the agent can save what it did as a test.

The Shiplight MCP server makes no AI calls for mobile sessions. Your coding agent does the reasoning, and the server runs the actions through Appium. Authoring needs no Shiplight account.

Before you start ​

  1. Install the Shiplight MCP server in your coding agent. See Quick Start.
  2. Install Appium and its drivers, start Appium, and start your emulator or simulator. See Prerequisites.
  3. Start the agent from your test project folder. The MCP server reads shiplight.config.json from its working directory and resolves app.path from there. With no config, it uses a local Appium at http://127.0.0.1:4723. See Configure devices.

What to ask ​

Tell the agent the platform, where the app build is, its package name or bundle identifier, and what flow to cover:

Use Shiplight to open the Android app at ./build/app-debug.apk (package com.example.shop)
on the emulator. Sign in as test@example.com, add the first product to the cart, and
check the cart badge shows 1. Then save the steps as tests/add-to-cart.test.yaml.
Use Shiplight to open the iOS app at ./build/Shop.app (bundle id com.example.shop) on the
simulator. Open the checkout screen, switch into its WebView, fill in the email field,
submit, and check the receipt. Save it as tests/checkout.test.yaml with explicit
locators and assertions only.

Asking for explicit locators and assertions only gives you a test that runs with no AI calls. You can also ask for VERIFY: steps or intent-only steps where the screen varies; those run on Shiplight's hosted service and need an API token.

What the agent does ​

The agent works with these MCP tools:

ToolWhat it does in a mobile session
new_sessionOpens the app on a device. Takes platform (android or ios), app (the same fields as a test's app block), and an optional device profile name
inspect_pageWrites the screen's elements to a file, one line per element with an index, and saves a screenshot with the indices drawn on it. In a WebView, it lists the page's elements instead
actRuns one or more actions on elements by index, such as click, input_text, swipe, assert_text, or switch_context. Returns each action as a YAML step, and the new screen
close_sessionEnds the session

For example, the agent opens a session with:

json
{
  "platform": "android",
  "app": { "path": "./build/app-debug.apk", "identifier": "com.example.shop" }
}

Then it calls inspect_page, reads the element list, and calls act with actions such as { "click": { "element": 4, "description": "Open the cart" } }. Each action in the response has an action_entity with the action, its parameters, and the locator Shiplight chose for the element. That is a YAML step as it is:

yaml
  - intent: Open the cart
    action: click
    locator: { kind: accessibility_id, value: cart }

The agent collects these steps into a test file. Run it with bun run shiplight test to confirm it replays; see Run mobile tests.

Notes ​

  • Element indices belong to one screen. After any action that changes the screen, the agent uses the indices from the screen that act returned.
  • Browser-only tools don't apply. Tools such as navigate, get_page_info, and save_storage_state refuse a mobile session.
  • One session per device. If every device in the profile is busy, new_session fails at once rather than wait. Close sessions you no longer need.
  • WebViews. The agent can call act with switch_context to read and act on a WebView page, and switch back to native. See Hybrid apps.

Released under the MIT License.