LogoLogo
🚀 Run Maestro tests in the cloud →
  • Home
  • Star us on GitHub
  • Getting Started
    • What is Maestro?
    • Installing Maestro
      • macOS
      • Windows
      • Linux
    • Build and Install your App
      • Android
      • iOS
    • Run a Sample Flow
    • Writing Your First Flow
    • Maestro Studio
    • Running Flows on CI
  • Cloud
    • Run Maestro tests in the cloud
    • Cloud Quickstart
    • CI Integration
      • GitHub Actions
        • Maestro GitHub Action for Android
        • Maestro GitHub Action for iOS
        • Maestro GitHub Action for Flutter
      • Bitrise
      • Bitbucket Pipelines
      • CircleCI
      • Integration with any CI platform
    • Pull Request Integration
    • Cloud Reference
      • Build your app for the cloud
      • Configuring OS Version
      • Configuring device locale
      • Device timezones
      • Email Notifications
      • Slack Notifications
      • Webhook Integration
      • Managing Secrets
      • Limits
      • Reusing App Binary
      • IP Allowlist
      • System Status
  • Platform Support
    • Supported Platforms
    • Android - Views
    • Android - Jetpack Compose
    • iOS - UIKit
    • iOS - SwiftUI
    • React Native
    • Flutter
    • Web Views
    • Web (Desktop Browser)
  • Examples
    • Android contacts flow automation
    • Facebook signup flow automation
    • Advanced: Wikipedia Android
    • Page Object Model
  • CLI
    • Cloud
    • Test Suites & Reports
    • Tags
    • Record Your Flow
    • Continuous Mode
    • View Hierarchy
    • Start Device
  • API Reference
    • Commands
      • addMedia
      • assertVisible
      • assertNotVisible
      • assertTrue
      • assertWithAI
      • assertNoDefectsWithAi
      • back
      • clearKeychain
      • clearState
      • copyTextFrom
      • evalScript
      • eraseText
      • extendedWaitUntil
      • extractTextWithAI
      • hideKeyboard
      • inputText
      • killApp
      • launchApp
      • openLink
      • pressKey
      • pasteText
      • repeat
      • retry
      • runFlow
      • runScript
      • scroll
      • scrollUntilVisible
      • setAirplaneMode
      • setLocation
      • startRecording
      • stopApp
      • stopRecording
      • swipe
      • takeScreenshot
      • toggleAirplaneMode
      • tapOn
      • doubleTapOn
      • longPressOn
      • travel
      • waitForAnimationToEnd
    • Common command arguments
    • Selectors
    • Configuration
      • Workspace configuration
      • Flow configuration
      • AI configuration
  • Advanced
    • Nested Flows
    • Wait
    • Loops
    • Conditions
    • Parameters & Constants
    • JavaScript
      • Run JavaScript
      • Outputs
      • Logging
      • Access element text
      • Make HTTP requests
      • GraalJS support
      • JavaScript announcement blog
    • Specify a Device
    • Configure Permissions
    • Detect Maestro in your app
    • Configure Maestro driver timeout
    • onFlowStart / onFlowComplete hooks
    • Test in different locales
    • Structuring your test suite
  • Troubleshooting
    • Known Issues
    • Frequently Asked Questions
    • Bug Report
    • Rollback Maestro
    • Debug Output
    • HOWTOs
      • Arrange your repository for Maestro tests
      • scrollUntilVisible for fragments
  • Community
    • Contributions
    • Articles & Tutorials
    • Case Studies
    • Resources
Powered by GitBook

Read to wire into CI or scale up your testing?

  • Run Maestro tests in the cloud →
On this page
  • Labels
  • Optional

Was this helpful?

Edit on GitHub
  1. API Reference

Common command arguments

Some arguments are common to all commands.

Labels

Each Maestro command accepts an optional label attribute that lets you customize the command's name:

- tapOn:
    id: buy-now
    label: Tap on Buy Now button
    
- inputText:
    label: Input the company email
    text: maestro@mobile.dev

- swipe:
    direction: LEFT
    label: Swipe for onboarding
✅ Tap on Buy Now button
✅ Input the company email
✅ Swipe for onboarding

Setting a label can have an additional advantage of being able to remove sensitive content from console output, for example this:

✅ Tap on "Password"
✅ Input text "mySecr3tPassw0rd!"

becomes:

✅ Tap on "Password"
✅ Enter the test user's password

The values will still appear in the logs of the run.

Labels are also a useful alternative to comments for contributors trying to understand the intent of a particular step.

- extendedWaitUntil:
    visible: Recommended Products
    timeout: 5000
    label: Wait for all personalized content to load

Optional

Each Maestro command accepts an optional optional attribute that lets control what should happen if the command fails.

- launchApp: com.example.example
- assertVisible:
    text: Summer sale is here!
    optional: true
- tapOn: Sign up now!

If optional is set to true, the flow will continue executing even if the command fails. The warning will be displayed:

✅ Launch app "com.example.example"
⚠️ Assert that "Summer sale is here!" is visible (warned)
✅ Tap on "Sign up now!"

The default value of optional for almost all commands is false, which means that the flow will stop executing if any command fails. The only exception (at least for now) are AI-powered commands, which have optional set to true by default.

Setting the optional attribute doesn't make sense on some commands, e.g. back or startRecording. Nevertheless, it's still possible to set it, but it won't have any effect.

PreviouswaitForAnimationToEndNextSelectors

Last updated 9 months ago

Was this helpful?