E2E YAML Reference

Reference for the YAML scenario syntax used by the @ohah/react-native-mcp-server test runner. One test suite per file.

File structure

name: string # Suite name (required)
config: # Config (required)
  platform: ios | android
  timeout?: number # ms, connection wait, etc.
  bundleId?: string # App bundle/package ID
  deviceId?: string # idb/adb device ID (optional)
  orientation?: number # iOS GraphicsOrientation override (1-4, optional)
setup?: Step[] # Run before main steps (optional)
steps: Step[] # Main test steps (required, 1+)
teardown?: Step[] # Run on exit (optional)
  • config.platform: ios | android. Can be overridden by CLI -p.
  • config.bundleId: e.g. org.example.app (iOS), com.example.app (Android). Runner starts the app after the server is up.
  • config.orientation: iOS only. Force a GraphicsOrientation value (1=Portrait, 2=Portrait180, 3=LandscapeA, 4=LandscapeB). Omit for auto-detection via xcrun simctl spawn.
  • setup / teardown: Each is Step[]. teardown runs even when a step fails.

Step types

The runner supports 34 step types across 8 categories. See the Steps Reference for full details on every step.

CategoryStepsDescription
Interaction8Tap, swipe, type, long press, double tap, scroll
Assertions5Verify text, visibility, element count, value
Waits4Wait for text, visibility, or fixed delay
Navigation & Device7Press button, back, home, deep link, location, reset
App Lifecycle2Launch and terminate apps
Screenshots2Capture and compare screenshots
Video2Start and stop screen recording (idb/adb)
Utilities4Copy/paste text, run JS, add media

Full example

name: Login flow
config:
  platform: ios
  timeout: 10000
  bundleId: org.example.app
  # orientation: 3  # Force iOS landscape (optional)

setup:
  - launch: org.example.app
  - waitForVisible:
      selector: '#login-screen'
      timeout: 5000

steps:
  - typeText:
      selector: '#email'
      text: test@example.com
  - hideKeyboard:
  - typeText:
      selector: '#password'
      text: secret
  - tap:
      selector: '#login-button'
  - waitForText:
      text: 'Home'
      timeout: 5000
  - assertText:
      text: 'Welcome'
      selector: '#greeting'
  - longPress:
      selector: '#profile-item'
      duration: 1000
  - screenshot:
      path: ./results/login-success.png
  - back:

teardown:
  - terminate: org.example.app

Video recording

  • startRecording: { path?: string } — Start screen recording (idb on iOS, adb screenrecord on Android). If path is omitted, saves to outputDir/e2e-recording.mp4. Path must be under the current working directory.
  • stopRecording: {} — Stop the current recording and save the file. Safe to call in teardown even when no recording was started (no-op).

Use startRecording in setup and stopRecording in teardown so the full run is captured; teardown runs even on step failure, so the recording is always stopped.

E2E CLI (@ohah/react-native-mcp-server test)

Usage

npx @ohah/react-native-mcp-server test run <path> [options]

  • <path>: A YAML file or a directory
    • Directory runs only .yml/.yaml files directly under the directory (no recursive traversal).

Commands

  • run <path>: Run a YAML test file or a directory

Options

  • -p, --platform <ios|android>: Override config.platform from YAML.
  • -r, --reporter <type>: Reporter type. console | junit | json | html | slack | github-pr (default: console)
  • -o, --output <dir>: Output directory (default: ./results)
  • --slack-webhook <url>: Slack webhook URL (for -r slack; or set SLACK_WEBHOOK_URL)
  • --report-url <url>: Report link for Slack message (e.g. CI artifact URL)
  • -t, --timeout <ms>: Global timeout override (connection wait, etc.)
  • -d, --device <id>: Device ID (idb/adb)
  • --no-bail: Continue running next suites after a failure (default: bail on first suite failure)
  • --no-auto-launch: Do not auto-launch the app in create(). Use this in CI when you pre-install the app and launch in setup (or via workflow steps).
  • -h, --help: Show help

Examples

  • Run a directory: npx @ohah/react-native-mcp-server test run path/to/e2e/ -p ios
  • Run a single file: npx @ohah/react-native-mcp-server test run path/to/suite.yaml -p android
  • Custom output dir: npx @ohah/react-native-mcp-server test run e2e/ -o e2e-artifacts/yaml-results
  • Keep going after failure: npx @ohah/react-native-mcp-server test run e2e/ --no-bail
  • CI (built artifact): node packages/react-native-mcp-server/dist/test/cli.js run examples/demo-app/e2e/ -p ios -o e2e-artifacts/yaml-results --no-auto-launch
  • HTML report: npx @ohah/react-native-mcp-server test run e2e/ -r html -o results
  • Slack: npx @ohah/react-native-mcp-server test run e2e/ -r slack --slack-webhook $SLACK_WEBHOOK
  • GitHub PR comment: In CI, -r github-pr -o results

Reporter types

ReporterDescription
consoleTerminal summary and step output (default).
junitoutput/junit.xml. CI JUnit report.
jsonoutput/results.json.
htmloutput/report.html. Visual report with screenshots.
slackSend results to Slack webhook. Requires --slack-webhook or SLACK_WEBHOOK_URL.
github-prPost comment on PR via gh pr comment when in a PR; otherwise writes output/pr-comment.md.

How to verify reporters

  • HTML: After running, open output/report.html in a browser and check suite/step summary and failure screenshots.
  • Slack: Run with -r slack and confirm the channel receives the summary and failure details.
  • GitHub PR: Run with -r github-pr on a PR and confirm the PR comment or output/pr-comment.md body.