Maestro Tutorial: Mobile UI Testing on physical devices (Free Course + Certification)

A hands-on Maestro tutorial: from your first YAML flow on an Android emulator to a tagged suite running on real iOS and Android devices in the cloud and in CI. Every demo in this video is a real run of the course code, on a local emulator and on TestingBot.

What you'll learn

  • How Maestro works: it reads the screen through the accessibility layer, waits until the screen settles and sends real touches
  • Installing Maestro and running your first flow with maestro test
  • Selectors and the core commands: tapOn, inputText, eraseText, assertVisible, scroll and more
  • Subflows, conditions, loops and JavaScript in a flow
  • iOS vs Android: app ids, clearState and clearKeychain, permissions, launch arguments and deep links
  • Debugging flaky flows: reading the CLI output, Maestro Studio and the view hierarchy, retries and reports
  • Organising a suite with config.yaml, folders and tags
  • Running flows on emulators and physical devices on TestingBot with testingbotctl, in parallel across a device matrix
  • The TestingBot dashboard: runs, flow history, logs, session videos (also from physical devices) and a live view while a test runs
  • Running Maestro in CI pipelines

The full course, with code, quick checks and a knowledge check, is free and needs no account: Maestro Tutorial: Mobile UI Testing on physical devices. Free TestingBot Maestro certification (pass the exam and run 2 passing tests on 2 device configurations on TestingBot; issued by TestingBot, not by the Maestro project): certification details.

Chapters

  • 0:00 Course introduction
  • 1:09 Maestro Tutorial: Mobile UI Tests in YAML
  • 1:33 Chapter 1: Install Maestro and Run Your First Flow
  • 2:29 Chapter 2: Maestro Selectors and Core Commands
  • 2:56 Chapter 3: Subflows, Conditions, Loops and JavaScript
  • 3:51 Chapter 4: iOS vs Android: Permissions, State, Links
  • 4:51 Chapter 5: Debugging Flaky Maestro Flows
  • 5:50 Chapter 6: Organising a Maestro Suite
  • 6:37 Tips: Writing good flows
  • 9:12 Chapter 7: Run Maestro Flows on TestingBot
  • 12:42 Dashboard: Your runs in the TestingBot dashboard
  • 14:38 Chapter 8: Running Maestro in CI Pipelines
  • 15:00 Chapter 9: Knowledge check

Video transcript

Course introduction

Hi, and welcome to TestingBot's free Maestro course. This course teaches Maestro, the mobile UI testing framework where every test is a short YAML file. You don't need to be a programmer: if you can read a list of steps, you can read a Maestro flow. You'll need Java 17 and an Android emulator or an iOS simulator. You build one suite for a small calculator app. You write a first flow, learn selectors and the core commands, and reuse steps with subflows, variables and JavaScript. Then you handle the differences between iOS and Android, debug flaky flows, organise the suite with tags, and run it in CI. In chapter seven, the same flows run on TestingBot, in parallel: on emulators and simulators, and on physical iPhones and Android phones. The dashboard shows every run, with video even from physical devices, and a live view while a test runs. At the end, you can earn the free TestingBot certification. Let's get started.

Maestro Tutorial: Mobile UI Tests in YAML

Maestro doesn't link into your app or need its source code. It reads the screen through the accessibility layer, the same view tree a screen reader uses, and sends real touches through the operating system. Each step waits for the screen to settle, and assertions keep looking for a few seconds before they fail. That's why a flow has no sleeps.

Chapter 1: Install Maestro and Run Your First Flow

Chapter one installs the Maestro CLI, which needs Java 17 or newer, and puts the sample app on an emulator. The first flow launches the app with a clean state, types ten and five, and checks that fifteen appears. Pin the Maestro version your team uses, and name the device when more than one is connected. Here it runs on an Android emulator. maestro test runs the flow on the emulator. It launches the app with a clean state, then taps each field, clears it and types: ten, then five. Fifteen is visible, the screenshot is saved, and every step completed.

Chapter 2: Maestro Selectors and Core Commands

Chapter two is about selectors. A plain string matches visible text, and that text is a regular expression that must match the whole value. An id is invisible to users, so it survives copy changes. And there's a real bug from this app: on iOS, tapping the middle of a field put the cursor before the zero, so ten became one hundred.

Chapter 3: Subflows, Conditions, Loops and JavaScript

Chapter three makes flows reusable. Repeated steps move into a subflow, data comes in as variables with defaults, a when block handles platform differences, and a small JavaScript file computes the expected result. Here the same flow runs with twenty and twenty-two from the command line, and checks for forty-two. The table flow, with A and B passed on the command line. The subflow types twenty and twenty-two. The script computes the expected value, the flow checks that forty-two is visible, and the when block hides the keyboard on Android.

Chapter 4: iOS vs Android: Permissions, State, Links

Chapter four covers iOS and Android. One flow can drive both builds when the app id is a variable. Clearing state works differently on each platform, launchApp grants every permission unless you say otherwise, and deep links come with their own dialogs. Here both flows run with the Android app id passed in. The whole flows folder, with the Android app id. Maestro runs every flow in the folder, one after the other. Two flows passed.

Chapter 5: Debugging Flaky Maestro Flows

Chapter five is a method for flaky flows. Read what the CLI printed, and look at the screenshot of the failing step. Then check the view hierarchy, classify the flake, and only then decide about retries. For CI, write the artifacts to a known folder, with a JUnit report next to them. The same run, now writing its artifacts for CI. Screenshots and logs go to a known folder, and the results to a JUnit file. Both passed, and the build folder holds the JUnit report and a results folder per flow.

Chapter 6: Organising a Maestro Suite

Chapter six organises the suite. Flows move into a dot maestro workspace, config dot yaml decides which folders run, and tags select what runs: smoke tests on every pull request, everything nightly. Each flow must pass on a freshly reset device. Here, only the flow tagged smoke runs. The dot maestro workspace, with only the smoke tag included. config dot yaml collects the calculator folder. Of its two flows, only Add two numbers is tagged smoke. One flow ran, and it passed.

Tips: Writing good flows

Before the suite moves to the cloud, a few habits that keep flow files easy to read and hard to break. Most of them come back from earlier chapters, so this is the short version: one journey per flow, ids over text, subflows for anything you repeat, variables instead of hard-coded data, and no sleeps. Then two commands to run before you push. Give each flow one user journey, a name that reads well in a report, and tags. Let every flow set up its own starting point, so it passes on a freshly reset device. A flow that only passes after another one breaks the day flows run in parallel. Prefer ids: users never see them, so they survive new copy and translations. Text selectors are regular expressions that must match the whole text, so escape dollar signs, dots and brackets, and use dot star for a partial match. Anything you type twice belongs in a subflow, with the values that change passed as env. Keep subflows in their own folder that config dot yaml does not list, so they never run as tests on their own. Pass data in as variables with sensible defaults, so the same flow runs with other values from the command line. Passwords and tokens never go in a flow file: pass them at run time, as CI secrets, or with secret env on TestingBot, where they are masked. Leave out sleeps. Maestro waits for the screen to settle after every step, and assertions keep looking for about seven seconds. When something really takes longer, like a payment, wait for it with extended wait until and a realistic timeout. For a prompt that only sometimes appears, mark the step optional and give it a label that says why. Platform differences go in a when block. Use both sparingly: a flow full of branches is hard to trust. Before you push, run check syntax: it catches YAML mistakes without a device. When a selector does not match, maestro hierarchy, or Maestro Studio, shows what the screen really exposes. And keep a test output folder, so a failing run leaves its screenshots and logs.

Chapter 7: Run Maestro Flows on TestingBot

Chapter seven runs the same workspace on TestingBot, without changing a single flow. testingbotctl, the TestingBot CLI, uploads the app and the flows. TestingBot runs them on Android emulators and iOS simulators, and on physical Android phones and iPhones, and by default each flow gets its own device session, in parallel. Here a device matrix runs both flows on a Pixel 9 emulator and on a real Pixel 11, one session per device. To run flows on TestingBot you use testingbotctl, the TestingBot CLI. Install it from npm as at testingbot slash cli; the command is testingbot. testingbot login opens your browser and stores your key and secret, and whoami shows your plan and how many sessions can run in parallel. On a CI runner there is no browser, so set TB_KEY and TB_SECRET instead. You find both in the member area, under Settings, Security. Keep them in your CI secrets, never in the repository. One command: the app, the dot maestro folder, and two devices. The app has not changed, so it is reused. The flows are bundled, and each device gets one run, with both flows in a single session. The Pixel 9 emulator starts first. It runs Add two numbers, then the table flow. Each run prints a realtime link, so you can watch the device in the dashboard while it runs. Now the same two flows on the real phone: a physical Pixel 11, not an emulator. The emulator run passed in thirty-two seconds. The real phone takes a little longer. Both runs passed: two flows on two devices. The summary links the dashboard, and the CLI exits with zero, which is what CI checks. In the TestingBot dashboard, the sidebar shows the parallel slots on your plan: two on this account. Every device session takes a slot, and anything beyond that waits in the queue. With more slots, a growing suite still finishes in about the time of its longest session. Every run option is a flag on testingbot maestro. The options reference lists them all: the device matrix and physical devices, orientation, locale, time zone, network throttling and more.

Dashboard: Your runs in the TestingBot dashboard

Every run you start with testingbotctl ends up in the TestingBot dashboard, and the summary in your terminal links straight to it. This chapter is a short tour: your Maestro projects, a project's runs, the run page with the history of each flow, and one session with its steps, logs and video, recorded on a physical phone. And while a test is still running, you can watch its steps and the device screen live. Everything testingbotctl starts shows up in the TestingBot dashboard. Under Maestro, every app you upload is a project, with the result of its latest run, how many runs and flows it has, and when it last ran. A project lists its runs. With a device matrix, each device is its own run: here the real Pixel 11 and the Pixel 9 emulator, and both passed. The run page shows the device, the Maestro version and your variables, then the result, retries, flows and wall time. Below that, each flow next to its recent runs, what keeps failing, and the wall time of this pipeline over time. Open a flow for its session: every Maestro step with its time, and the video of the whole session. This one ran on the physical Pixel 11. TestingBot records video on real devices too, not only on emulators and simulators. The Logs tab has the Maestro log, the TestingBot log and the device log, with filters, search and a download button. And you do not have to wait for the end. While a flow runs, the same page is live: the steps appear as Maestro runs them, and the device screen streams next to them. From here you can also stop the test, or transfer the device to a live session.

Chapter 8: Running Maestro in CI Pipelines

Chapter eight puts the suite in CI. You can run Maestro on an emulator inside the job, or hand the run to a device cloud and keep the runner free. Either way, the exit code is the contract: zero when every flow passed, two when a flow failed, and one when something else broke.

Chapter 9: Knowledge check

That's the course. The last chapter is a knowledge check: ten questions, each with a short explanation. If you'd like something to show an employer, take the free TestingBot certification: pass the exam, and run your flows on two devices on TestingBot, in a build called certificate-maestro. Both are linked from the course page.

Ready to start testing?

Start a free trial