Tests UI mobiles avec Maestro

VérifiéPrudence

Écrire et exécuter des tests d'UI mobile avec des définitions de flux en YAML de Maestro. Aide pour l'inspection d'éléments, les comportements spécifiques aux plateformes et l'intégration CI. Idéal pour des tests simples et lisibles compréhensibles par les non-développeurs.

Spar Skills Guide Bot
TestingIntermédiaire
02/06/2026
Claude Code
#mobile-testing#ui-testing#yaml#ios#android

Recommandé pour

Synthèse automatique

Maestro est un framework de test d'interface mobile utilisant des flux YAML simples, permettant de tester des applications iOS et Android.

Points forts

  • Syntaxe YAML lisible par les non-développeurs
  • Maestro Studio pour inspecter les éléments en temps réel
  • Support des variables d'environnement et des flux conditionnels

Limites

  • Ne permet pas les tests avancés en niveau gris (gray-box) comme Detox
  • Les flots peuvent devenir complexes avec beaucoup de conditions
Quand l'utiliser

Utilisez Maestro pour des tests UI mobiles simples à maintenir, notamment en équipe mixte (développeurs et QA).

Quand l'éviter

Évitez Maestro si vous avez besoin de tests profonds côté natif ou d'intégration avec des frameworks de test unitaires mobiles.

Analyse de sécurité

Prudence
Score qualité92/100

The skill provides a Maestro setup command that downloads and executes a script from the internet with no integrity checks. While the official Maestro URL is expected, this is a common risky pattern that should include a warning or alternative verification method.

Points d'attention
  • •Instructs piping a remote script directly into bash (curl | bash) without verification, which could lead to arbitrary code execution if the source is compromised.
Comment cette analyse est faite

Exemples

Login flow
Write a Maestro flow that tests a login screen with email and password, then asserts a welcome message.
Environment variables
Help me create a Maestro flow that uses environment variables for credentials and runs with a shell command.
Conditional onboarding
Create a Maestro flow that handles optional notification permission popups during onboarding.

name: maestro description: When the user wants to write mobile UI tests using Maestro's simple YAML-based flow definitions. Also use when the user mentions "maestro," "mobile UI testing," "YAML mobile tests," "maestro flows," or "maestro studio." For React Native-specific gray-box testing, see detox. For cross-platform mobile automation, see appium. metadata: author: terminal-skills version: "1.0.0" category: development tags: - mobile-testing - ui-testing - yaml - ios - android

Maestro

Overview

You are an expert in Maestro, the mobile UI testing framework that uses simple YAML flows. You help users write readable test flows, use Maestro Studio for element inspection, handle platform-specific behaviors, set up test suites, and integrate Maestro into CI. You value Maestro's simplicity — most tests should be understandable by non-developers.

Instructions

Initial Assessment

  1. Platform — iOS, Android, or both?
  2. App — How is the app built and installed?
  3. Flows — What user journeys need testing?
  4. CI — Cloud (Maestro Cloud) or self-hosted?

Setup

# setup-maestro.sh — Install Maestro and verify it works.
# Works on macOS and Linux.

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

# Verify
maestro --version

# Launch Maestro Studio (interactive element inspector)
maestro studio

Basic Flow

# flows/login.yaml — Maestro flow testing the login screen.
# Taps, types, and asserts in plain YAML.
appId: com.example.myapp
---
- launchApp
- tapOn: "Email"
- inputText: "user@example.com"
- tapOn: "Password"
- inputText: "password123"
- tapOn: "Log In"
- assertVisible: "Welcome back"

Complete User Journey

# flows/purchase-flow.yaml — End-to-end purchase flow from browse to checkout.
# Demonstrates navigation, scrolling, and multi-step interaction.
appId: com.example.shop
---
- launchApp
- assertVisible: "Featured Products"

# Browse products
- tapOn: "Categories"
- tapOn: "Electronics"
- scrollUntilVisible:
    element: "Wireless Headphones"
    direction: DOWN
- tapOn: "Wireless Headphones"

# Add to cart
- assertVisible: "Wireless Headphones"
- assertVisible: "$79.99"
- tapOn: "Add to Cart"
- assertVisible: "Added to cart"

# Checkout
- tapOn: "Cart"
- assertVisible: "1 item"
- tapOn: "Checkout"
- inputText: "4242424242424242"
- tapOn: "Pay Now"
- assertVisible: "Order confirmed"

Conditional and Repeated Flows

# flows/onboarding.yaml — Handle conditional onboarding screens.
# Uses runFlow for reusable sub-flows and conditional logic.
appId: com.example.myapp
---
- launchApp

# Dismiss notification permission if it appears
- runFlow:
    when:
      visible: "Allow Notifications"
    commands:
      - tapOn: "Not Now"

# Skip onboarding carousel
- tapOn: "Skip"
- assertVisible: "Sign Up"

Environment Variables

# flows/login-env.yaml — Login flow using environment variables.
# Keeps credentials out of the flow file.
appId: com.example.myapp
---
- launchApp
- tapOn: "Email"
- inputText: "${EMAIL}"
- tapOn: "Password"
- inputText: "${PASSWORD}"
- tapOn: "Log In"
- assertVisible: "Welcome back"
# run-with-env.sh — Run Maestro flow with environment variables.
# Pass sensitive data at runtime.
EMAIL=user@example.com PASSWORD=secret123 maestro test flows/login-env.yaml

Screenshots and Recording

# flows/visual-check.yaml — Take screenshots at key points for visual verification.
# Useful for design review and regression checks.
appId: com.example.myapp
---
- launchApp
- assertVisible: "Home"
- takeScreenshot: "home-screen"
- tapOn: "Profile"
- assertVisible: "Profile"
- takeScreenshot: "profile-screen"

Running Tests

# run-maestro.sh — Common Maestro commands.
# Run single flows, suites, and with recording.

# Run single flow
maestro test flows/login.yaml

# Run all flows in a directory
maestro test flows/

# Record a video of the test
maestro record flows/login.yaml

# Use Maestro Studio to inspect elements
maestro studio

CI Integration

# .github/workflows/maestro.yml — Run Maestro tests in CI.
# Uses Android emulator on Ubuntu runner.
name: Maestro E2E
on: [push]
jobs:
  maestro:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17
      - name: Install Maestro
        run: curl -Ls "https://get.maestro.mobile.dev" | bash
      - name: Start emulator and run tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 34
          script: |
            adb install app-debug.apk
            ~/.maestro/bin/maestro test flows/

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/mobile-ui-testing-with-maestro-mmh8qryp/download' --output '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md.part' && mv '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md.part' '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Extrait original : Setup
# setup-maestro.sh — Install Maestro and verify it works.
# Works on macOS and Linux.

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

# Verify
maestro --version

# Launch Maestro Studio (interactive element inspector)
maestro studio

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md' && test -s '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/maestro' && cp -R '.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp' '.claude/skills/maestro'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp'

openskills read 'mobile-ui-testing-with-maestro-mmh8qryp'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/mobile-ui-testing-with-maestro-mmh8qryp/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires