← Back to all posts

Maestro: Game Changer for React Native End-to-End Testing

EhsanBy Ehsan
6 min read
React NativeTestingE2E TestingMobile TestingMaestroQuality AssuranceAutomationTest AutomationYAMLCI/CD

Introduction

End-to-end testing in React Native has always been painful. Detox requires complex setup and constant maintenance. Appium is slow and flaky. Most teams either skip E2E tests entirely or fight with them constantly.

Then I found Maestro. It completely changed how I think about mobile testing.

What Makes Maestro Different

No flakiness - Maestro accepts that mobile UIs are unpredictable. Elements shift, animations delay, networks lag. Instead of fighting this, Maestro handles it automatically.

No sleep calls - You know those await sleep(2000) scattered everywhere in test code? Gone. Maestro waits intelligently for content to appear.

No compilation - Tests run instantly. Change your test, save, it reruns. Feedback in seconds, not minutes.

Simple setup - Download one binary. That's it. No Xcode configuration, no Android Studio plugins, no native dependencies.

Installation

Install Maestro:

curl -Ls "https://get.maestro.mobile.dev" | bash

Or with Homebrew:

brew tap mobile-dev-io/tap
brew install maestro

That's it. One command, you're ready to test.

Writing Your First Test

Tests are YAML files. No complex JavaScript, no imports, no boilerplate.

Create login-flow.yaml:

appId: com.yourapp
---
- launchApp
- tapOn: "Login"
- inputText: "[email protected]"
- tapOn: "Email"
- inputText: "password123"
- tapOn: "Password"
- tapOn: "Sign In"
- assertVisible: "Welcome back"

Run it:

maestro test login-flow.yaml

Maestro launches your app, runs the test, and shows results. Simple.

Here's another example:

appId: com.musicapp
---
# Launch and skip onboarding
- launchApp
- tapOn: "Skip"

# Search for a song
- tapOn: "Search"
- inputText: "Bohemian Rhapsody"
- assertVisible: "Queen"
- tapOn: "Bohemian Rhapsody"

# Play the song
- tapOn: "Play"
- assertVisible: "Now Playing"

# Add to playlist
- tapOn: "Add to Playlist"
- tapOn: "My Favorites"
- assertVisible: "Added to My Favorites"

# Verify in playlist
- tapOn: "Back"
- tapOn: "Library"
- tapOn: "My Favorites"
- assertVisible: "Bohemian Rhapsody"

No code. Just steps. Readable by anyone on your team.

Why It Actually Works

Built-in retries - Tap didn't register? Maestro tries again. Element not visible yet? It waits.

Smart waiting - Maestro knows when to wait and when to move forward. No manual timing.

Helpful errors - Tests fail with screenshots and clear messages. Debug in seconds.

Fast iteration - Watch mode reruns tests on file changes. See results immediately.

Running Tests

Run a single test:

maestro test flow.yaml

Run all tests in a folder:

maestro test flows/

Watch mode for development:

maestro test --continuous flow.yaml

Run on specific device:

maestro test --device emulator-5554 flow.yaml

Common Test Patterns

Conditional actions:

- tapOn:
    text: "Accept"
    optional: true

Scrolling to find elements:

- scrollUntilVisible:
    element: "Settings"
    direction: DOWN

Taking screenshots:

- takeScreenshot: home-screen

Waiting for specific conditions:

- assertVisible:
    text: "Loading"
    timeout: 10000

Input with delay:

- inputText: "search query"
- pressKey: Enter

Organizing Tests

Keep tests organized by feature:

maestro/
  ├── auth/
  │   ├── login.yaml
  │   ├── signup.yaml
  │   └── logout.yaml
  ├── player/
  │   ├── play-song.yaml
  │   ├── create-playlist.yaml
  │   └── add-to-favorites.yaml
  └── search/
      ├── search-songs.yaml
      └── search-artists.yaml

Run specific categories:

maestro test maestro/auth/
maestro test maestro/player/

CI/CD Integration

Add to your CI pipeline:

# GitHub Actions example
- name: Install Maestro
  run: |
    curl -Ls "https://get.maestro.mobile.dev" | bash
    echo "${HOME}/.maestro/bin" >> $GITHUB_PATH

- name: Run E2E tests
  run: maestro test maestro/

Works on GitHub Actions, GitLab CI, CircleCI, or any CI platform.

Maestro Cloud

For teams, Maestro offers cloud testing. Run tests on real devices in parallel:

maestro cloud maestro/

Tests run on 100+ device configurations. Results in minutes.

This is optional. Local testing works great for most teams.

Compared to Alternatives

vs Detox:

  • Maestro: Install one binary, write YAML
  • Detox: Configure native projects, write JavaScript, fight with timing

vs Appium:

  • Maestro: Fast, built for mobile
  • Appium: Slow, designed for web automation adapted to mobile

vs Manual testing:

  • Maestro: Automated, consistent, runs in CI
  • Manual: Slow, error-prone, doesn't scale

Tips for Success

Start simple - Test critical paths first. Login, checkout, core features.

Use descriptive IDs - Add testID props to important elements for reliable selection.

Keep tests independent - Each test should start fresh. Don't depend on previous test state.

Run locally first - Verify tests work on your machine before adding to CI.

Use screenshots - Capture state at key moments for debugging failed tests.

Don't overtest - Focus on user journeys, not every button. Unit tests cover details.

Why I Use Maestro

I've tried everything. Detox broke with every React Native upgrade. Appium was too slow. Manual testing doesn't scale.

Maestro just works. Setup takes minutes. Tests run reliably. Feedback is instant.

Most importantly, the team actually writes tests. YAML is easier than JavaScript. No compilation means faster iteration. Less friction means more coverage.

E2E testing finally makes sense.

Final Thoughts

If you've avoided E2E testing because it's too hard, try Maestro. If you're fighting with Detox, switch to Maestro. If you're doing manual regression testing, automate it with Maestro.

The barrier to E2E testing just disappeared. Download one binary, write some YAML, and you're testing your app end-to-end.

Your users care about flows, not functions. Test what matters.

Frequently Asked Questions

How does Maestro compare to Detox?

Maestro is simpler—install one binary and write YAML tests. Detox requires native project configuration and JavaScript tests. Maestro works across React Native versions without breaking, while Detox often needs fixes after upgrades.

Can I run Maestro tests in CI/CD?

Yes! Maestro runs in CI using Maestro Cloud or locally in CI runners. It's designed for automated testing pipelines and provides clear pass/fail results with screenshots for failed tests.

Is Maestro suitable for large apps?

Absolutely. Maestro handles large apps well. Tests run fast, and you can organize flows into separate files. Focus on critical user journeys rather than testing every screen.

Do I need to know programming to write Maestro tests?

No. Maestro uses simple YAML syntax that's readable by non-developers. If you can write a list of steps in plain English, you can write Maestro tests.

Can Maestro test both iOS and Android?

Yes. Most Maestro tests work on both platforms without changes. You can write platform-specific steps when needed using conditional flows.

Resources