Maestro (from mobile.dev, often referred to as maestro.dev) is an open-source UI testing framework for mobile apps, including Flutter apps on Android and iOS, but also Web with the super-ability to automate end-to-end tests using simple YAML flows, interacting with your app via accesibility semantics labels, text, or identifiers and also have the featur to create screenshots.
- – It does not give you code coverage
But
- + It elevates your thinking to use accessibility every day.
- + Allows testing flows
- + can be used by non-tech to jump from manual to automated QA
- + can create screenshots
How to Generate Screenshots (Images) of Your Flutter App Using Maestro
- Set Up Maestro
Install Maestro via curl (follow the official guide):curl -Ls "https://get.maestro.mobile.dev" | bashEnsure your Flutter app is built:
- Android:
flutter build apk - iOS:
flutter build ios(on macOS)
- Android:
- Add Semantics to Your Flutter Widgets (Recommended for Reliable Interaction)
Maestro relies on accessibility/semantics for Flutter. Wrap widgets withSemanticsor usesemanticLabel:Semantics( label: 'Login Button', child: ElevatedButton(onPressed: () {}, child: Text('Login')), ) - Create a YAML Flow File (e.g.,
screenshots.yaml)
Define steps to navigate your app and take screenshots at key points:appId: com.example.yourapp # Your Flutter app's bundle ID --- - launchApp - tapOn: "Home Tab" # Uses semantics label or text - takeScreenshot: home_screen.png # Saves screenshot to current directory - swipe: from: x: 50% y: 80% to: x: 50% y: 20% duration: 1000 - takeScreenshot: detail_screen.png - inputText: "Search query" - tapOn: "Search Button" - takeScreenshot: search_results.png - Run the Flow
Start an emulator/simulator or connect a device, then:maestro test screenshots.yamlScreenshots (PNG images) will be saved in your working directory.
- Advanced Options
- Use Maestro Studio for visual recording:
maestro studio— interact with your app, and it auto-generates commands (including screenshots). - Run on cloud for multiple devices: Upload to Maestro Cloud.
- For automated screenshot suites (e.g., app store assets): Chain multiple
takeScreenshotcommands after navigating to different locales, themes, or screens.
- Use Maestro Studio for visual recording:
Showcase of screenshoting: https://youtu.be/RB-QtyjV_a0 For full Maestro docs: https://maestro.mobile.dev
