惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Troy Hunt's Blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
T
Tenable Blog
L
LINUX DO - 热门话题
V
Visual Studio Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
SecWiki News
SecWiki News
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Project Zero
Project Zero
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Recorded Future
Recorded Future
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
S
Securelist
Spread Privacy
Spread Privacy
L
LangChain Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Last Watchdog
The Last Watchdog
Attack and Defense Labs
Attack and Defense Labs
博客园 - 司徒正美
Help Net Security
Help Net Security
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
PCI Perspectives
PCI Perspectives
博客园 - 【当耐特】
T
Tor Project blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
E2E Testing React Native with Maestro: A Practical Guide
PEAKIQ · 2026-05-06 · via DEV Community

Originally published on PEAKIQ

Source: https://www.peakiq.in/blog/e2e-testing-your-react-native-app-with-maestro



E2E Testing Your React Native App with Maestro

Writing end-to-end tests for mobile apps has always been painful. Appium needs drivers. Detox needs native build hooks. Everything breaks when your UI shifts by 4 pixels. Maestro changes that. It talks to your app the same way a user does — through the accessibility layer — and writes tests in plain YAML.

This guide covers everything: installation, writing your first flow, handling iOS quirks, and plugging Maestro into your CI pipeline.


Why Maestro?

Before we dive in, here's why Maestro stands out against the traditional tools.

Feature Maestro Detox Appium
Setup complexity Minimal High Very High
Language YAML JS/TS JS/Python/Java
Platform support iOS + Android iOS + Android iOS + Android
Zero app changes
Flakiness handling Built-in auto-wait Manual sleeps Manual sleeps
Expo support ✅ First-class Limited Limited

Info: Maestro operates entirely at the accessibility layer. It doesn't touch your JavaScript source, doesn't need npm packages inside your app, and tests the final compiled binary — just like a real user would use it.


Prerequisites

  • Node.js ≥ 18
  • React Native CLI or Expo project
  • For iOS: Xcode + Simulator running
  • For Android: Android Studio + AVD Manager with an emulator running

Installation

Step 1 — Install Maestro CLI

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

Enter fullscreen mode Exit fullscreen mode

Maestro is compatible with macOS, Windows, and Linux. Verify the install:

maestro --version

Enter fullscreen mode Exit fullscreen mode

Step 2 — Start your simulator/emulator

iOS (macOS only):

open -a Simulator

Enter fullscreen mode Exit fullscreen mode

Android:

emulator -avd Pixel_6_API_33

Enter fullscreen mode Exit fullscreen mode

Step 3 — Install and launch your app

# React Native CLI
npx react-native run-ios
npx react-native run-android

# Expo
npx expo start --ios
npx expo start --android

Enter fullscreen mode Exit fullscreen mode


Your First Flow

Create a .maestro/ folder at the root of your project. This is where all your test flows live.

your-app/
├── .maestro/
│   ├── sign-in-flow.yaml
│   └── onboarding-flow.yaml
├── src/
└── package.json

Enter fullscreen mode Exit fullscreen mode

Here's a minimal flow that launches your app and taps a button:

# .maestro/sign-in-flow.yaml
appId: com.yourapp.bundle
---
- launchApp
- tapOn: "Sign In"
- inputText:
    text: "hello@example.com"
    label: "Email"
- inputText:
    text: "supersecret"
    label: "Password"
- tapOn: "Continue"
- assertVisible: "Welcome back"

Enter fullscreen mode Exit fullscreen mode

Run it:

maestro test .maestro/sign-in-flow.yaml

Enter fullscreen mode Exit fullscreen mode

That's it. No compilation step, no linking, no driver setup.


Targeting Components

Maestro gives you two clean ways to target elements in your React Native app.

By visible text

If your component renders visible text, Maestro can find it directly:

- tapOn: "Add to Cart"
- assertVisible: "Item added"

Enter fullscreen mode Exit fullscreen mode

By testID

For components without unique visible text (icons, image buttons), add a testID:

<TouchableOpacity testID="submit-button" onPress={handleSubmit}>
  <Icon name="arrow-right" />
</TouchableOpacity>

Enter fullscreen mode Exit fullscreen mode

Then in your flow:

- tapOn:
    id: "submit-button"

Enter fullscreen mode Exit fullscreen mode

Tip: Prefer testID over text matching for interactive elements. It decouples your tests from copy changes and internationalization.


Handling Text Input

Text input requires two steps: focus the field, then type.

Your React Native component:

<TextInput
  testID="email-input"
  placeholder="Enter your email"
  onChangeText={setEmail}
  keyboardType="email-address"
/>

Enter fullscreen mode Exit fullscreen mode

Your Maestro flow:

- tapOn:
    id: "email-input"
- inputText: "hello@maestro.dev"
- hideKeyboard

Enter fullscreen mode Exit fullscreen mode


Assertions

Maestro ships with a concise set of assertions out of the box.

# Assert an element is visible
- assertVisible: "Dashboard"

# Assert by testID
- assertVisible:
    id: "user-avatar"

# Assert something is NOT on screen
- assertNotVisible: "Loading..."

# Assert text content
- assertVisible:
    text: "You have 3 notifications"

Enter fullscreen mode Exit fullscreen mode


Handling iOS Nested Accessibility (Common Gotcha)

On iOS, React Native sometimes "swallows" touch events when components are deeply nested. You'll hit this when trying to tap something inside a Pressable or TouchableOpacity that's inside another tappable container.

The fix — in your React Native component:

// ❌ Before — inner Text is unreachable
<TouchableOpacity onPress={handlePress}>
  <View>
    <Text>Tap me</Text>
  </View>
</TouchableOpacity>

// ✅ After — disable accessibility on outer, enable on inner
<TouchableOpacity accessible={false} onPress={handlePress}>
  <View>
    <Text accessible={true} testID="tap-target">Tap me</Text>
  </View>
</TouchableOpacity>

Enter fullscreen mode Exit fullscreen mode

Your flow stays clean:

- tapOn:
    id: "tap-target"

Enter fullscreen mode Exit fullscreen mode


Advanced: Parameterized Flows

Avoid duplicating flows for different test scenarios. Use Maestro's parameter support:

# .maestro/sign-in-flow.yaml
appId: com.yourapp.bundle
---
- launchApp
- tapOn: "Email"
- inputText: ${EMAIL}
- tapOn: "Password"
- inputText: ${PASSWORD}
- tapOn: "Sign In"
- assertVisible: "Dashboard"

Enter fullscreen mode Exit fullscreen mode

Run with parameters:

maestro test .maestro/sign-in-flow.yaml \
  -e EMAIL=test@example.com \
  -e PASSWORD=mypassword

Enter fullscreen mode Exit fullscreen mode

This is especially powerful for testing multiple user roles or locales without duplicating flow files.


Running a Full Test Suite

Run every flow in your .maestro/ directory with a single command:

maestro test .maestro/

Enter fullscreen mode Exit fullscreen mode

Maestro will execute all .yaml files sequentially and report results for each one.


Integrating with CI/CD

GitHub Actions

# .github/workflows/e2e.yml
name: E2E Tests

on:
  push:
    branches: [main]
  pull_request:

jobs:
  e2e-android:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up JDK
        uses: actions/setup-java@v4
        with:
          distribution: "temurin"
          java-version: "17"

      - name: Install Maestro
        run: curl -Ls "https://get.maestro.mobile.dev" | bash

      - name: Build APK
        run: cd android && ./gradlew assembleDebug

      - name: Start emulator
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 33
          script: |
            adb install android/app/build/outputs/apk/debug/app-debug.apk
            maestro test .maestro/

Enter fullscreen mode Exit fullscreen mode

Maestro Cloud (Optional)

For parallel execution across real devices, push to Maestro Cloud:

maestro cloud \
  --apiKey $MAESTRO_API_KEY \
  android/app/build/outputs/apk/debug/app-debug.apk \
  .maestro/

Enter fullscreen mode Exit fullscreen mode

This gives you a visual dashboard of historical runs, device logs, and screenshots on failure.


Sample App: Complete Example

Here's a minimal React Native screen and its corresponding Maestro flow.

App.tsx:

import React, { useState } from "react";
import { SafeAreaView, Button, Text, TextInput, StyleSheet } from "react-native";

export default function App() {
  const [taps, setTaps] = useState(0);
  const [text, setText] = useState("");

  return (
    <SafeAreaView style={styles.container}>
      <Button title="Add one" onPress={() => setTaps(taps + 1)} />
      <Button
        title="Add ten"
        testID="add_ten"
        onPress={() => setTaps(taps + 10)}
      />
      <Text>Number of taps: {taps}</Text>
      <TextInput
        testID="text_input"
        placeholder="Change me!"
        onChangeText={setText}
        style={styles.input}
      />
      <Text>You typed: {text}</Text>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, alignItems: "center", justifyContent: "center" },
  input: { borderWidth: 1, width: 200, padding: 8, marginTop: 12 },
});

Enter fullscreen mode Exit fullscreen mode

.maestro/counter-flow.yaml:

appId: com.myapp
---
- launchApp
- tapOn: "Add one"
- tapOn:
    id: "add_ten"
- assertVisible: "Number of taps: 11"
- tapOn: "Change me!"
- inputText: "Hello, Maestro!"
- assertVisible: "You typed: Hello, Maestro!"

Enter fullscreen mode Exit fullscreen mode


Tips for Reliable Tests

  1. Always use testID for anything interactive. Text changes. testID doesn't (unless you change it deliberately).
  2. Don't use sleep. Maestro automatically waits for elements to appear. Explicit sleeps are a code smell — if you think you need one, something else is wrong.
  3. Keep flows small and composable. One flow = one user journey. A sign-in flow shouldn't also test the profile page.
  4. Reset app state between runs. Use clearState: true in launchApp to ensure a clean slate:
- launchApp:
    clearState: true

Enter fullscreen mode Exit fullscreen mode

  1. Use runFlow for shared setup:
# .maestro/helpers/login.yaml
---
- tapOn: "Email"
- inputText: ${EMAIL}
- tapOn: "Sign In"

Enter fullscreen mode Exit fullscreen mode

# Your main flow
---
- launchApp
- runFlow: helpers/login.yaml
- assertVisible: "Dashboard"

Enter fullscreen mode Exit fullscreen mode


Conclusion

Maestro removes the friction from mobile E2E testing. No native bridges, no custom drivers, no flaky sleeps — just YAML that reads like a QA script and runs like a charm.

With full support for both Expo and React Native CLI, built-in handling of timing and async UI, and a one-line CI setup, there's very little reason not to add Maestro to your project today.

Get started:

curl -Ls "https://get.maestro.mobile.dev" | bash
maestro test .maestro/your-first-flow.yaml

Enter fullscreen mode Exit fullscreen mode

Happy testing.


Resources