| name | maestro-testing |
| description | Maestro E2E testing patterns for React Native. Use when implementing end-to-end tests. |
Maestro Testing Skill
This skill covers Maestro E2E testing for React Native apps.
When to Use
Use this skill when:
- Writing E2E tests
- Testing user flows
- Automating UI testing
- CI/CD testing
Core Principle
YAML SIMPLICITY - Maestro uses simple YAML syntax for readable, maintainable tests.
Installation
curl -Ls "https://get.maestro.mobile.dev" | bash
maestro -v
Project Structure
__tests__/
└── e2e/
├── flows/
│ ├── login.yaml
│ └── common.yaml
├── login_flow.yaml
├── signup_flow.yaml
├── navigation_flow.yaml
└── checkout_flow.yaml
Basic Test
appId: com.myapp
---
- launchApp
- tapOn: "Email"
- inputText: "test@example.com"
- tapOn: "Password"
- inputText: "password123"
- tapOn: "Sign In"
- assertVisible: "Welcome"
Common Commands
App Control
- launchApp
- launchApp:
clearState: true
- stopApp
Tap Actions
- tapOn: "Button Text"
- tapOn:
id: "submit-button"
- tapOn:
text: "Item"
index: 0
- longPressOn: "Delete"
Text Input
- inputText: "Hello World"
- clearText
- inputText: "New Text"
- tapOn: "Email"
- inputText: "user@example.com"
Assertions
- assertVisible: "Success"
- assertNotVisible: "Error"
- extendedWaitUntil:
visible: "Loaded"
timeout: 10000
Scrolling
- scroll
- scrollUntilVisible:
element: "Target Item"
direction: DOWN
timeout: 10000
- scroll:
element:
id: "scrollable-list"
direction: DOWN
Swipe Gestures
- swipe:
direction: LEFT
start: "Item to delete"
- swipe:
direction: DOWN
start:
above: "First Item"
Waiting
- waitForAnimationToEnd
- wait: 2000
- extendedWaitUntil:
visible: "Element"
timeout: 5000
Screenshots
- takeScreenshot: screen_name
Flow Composition
Reusable Flows
- tapOn: "Email"
- inputText: ${email}
- tapOn: "Password"
- inputText: ${password}
- tapOn: "Sign In"
- assertVisible: "Welcome"
- launchApp
- runFlow:
file: flows/login.yaml
env:
email: "test@example.com"
password: "password123"
- tapOn: "Profile"
Conditional Flows
- runFlow:
when:
visible: "Accept Cookies"
commands:
- tapOn: "Accept"
- tapOn: "Continue"
Environment Variables
appId: ${APP_ID}
---
- launchApp
- tapOn: "Email"
- inputText: ${TEST_EMAIL}
APP_ID=com.myapp TEST_EMAIL=test@test.com maestro test test.yaml
Platform-Specific Tests
- runFlow:
when:
platform: iOS
commands:
- tapOn: "iOS Settings"
- runFlow:
when:
platform: Android
commands:
- tapOn: "Android Settings"
Complete Test Examples
Login Flow
appId: com.myapp
---
- launchApp:
clearState: true
- tapOn: "Sign In"
- tapOn:
id: "email-input"
- inputText: "test@example.com"
- tapOn:
id: "password-input"
- inputText: "password123"
- tapOn:
id: "login-button"
- waitForAnimationToEnd
- assertVisible: "Welcome back"
- assertVisible: "Home"
- takeScreenshot: login_success
Form Validation
appId: com.myapp
---
- launchApp
- tapOn: "Submit"
- assertVisible: "Email is required"
- tapOn: "Email"
- inputText: "invalid"
- tapOn: "Submit"
- assertVisible: "Invalid email"
- clearText
- inputText: "valid@example.com"
- tapOn: "Password"
- inputText: "ValidPass123!"
- tapOn: "Submit"
- assertVisible: "Success"
Navigation Flow
appId: com.myapp
---
- launchApp
- tapOn:
id: "tab-home"
- assertVisible: "Home Screen"
- tapOn:
id: "tab-search"
- assertVisible: "Search"
- tapOn:
id: "tab-profile"
- assertVisible: "Profile"
- tapOn: "Settings"
- assertVisible: "Settings"
- back
- assertVisible: "Profile"
Running Tests
maestro test __tests__/e2e/login_flow.yaml
maestro test __tests__/e2e/
maestro test __tests__/e2e/ --platform ios
maestro test __tests__/e2e/ --format junit --output results/
CI/CD Integration
name: E2E Tests
on: [push, pull_request]
jobs:
e2e:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Install dependencies
run: npm ci
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Build app
run: npx expo prebuild && npx expo run:ios
- name: Run E2E tests
run: maestro test __tests__/e2e/
-
Notes
- Requires simulator/emulator running
- Use accessibility IDs for reliable selection
- Keep tests independent
- Use reusable flows for common actions
- Test on both platforms
- Consider Maestro Cloud for CI