Use when writing, running or debugging Maestro end-to-end UI flows for a Kotlin Multiplatform or Compose Multiplatform app - .maestro/ YAML flows, maestro test, maestro mcp or inspect_screen, one flow for Android and iOS, appId differing per platform, Maestro not finding a testTag on Android, flaky Maestro runs, check-syntax exit codes after an upgrade, Maestro Cloud, or Maestro in CI on an emulator or iOS simulator.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Kmp Maestro E2e?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kushpawan-kmp-maestro-e2e)
---
name: kmp-maestro-e2e
description: Use when writing, running or debugging Maestro end-to-end UI flows for a Kotlin Multiplatform or Compose Multiplatform app - .maestro/ YAML flows, maestro test, maestro mcp or inspect_screen, one flow for Android and iOS, appId differing per platform, Maestro not finding a testTag on Android, flaky Maestro runs, check-syntax exit codes after an upgrade, Maestro Cloud, or Maestro in CI on an emulator or iOS simulator.
license: Apache-2.0
compatibility: Kotlin Multiplatform app (Compose Multiplatform or native UI). Maestro CLI 2.13.x with Java 17+. Android emulator or device; iOS needs macOS with Xcode and a simulator (physical iPhones are unsupported). Maestro Cloud steps need network access and an API key.
metadata:
category: testing
platforms: android, ios
---
# KMP Maestro end-to-end flows
Maestro drives the installed app from outside, through the accessibility tree. In a Kotlin
Multiplatform app one YAML flow can drive Android and iOS when every element the flow touches has
the same `testTag` on both platforms and the flow selects by `id`, not by visible text.
## When to use
- Adding the first `.maestro/` flows to a KMP app, or a new flow for a feature.
- One flow should pass on both the Android emulator and the iOS simulator.
- `id:` finds nothing on Android, or a flow passes on one platform only.
- Connecting a coding agent to Maestro through `maestro mcp`, or reading `inspect_screen` output.
- A Maestro upgrade broke `check-syntax` in CI, or scroll `speed` now fails validation.
- Running flows in GitHub Actions (self-hosted emulator or simulator) or on Maestro Cloud.
- Maestro flows are flaky: missed taps, timeouts after launch, keyboard in the way.
## When not to use
- In-process Compose UI tests (`runComposeUiTest`, `onNodeWithTag`): use
`compose-multiplatform-ui-testing`.
- Pixel or golden-image comparison: use `kmp-screenshot-testing`.
- Adding or renaming the `testTag` ids themselves: use `mobile-accessibility-test-ids`, then come back.
- ViewModel or repository unit tests: use `kmp-testing-patterns`.
- E2E on a **physical iPhone**: Maestro fails early with "Physical iOS devices are not yet supported".
Use [mobile-mcp](https://github.com/mobile-next/mobile-mcp) or Appium
([appium-mcp](https://github.com/appium/appium-mcp), [appium/skills](https://github.com/appium/skills)).
- The project already runs Appium or XCUITest suites for E2E and nobody asked for Maestro. Extend
those instead of adding a second E2E tool.
## Step 0 - Read the project first
Run these from the repository root and note the answers before writing a flow.
```bash
# 1. Existing Maestro workspace, config and CI use
find . -name ".maestro" -type d -not -path "*/build/*"
find . -path "*/.maestro/*" -name "*.yaml" -not -path "*/build/*"
grep -rln "maestro" .github/workflows 2>/dev/null
maestro --version 2>/dev/null || echo "maestro not installed"
# 2. Other E2E tools already in use
grep -rlE "io\.appium|appium:|UiAutomator2|XCUITest" --include="*.kt*" --include="*.json" --include="*.y*ml" . 2>/dev/null | grep -v /build/ | head
find . -type d -name "*UITests" -not -path "*/build/*"
grep -rn "espresso" --include="*.toml" --include="*.kts" . 2>/dev/null | grep -v /build/ | head
# 3. App ids: Android applicationId (not namespace) and iOS bundle id
grep -rn "applicationId" --include="*.kts" . | grep -v /build/
grep -rhn "PRODUCT_BUNDLE_IDENTIFIER" --include="*.pbxproj" --include="*.xcconfig" . | sort -u
# 4. Test ids and whether Android exposes them
grep -rn "testTagsAsResourceId" --include="*.kt" . | grep -v /build/
grep -rln "testTag(" --include="*.kt" . | grep -v /build/ | head
grep -rn "object .*TestTags" --include="*.kt" . | grep -v /build/
```
Decide from the results:
- **Flows exist:** keep their folder, naming, tags and `config.yaml`. Add flows in the same style.
- **Appium, XCUITest or Espresso exist:** ask whether Maestro is wanted before adding it.
- **App ids differ per platform** (common: `com.example.app` vs `com.example.app.ios`): every flow
uses `appId: ${APP_ID}` and each run passes `-e APP_ID=...`. If they are equal, still prefer the
variable so a later rename does not touch every flow.
- **No `testTagsAsResourceId`:** Android flows cannot use `id:` for Compose tags. Fix that first
(Workflow step 2).
- **No test-tag constants:** create them with `mobile-accessibility-test-ids` before writing flows.
## Workflow
### 1. Install a pinned Maestro CLI
Follow the official install page:
<https://docs.maestro.dev/maestro-cli/how-to-install-maestro-cli>. Maestro needs Java 17+ and, on
macOS, Xcode with its command-line tools. Do not paste a remote install script into a shell from this
skill; use one of these routes:
- **macOS, Homebrew tap** (installs the tap's current release), as the install page documents:
```bash
brew tap mobile-dev-inc/tap
brew trust --formula mobile-dev-inc/tap/maestro
brew install mobile-dev-inc/tap/maestro
```
- **Exact version (local or CI):** download `maestro.zip` from the GitHub release tag `cli-2.13.0`,
check it against the release's `checksums_sha256.txt`, unzip, and put `maestro/bin` on `PATH`
(script in [references/ci-and-mcp.md](references/ci-and-mcp.md#pinned-cli-install)).
- The official install script also honours `MAESTRO_VERSION=2.13.0`; read it before you run it.
*Done when* `maestro --version` prints the version the team pinned (2.13.0 as of 3 Dec 2026).
Record that version in the CI workflow, not only on a laptop.
### 2. Make the same ids visible on both platforms
- **Android:** Compose tags reach UiAutomator, and so Maestro, as `resource-id` only under an
ancestor with `testTagsAsResourceId = true`. Set it once at the host Activity's root, from
`androidMain`, and again in separate windows (`Dialog`, `ModalBottomSheet`, `Popup`). The exact
code is in `mobile-accessibility-test-ids`.
- **iOS (Compose Multiplatform):** JetBrains documents that `testTag` maps to the native
`accessibilityIdentifier`, which is what Maestro's `id:` matches on iOS. No extra flag is needed on
Compose Multiplatform 1.8+. SwiftUI screens use `.accessibilityIdentifier(...)` with the same string.
Checked in December 2026: Maestro 2.13.0 found every `testTag` id of a Compose Multiplatform 1.13.0
app on an iOS 27.2 simulator, including `id:` regexes such as `note_row_.*`.
- **Check before you write the flow.** Launch the app, open the screen, then dump the hierarchy with
the MCP `inspect_screen` tool or `maestro --platform android hierarchy` / `maestro --platform ios
hierarchy`. Every id the flow will use must appear on both platforms.
*Done when* each id appears in the hierarchy dump on Android **and** iOS.
### 3. Write the flow
One flow per user journey, in `.maestro/`. Shared steps go in `.maestro/subflows/`. The top-level
`config.yaml` default (`flows: ["*"]`) does not recurse, so subflows are not run as tests.
```yaml
# .maestro/create_note.yaml
appId: ${APP_ID} # Android applicationId or iOS bundle id, passed with -e APP_ID=...
tags:
- smoke
---
- launchApp:
clearState: true # every flow starts from a fresh install state; no order dependency
- extendedWaitUntil: # cold start on a CI emulator can exceed assertVisible's 7 s
visible:
id: empty_state
timeout: 15000
- tapOn:
id: add_note_button
- tapOn:
id: editor_title_field # focus the field first, then type
- inputText: Groceries
- tapOn:
id: editor_body_field
- inputText: Milk, eggs, bread
- tapOn:
id: save_note_button
- assertVisible:
id: note_row_.* # id is a regular expression: any row
- assertVisible:
text: .*Groceries.* # row text may merge title and body on Android
```
Rules that keep one flow working on both platforms:
- **Select by `id`.** `id` matches the Android `resource-id` and the iOS `accessibilityIdentifier`.
Text matches visible text plus `contentDescription` (Android) or `accessibilityLabel` (iOS), and it
changes with copy edits and locale.
- `id` and `text` are **full-match regular expressions**. Use `.*` for partial matches and escape
`.`, `$`, `[` with `\`. Snake_case ids avoid the dot problem.
- **Dynamic rows:** tag them `note_row_<stableId>` and select `note_row_.*` with `index: 0`, or the
exact id when the test knows it. Never rely on list position alone.
- **Waiting:** `assertVisible` and `tapOn` already poll (about 7 s). Use `extendedWaitUntil` for
slower work and `waitForAnimationToEnd` only where taps land during a transition. Never add fixed
sleeps.
- **Platform-only steps** (a permission dialog, a system sheet) go in a subflow behind
`runFlow` with `when: { platform: iOS }` or `when: { platform: Android }`.
Command and selector details: [references/flows-and-selectors.md](references/flows-and-selectors.md).
*Done when* `maestro check-syntax <flow files>` exits 0.
### 4. Build, install and run locally
Maestro does not build or install the app. Install the debug build, then run.
```bash
# Android: emulator or device listed by adb
./gradlew :androidApp:installDebug # or :composeApp:installDebug; check the module name
maestro --platform android test -e APP_ID=com.example.app .maestro/
# iOS: booted simulator (macOS only)
xcodebuild -project iosApp/iosApp.xcodeproj -scheme iosApp -configuration Debug \
-sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
-derivedDataPath build/ios build
xcrun simctl install booted build/ios/Build/Products/Debug-iphonesimulator/iosApp.app
maestro --platform ios test -e APP_ID=com.example.app.ios .maestro/
```
Use `maestro list-devices` and `--device <id>` when more than one device is connected. Add
`--format JUNIT --output build/maestro/report.xml --test-output-dir build/maestro` for reports and
per-step screenshots.
*Done when* every flow passes on both platforms, or each failure is reported with its artifact.
### 5. Let the agent drive Maestro through MCP
The MCP server ships inside the CLI and speaks stdio. For Claude Code:
`claude mcp add maestro -- maestro mcp`. Other agents use the command `maestro` with argument `mcp`.
Loop: `list_devices` -> launch the app -> `inspect_screen` -> author steps with ids from that output
-> `run` with inline `yaml` -> fix -> save the passing YAML as a file -> `run` with `files` on the
other platform. Call `cheat_sheet` before using a command you have not used. Tool list and Cloud
tools: [references/ci-and-mcp.md](references/ci-and-mcp.md#maestro-mcp-server).
*Done when* the saved file passes through `maestro test`, not only through inline MCP runs.
### 6. Run in CI
Two options. Pick one per project and say which:
| | Self-hosted (GitHub Actions) | Maestro Cloud |
|---|---|---|
| Android | `ubuntu-latest` + KVM + an emulator action | `mobile-dev-inc/action-maestro-cloud` uploads the APK |
| iOS | macOS runner, simulator, `xcodebuild` `.app` | uploads a zip of the simulator `.app` |
| Cost | runner minutes (macOS is expensive) | Maestro Cloud plan |
| Pin | download the `cli-2.13.0` zip | `maestro-cli-version` input on the action |
Workflows and flake settings: [references/ci-and-mcp.md](references/ci-and-mcp.md#github-actions-self-hosted).
Runner labels and Xcode selection come from `kmp-ci-github-actions`.
*Done when* CI uploads the JUnit report and the Maestro output folder on failure.
## Quick reference
| Need | Use |
|---|---|
| Fresh state | `launchApp: { clearState: true }` (iOS reinstalls the app; Keychain needs `clearKeychain: true`) |
| Same flow, different ids per platform | `appId: ${APP_ID}` + `maestro test -e APP_ID=...` |
| Element by test id | `tapOn: { id: save_note_button }` |
| Nth of many | `id: note_row_.*` + `index: 0` |
| Wait longer than ~7 s | `extendedWaitUntil: { visible: { id: ... }, timeout: 15000 }` |
| Let a transition settle | `waitForAnimationToEnd: { timeout: 3000 }` |
| Type | tap the field, then `inputText: ...`; clear with `eraseText` (50 chars default) |
| Retry a small block | `retry: { maxRetries: 2, commands: [...] }` (0-3) |
| Validate syntax | `maestro check-syntax a.yaml b.yaml` (`--format json`) |
| Inspect the tree | MCP `inspect_screen`, or `maestro hierarchy` |
| Select platform or device | `maestro --platform ios ...`, `maestro --device <id> ...` |
**Breaking changes to know:**
- **2.13.0** (27 Nov 2026): `check-syntax` exits 0 clean, 1 problems, 2 usage or file error;
problems go to stdout; a file with commands but no config section fails; files referenced by
`runFlow`, `retry`, `runScript`, `addMedia` must exist. CI scripts that grepped for `OK` break.
- **2.12.0**: scroll `speed` outside 0-100 fails instead of falling back to the default.
- **2.11.0**: physical iPhones are no longer listed; runs on them fail early.
## Verify
Report each check as **PASS**, **FAIL** or **NOT RUN (reason)**. Never report a flow as passing on a
platform where it did not run. Maestro not installed, no macOS host, or no booted simulator are
NOT RUN reasons, not PASS.
```bash
maestro --version # expect the pinned version
maestro check-syntax .maestro/create_note.yaml .maestro/edit_note.yaml # exit 0
maestro --platform android test -e APP_ID=<android id> --format JUNIT --output build/maestro/android.xml .maestro/
maestro --platform ios test -e APP_ID=<ios bundle id> --format JUNIT --output build/maestro/ios.xml .maestro/
```
- Hierarchy check: each id the flows use appears in `inspect_screen` on both platforms.
- If Maestro cannot be run, at least parse every flow as YAML (for example Ruby
`YAML.safe_load(File.read(f))` or Python `yaml.safe_load`) and report execution as NOT RUN.
- Stability: run the suite three times in a row on each platform before calling it stable.
## Common mistakes
| Mistake | Why it bites | Fix |
|---|---|---|
| No `testTagsAsResourceId` root on Android | Compose tags are not `resource-id`s; `id:` finds nothing | Set it at the Activity root and in dialog/sheet windows (`androidMain`) |
| Selecting by visible text | Copy edits and translations break the flow; text differs per platform | `id:` from the shared `TestTags` constants |
| Hardcoded `appId` | iOS bundle id often differs from the Android `applicationId` | `appId: ${APP_ID}` and `-e APP_ID=...` |
| Using `namespace` or the Kotlin package as `appId` | Maestro needs the installed `applicationId` | Read `applicationId` (plus any `applicationIdSuffix`) |
| Dots in ids | `id` is a regex, so `.` matches anything | snake_case ids, or escape `\.` |
| `inputText` without tapping the field | Non-ASCII text on Android needs a focused field; iOS may type into the wrong field | `tapOn` the field id first |
| Fixed sleeps or a `retry` around the whole flow | Slow and hides real app bugs | Polling asserts, `extendedWaitUntil`, small `retry` blocks only |
| Flows depend on each other's data | Order changes or sharding break them | `clearState: true` and create the data inside the flow or a subflow |
| `hideKeyboard` on iOS | No native API; Maestro swipes and may miss | Tap a neutral element by id, or tap the next field |
| Running against a physical iPhone | Unsupported; fails early | iOS simulator, or mobile-mcp / Appium for real devices |
| Treating MCP inline runs as the test suite | Nothing is saved or run in CI | Save the YAML under `.maestro/` and run it with `maestro test` |
| `curl ... \| bash` in CI with no version | Unpinned, unreviewed code; behaviour changes between runs | Pinned release zip with checksum, or the Cloud action's `maestro-cli-version` |
## Related skills
- `mobile-accessibility-test-ids`: naming, declaring and exposing the `testTag` ids these flows use.
- `compose-multiplatform-ui-testing`: in-process Compose UI tests from `commonTest`.
- `kmp-screenshot-testing`: golden-image tests for Compose screens.
- `kmp-ci-github-actions`: runner labels, Xcode selection and caching for the CI jobs.
- `kmp-flaky-test-triage`: flaky unit tests (not Maestro flows).
- `kmp-build-check`: confirm both platforms build before running E2E.
- [Maestro docs](https://docs.maestro.dev) and [Maestro MCP](https://docs.maestro.dev/get-started/maestro-mcp).
- [mobile-next/mobile-mcp](https://github.com/mobile-next/mobile-mcp) (Apache-2.0): MCP automation for simulators, emulators and real iOS/Android devices.
- [appium/appium-mcp](https://github.com/appium/appium-mcp) and [appium/skills](https://github.com/appium/skills) (Apache-2.0): Appium MCP server and setup skills.