---
title: Your First Maestro Flow on TestingBot | TestingBot
description: 'Chapter 4 wrote the calculator check in JavaScript against the WebDriver
  protocol. This chapter writes the same check as a Maestro flow: a YAML file of steps…'
source_url:
  html: https://testingbot.com/resources/courses/mobile-app-testing/first-maestro-flow
  md: https://testingbot.com/resources/courses/mobile-app-testing/first-maestro-flow.md
---

Course

[Mobile App Testing: From First Test to CI](https://testingbot.com/resources/courses/mobile-app-testing)

Chapter 6 of 10

1. [1 Mobile App Testing: What Makes It Different](https://testingbot.com/resources/courses/mobile-app-testing)
2. [2 Emulators, Simulators and Real Devices](https://testingbot.com/resources/courses/mobile-app-testing/emulators-simulators-and-real-devices)
3. [3 Choosing a Framework: Appium, Espresso, XCUITest, Maestro](https://testingbot.com/resources/courses/mobile-app-testing/choosing-a-framework)
4. [4 Uploading and Managing App Builds](https://testingbot.com/resources/courses/mobile-app-testing/app-builds-and-uploads)
5. [5 Your First Appium Test on a Real Device](https://testingbot.com/resources/courses/mobile-app-testing/first-appium-test)
6. [6 Your First Maestro Flow on TestingBot](https://testingbot.com/resources/courses/mobile-app-testing/first-maestro-flow)
7. [7 Running Espresso and XCUITest Suites in the Cloud](https://testingbot.com/resources/courses/mobile-app-testing/espresso-and-xcuitest)
8. [8 Device Matrix, Parallel Runs and CI](https://testingbot.com/resources/courses/mobile-app-testing/device-matrix-parallel-ci)
9. [9 Debugging Failed Mobile Test Runs](https://testingbot.com/resources/courses/mobile-app-testing/debugging-failed-runs)
10. [10 Knowledge Check](https://testingbot.com/resources/courses/mobile-app-testing/knowledge-check)

[Exit course](https://testingbot.com/resources/courses)

 Chapter 6 of 10 Beginner 5 min read 2 quick checks Updated Nov 2026 

# Your First Maestro Flow on TestingBot
On this page
1. [The flow](https://testingbot.com#the-flow)
2. [Run it on TestingBot](https://testingbot.com#run-it-on-testingbot)
3. [Other targets](https://testingbot.com#other-targets)
4. [Appium or Maestro for this check?](https://testingbot.com#appium-or-maestro-for-this-check)

Chapter 4 wrote the calculator check in JavaScript against the WebDriver protocol. This chapter writes the same check as a Maestro flow: a YAML file of steps that the Maestro engine plays on the device. Comparing the two is the quickest way to feel the trade-offs from chapter 2. The [Maestro course](https://testingbot.com/resources/courses/maestro) covers selectors, flow control, suites and CI in depth; here you run one flow in the cloud.

## The flow[#](https://testingbot.com#the-flow)

Create a folder `flows` with one file:

```yaml
# flows/add_numbers.yaml
appId: ${APP_ID}
---
- launchApp:
    clearState: true
- tapOn:
    id: inputA
    point: "90%,50%"
- eraseText
- inputText: "10"
- tapOn:
    id: inputB
    point: "90%,50%"
- eraseText
- inputText: "5"
- assertVisible: "15"
```

Reading it top to bottom:

- **`appId`** is the app's package name (Android) or bundle id (iOS). Here it comes from a variable, so one flow serves both platforms: `com.sampleapp` on Android and `org.reactjs.native.example.SampleApp` on iOS.
- **`launchApp` with `clearState: true`** starts the app from a clean state, so earlier runs cannot leak data into this one.
- **`tapOn` with `id`** finds the field by its identifier. The `point: "90%,50%"` taps the right-hand side of the field, so the cursor lands after the existing `0` and `eraseText` can delete it. (The Maestro course explains this bug in detail.)
- **`assertVisible: "15"`** waits until an element with exactly that text appears, and fails if it does not.

There is no driver, no session and no explicit wait. Maestro waits for the UI to settle after every step and retries assertions for a few seconds. That is the main reason short Maestro flows are rarely flaky, and also why you have less control than in Appium when you need it.

The sum field sometimes needs a moment to update after the second number is typed. What does the flow need?

 Nothing; `assertVisible` keeps looking for a few seconds before it fails A fixed sleep before the assertion A `retry` block around the whole flow

Maestro assertions poll, so a short delay is already covered. Fixed sleeps always cost their full time, and retrying the whole flow repeats every step and hides real problems. For genuinely slow screens, `extendedWaitUntil` takes an explicit timeout.

## Run it on TestingBot[#](https://testingbot.com#run-it-on-testingbot)

The TestingBot CLI uploads the app and the flows folder, starts the run and streams the result back. Log in once with `npx @testingbot/cli@1.5.0 login` (or set `TB_KEY` and `TB_SECRET`), download the sample app, and run the flow on an Android emulator:

```bash
curl -sSLo sample.apk https://testingbot.com/appium/sample.apk

npx @testingbot/cli@1.5.0 maestro sample.apk flows \
  --device "Pixel 8" --deviceVersion "14" \
  -e APP_ID=com.sampleapp \
  --name mobile-app-testing-course
```

The output, trimmed:

```
App ready. Project ID: 142983 (reuse this app later with --app-binary-id 142983)
Uploading Maestro Flows
Running Maestro Tests
  Run 147207 (Pixel 8): Watch in realtime:
     https://testingbot.com/members/maestro/142983/runs/147207
 33s PASSED Add Numbers
  Run 147207 (Pixel 8 - 14.0): Test completed successfully
All tests completed successfully!
```

That run went to a Pixel 8 emulator with Android 14 (session `b9242995e309-...`). The CLI exits with 0 when every flow passed, 2 when a flow failed and 1 for a CLI or infrastructure error, which is what a CI step needs.

A CI job runs the Maestro command above and the CLI exits with code 1. What does that tell you?

 The sum was wrong All flows passed but one was retried The app crashed during `launchApp` Something went wrong around the tests, such as credentials or an upload, rather than a flow failing

The CLI keeps test failures (exit code 2) apart from CLI and infrastructure errors (exit code 1). A wrong sum or an app crash fails a flow and gives 2. Keeping them apart lets a pipeline retry infrastructure problems without hiding real failures.

## Other targets[#](https://testingbot.com#other-targets)

The same flow runs on other devices by changing the flags, not the YAML:

- **iOS Simulator** : pass `sample.zip`, `--platform iOS`, an iPhone device name and `-e APP_ID=org.reactjs.native.example.SampleApp`.
- **Real devices** : add `--real-device`. An `.ipa` selects real iPhones automatically.
- **Any free device** : `--device` accepts patterns such as `"Pixel.*"`, which avoids waiting for one busy model.

`npx @testingbot/cli@1.5.0 devices --framework maestro` lists the emulators and simulators; add `--real` for physical devices. The [Maestro docs](https://testingbot.com/support/app-automate/maestro) and the [options reference](https://testingbot.com/support/app-automate/maestro/options) cover tunnels for private backends, pinning the Maestro version, tags, sharding and secrets.

## Appium or Maestro for this check?[#](https://testingbot.com#appium-or-maestro-for-this-check)

Side by side, the Maestro flow is shorter and needs no code to manage a session, report a result or wait. The Appium test gives you a real programming language, any assertion library and the whole WebDriver ecosystem, at the cost of more code. For the calculator, both are fine. For your app, chapter 2's questions decide: who maintains the tests, and what they need to reach.

[Previous · Chapter 5 Your First Appium Test on a Real Device](https://testingbot.com/resources/courses/mobile-app-testing/first-appium-test) [Next · Chapter 7 Running Espresso and XCUITest Suites in the Cloud](https://testingbot.com/resources/courses/mobile-app-testing/espresso-and-xcuitest)

On this page

1. [The flow](https://testingbot.com#the-flow)
2. [Run it on TestingBot](https://testingbot.com#run-it-on-testingbot)
3. [Other targets](https://testingbot.com#other-targets)
4. [Appium or Maestro for this check?](https://testingbot.com#appium-or-maestro-for-this-check)

Certification

Earn the free, resume-worthy TestingBot Mobile App Testing Certification for this course.

[How it works](https://testingbot.com/resources/courses/mobile-app-testing/certification)
