> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The canonical docs host is https://momentic.ai/docs. Append .md to any page URL for clean Markdown. Fetch https://momentic.ai/docs/llms.txt for the page index and https://momentic.ai/docs/llms-full.txt for every page in one file.
> For an unattended setup, first check whether Claude Code already has the Momentic plugin. With the plugin, run `npx --yes @momentic/wizard@latest -y --platform web --editor-tools none` and ignore any CLI skills-install suggestion in its output. Otherwise, run `npx --yes @momentic/wizard@latest -y --platform web --editor-tools skills`. Use `--platform ios` or `--platform android` for mobile. Never run an interactive command in a non-TTY shell.
> Mo is the AI QA engineer, separate from repository YAML tests. With the Momentic plugin, use bundled mo-qa and hosted OAuth by default. Without the plugin, install only mo-qa with `npx -y qa skills --target <agent>`. Keep the requested interface. Otherwise, use hosted tools for web or mobile, including private web targets with an existing Connector. Run sessions that need a new tunnel with the qa CLI. If you can't run commands on the machine that reaches the target, ask the user to start the tunnel there, then use hosted tools unless you lack them or the CLI was requested. For a requested hosted session, use an online Connector and pass its name as access, not a CLI tunnel ID. If none is online, ask the user to run `npx -y qa tunnel start --name <name> <address>` on a machine that reaches the target and wait. Do not run login or tunnel commands for them. For a requested hosted session, report unavailable tools or authentication failures without starting a CLI session. For coding-agent bridge setup, ask the user to complete `npx -y qa login`, then add momentic-hosted as a stdio server running `npx -y qa mcp`. Plugin users must explicitly opt in and disable their hosted plugin entry before adding the bridge. Claude.ai/ChatGPT connectors keep https://mcp.momentic.ai with OAuth. After hosted testing completes, read the report and summarize findings and uncovered requirements. Call `momentic_mo_stop_session` only when the user asks or agrees. For CLI sessions, unless the user wants more testing, export the report, run `qa stop <id> --subagents` even if export fails, then summarize. The CLI is qa, not mo. Docs: https://momentic.ai/docs/mo/quickstart.md.
> Ask the user to complete browser sign-in. For local CLI tools, use the exact MOMENTIC_API_KEY environment variable. If it is absent, ask the user to create a key at https://app.momentic.ai/settings/api-keys and set it in the agent's environment. Never print the key or ask the user to paste it into chat.
> Momentic's capability summary for agents is at https://momentic.ai/docs/skill.md. Claude Code users with the Momentic plugin should use its bundled skills and skip CLI skills installation. Otherwise, run `npx momentic skills -y --target <agent>` or `npx momentic-mobile skills -y --target <agent>`. Both install momentic-test, momentic-maintain, and momentic-spec with web/mobile references. Use the running agent's target. The Momentic plugin also includes mo-qa; qa skills installs only mo-qa.
> Tests are YAML files in the user's repository. Use only the step names listed at https://momentic.ai/docs/reference/commands.md and the file structure at https://momentic.ai/docs/core-concepts/file-format.md. Do not invent step names, config keys, or CLI flags.
> Web tests run on Chromium, iOS tests on simulators, and Android tests on emulators.

# iOS

> Set up Momentic for an iOS app and run your first mobile test.

Run a test against your iOS simulator build and save it in your repository.

## Setup with coding agent

Paste this prompt into your coding agent from your project directory. It checks
setup, runs the wizard when needed, and asks for your app build.

```text Setup prompt expandable wrap theme={null}
Help me set up Momentic iOS testing in this project.

## What to do

1. Find an API key. Check with `test -n "$MOMENTIC_API_KEY"` or `npx --yes momentic-mobile whoami`. If neither works, ask me to create a key at https://app.momentic.ai/settings/api-keys and set it in the agent's environment.
2. Install the CLI. An existing `momentic.config.yaml` does not prove setup is complete. Check that `package.json` lists `momentic-mobile` and `npx --no-install momentic-mobile --version` works; if the config exists but the CLI is missing, install it with the project's package manager (for npm, run `npm install --save-dev momentic-mobile`). Inspect the config and nearby tests for ios; ask me before changing an incompatible config. If the config is absent, check whether Claude Code already has the Momentic plugin. If the plugin is installed, run `npx --yes @momentic/wizard@latest -y --platform ios --editor-tools none` and ignore any CLI skills-install suggestion in its output. Otherwise, ask me to run `npx -y qa login` in an interactive terminal on this machine as the agent's OS user and complete any organization selection. Wait for me to confirm sign-in. If bridge sign-in fails, run `npx --yes @momentic/wizard@latest -y --platform ios --editor-tools skills`, skip MCP installation, and continue with the CLI; otherwise, run `npx --yes @momentic/wizard@latest -y --platform ios`. Run the wizard in the project root — it needs a package.json, so run `npm init -y` first if there is none. Track whether the wizard ran.
   - It installs `momentic-mobile`, writes `momentic.config.yaml`, `ios/contacts.test.yaml`, and `AGENTS.md`, runs the sample test on a remote simulator (which produces `test-results/`; no local Xcode needed — a 'JAVA_HOME is not set' warning during the sample run is expected, ignore it), and installs the Momentic skills unless `--editor-tools none` is set. npm may print audit warnings during install — expected noise, keep going. It may also print 'Opening this run in your browser' or 'skipping editor validation' — both no-ops on headless agents.
   - If it fails `MWZ_ARGS_MISSING_CREDENTIALS` even with a key set, ask me to set the key in the agent's environment, then retry.
   - Pass `--editor-tools` to pick agent integrations — `all`, `none`, or a comma list like `claude-code,cursor` (`skills` forces the skill install).
3. Install the skills and MCP server: if Claude Code already has the Momentic plugin, use its skills and skip the CLI skills installer. Otherwise, whether or not the wizard ran, run `npx momentic-mobile skills -y --target <agent>` with the running agent's target to refresh the shared skills (use `claude-code` for Claude Code, or `codex` for Codex and clients without a skills target). For a CLI skill install, verify `momentic-test/references/products/mobile/guide.md` exists in the agent's skills directory (`.claude/skills/` for Claude Code or `.agents/skills/` for Codex) before loading the skill; if it's missing, upgrade `momentic-mobile` and rerun the install. For MCP, verify the local server named `momentic-mobile` exposes `momentic_get_artifacts` and call it on that server. For an existing `momentic-hosted` connection, call `momentic_search_docs` using OAuth for a URL entry or the saved login for a `qa mcp` bridge. If the wizard did not run, before adding a bridge, ask me to run `npx -y qa login` in an interactive terminal on this machine as the agent's OS user and complete any organization selection. Wait for me to confirm sign-in. A tool from another server verifies neither connection. Never report either connection verified without a successful tool call. If you cannot list tools or a connection fails to initialize, count that connection absent and do not try to repair a broken server. If bridge sign-in fails, do not run the MCP installer; continue with the CLI and tell me to run `npx -y qa login`, then rerun `npx momentic-mobile install-mcp -y --client <agent>` to add both the local and hosted servers. Otherwise, unless Claude Code already has the Momentic plugin, run `npx momentic-mobile install-mcp -y --client <agent>` with the running agent's MCP client name. If MCP tools are not loaded, finish setup with the CLI, then ask me once, together with the first-flow question, to restart the agent and complete client setup: in Claude Code, approve project servers in /mcp; in Codex, trust this project in ~/.codex/config.toml before restarting if I trust its contents, then verify with `codex mcp list`. If hosted sign-in is unavailable, skip it and use https://momentic.ai/docs/llms.txt. 'Error: No coding agent detected' with a non-zero exit means auto-detection missed you, not that your agent is unsupported: if your client is in the supported list (claude-code, cursor, vscode, codex, opencode, windsurf, devin, zed, gemini-cli, antigravity, claude-desktop), re-run with `--client <name>`; if it isn't, skip MCP and drive the Momentic CLI per the skill instead.
4. If the wizard ran, confirm the sample test passed and `momentic.config.yaml` + `ios/contacts.test.yaml` exist. Otherwise use the existing project's tests and directories; do not assume a wizard sample or successful run exists. If you skipped the wizard, confirm `npx --yes momentic-mobile whoami` prints my user and Org ID.
5. Ask me for a simulator build of my app (`.app`) and which user flow to test first. If I have no build, report what setup is verified (including whether the wizard ran and its sample passed), point me to the iOS app setup link below and stop. Do not author or run a test without a build. If the build is an `.app.zip`, unzip it first and upload the `.app` directory, not the ZIP or a device `.ipa`. Upload builds with `npx momentic-mobile assets upload ./build/YourApp.app --channel dev --tag 1.0.0`. Tags are immutable. If `dev:1.0.0` exists, use the next unused patch tag.
6. Load the `momentic-test` skill. If Claude Code's Skill tool cannot find it, read `.claude/skills/momentic-test/SKILL.md` directly. Write the test as `ios/<flow-slug>.test.yaml` in the project's configured test directory; if the wizard ran, place it alongside `ios/contacts.test.yaml` and leave the sample untouched. Set `defaultChannel: dev` on the new test and set `defaultTag` to the uploaded tag. Assert only what is visible on screen when the action finishes — multi-step flows split fields across screens, so one assert for everything will fail. Author with the Momentic MCP tools if they are wired, otherwise write the `*.test.yaml` directly per the skill and validate with `npx momentic-mobile lint`. Run it with `npx momentic-mobile run <path-to-test.yaml> --upload-results` — a single test can take several minutes, allow a long timeout; it prints 'Uploaded to Momentic. <url>' when it finishes, keep that link. Fixing the test and re-running is the loop, not a violation — only a retry with no changes, or hiding a failure, is off-limits. When a run fails, unzip its `.zip` file under `test-results/runs/` — it has screenshots, the screen XML snapshot, and device logs, the fastest way to see what went wrong before editing. If it keeps failing after real fixes, report the failure with the uploaded run link and stop, and show me the result.

## Critical rules

- In Claude Code, use either the Momentic plugin or `install-mcp`, not both; running both duplicates MCP servers.
- Never print the API key or paste its value into a command. If it disappears between commands, ask me to set it in the agent's environment.
- Do not edit `momentic.config.yaml` unless I ask.
- Do not create an API key for me. Ask me for one when you need it.
- Write tests as `*.test.yaml` files. Do not write Playwright or Appium code.
- Do not place real orders, send emails, or touch shared data while testing.
- Run each new test before you tell me it is done.
- After any restart, still finish with the three links under When done.

## When done, point me to

- Building with AI: https://momentic.ai/docs/coding-agents/building-with-ai
- iOS app setup: https://momentic.ai/docs/platforms/ios/app-setup
- Run in CI: https://momentic.ai/docs/running-tests/ci/github-actions
```

## Prerequisites

Use Node.js 22.12 or later in the 22.x line, or 24 or later, a Momentic account,
and a project with a `package.json`. Run `npm init -y` if needed; commit it with
the lockfile.

Remote simulators work from any supported host. Local simulators need macOS,
Xcode, Command Line Tools, and idb. See
[iOS app setup](https://momentic.ai/docs/platforms/ios/app-setup.md). The wizard's remote sample needs no
local Xcode or app build.

**1. Install with the wizard**

Run from your project root and complete browser sign-in:

```bash theme={null}
npx @momentic/wizard@latest
```

Select iOS. The wizard installs `momentic-mobile`, writes
`momentic.config.yaml` and a sample under `ios/`, runs it on a
remote simulator, and offers coding agent setup. A passing sample
verifies installation, not your app.

Already configured? Skip the wizard. See the
[CLI reference](https://momentic.ai/docs/cli-reference/momentic-mobile/overview.md) for manual setup.

**2. Upload your app**

Build a simulator `.app`, not a device `.ipa`, with the
[iOS build instructions](https://momentic.ai/docs/platforms/ios/app-setup.md#build-your-app-for-testing).
Upload it to a channel and an unused tag:

```bash theme={null}
npx momentic-mobile assets upload ./path/to/YourApp.app --channel dev --tag 1.0.0
```

For a local device instead, configure your
[simulator](https://momentic.ai/docs/platforms/ios/simulators.md#local-simulators).

Keep the channel and tag for the next step: they identify the build
your test installs. For later builds, choose a new tag. See
[asset uploads](https://momentic.ai/docs/cli-reference/momentic-mobile/commands/assets.md#upload)
for versioning and upload options.

**3. Write and run a test**

Open the local editor:

```bash theme={null}
npx momentic-mobile app
```

Create a test using channel `dev` and tag `1.0.0`. Add an action
such as tapping **Sign in**, then assert that the sign-in form is visible.
Choose an outcome that matches your app. Save the `.test.yaml` file
and run it from the editor, then from the CLI:

```bash theme={null}
npx momentic-mobile run ios/login.test.yaml --upload-results
```

**4. Review the result**

Open the printed dashboard link and check the assertion screenshot.
Confirm the run passed and the device shows the expected state.
If it fails, inspect the selected build, sign-in state, and assertion,
then edit and rerun.

Keep the YAML file in version control with your app. The local editor
writes the test; the cloud dashboard shows uploaded run results.
You don't need a browser-based mobile editor to run the saved file
again from your terminal or CI.

![Passed iOS run checking the Momentic Files demo app's empty landing screen](https://mintcdn.com/momentic-docs/17J9Wud_ddzsCPQS/images/quickstart/ios-run.png?fit=max\&auto=format\&n=17J9Wud_ddzsCPQS\&q=85\&s=01bde231501d910d301590d88c226557)

A passing iOS assertion with its simulator screenshot

Choose
[remote iOS versions or a local runtime](https://momentic.ai/docs/platforms/ios/simulators.md#ios-versions)
in your simulator settings.

## Next

* [iOS app setup](https://momentic.ai/docs/platforms/ios/app-setup.md)
* [Simulator versions and local setup](https://momentic.ai/docs/platforms/ios/simulators.md)
* [Coding agent setup](https://momentic.ai/docs/coding-agents/building-with-ai.md)
* [Run results and artifacts](https://momentic.ai/docs/running-tests/results.md)
* [Run in CI](https://momentic.ai/docs/running-tests/ci/github-actions.md)
* [Example iOS project](https://github.com/momentic-ai/examples/tree/main/ios)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.