Exit course
Chapter 6 of 10 Beginner 5 min read 2 quick checks Updated

Your First Maestro Flow on TestingBot

On this page
  1. The flow
  2. Run it on TestingBot
  3. Other targets
  4. 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 covers selectors, flow control, suites and CI in depth; here you run one flow in the cloud.

The flow#

Create a folder flows with one file:

# 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?

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#

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:

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 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#

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 and the options reference cover tunnels for private backends, pinning the Maestro version, tags, sharding and secrets.

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.