You’ve heard about Patrol and are looking for the easiest and fastest way of giving it a try before you go all in with it in your project? You couldn’t find a better place. We have prepared a hands-on tutorial that will allow you to see if Patrol can be a UI testing Flutter framework that fits your needs.
This tutorial shows you the quickest possible way to try out Patrol with no local setup required. Using Firebase Studio, you can run end-to-end tests in a pre-configured environment directly in your browser.
It’s perfect if you’re curious about Patrol and want to see it in action right away. You only need a browser and a Google Account. That’s it. No need to install Flutter or Patrol locally.
1. Create a new project in Firebase Studio with the Patrol demo project by clicking this link.
2. Check Mobile SDK Support (Flutter + Android Emulator) checkbox when creating a project.
3. Click Import.
4. Import can take around 10 minutes to complete. Grab a coffee, answer some emails, or stretch your back in the meantime.
NOTE: Don’t give up! That’s the longest part - the rest literally takes just a few seconds!
Interface of Firebase Studio
After the import is finished, the test will run automatically. If you missed it or want to see it again, you need to:
The test code is located in the integration_test/quiz_test.dart file. Let’s break down the body of the test:
await initApp();
await $.pumpWidgetAndSettle(const MyApp());
Open the Flutter app.
if (await $.native.isPermissionDialogVisible()) {
await $.native.grantPermissionWhenInUse();
}
Accept the native location permission dialog if it's visible (this is conditional, so the test will pass on subsequent runs that won't encounter this dialog).
await $('Send notification').tap();
Tap a tile by text selector.
if (await $.native.isPermissionDialogVisible()) {
await $.native.grantPermissionWhenInUse();
}
Accept the permission dialog for notifications.
await $.native.openNotifications();
await $.native.openNotifications();
await $.native.tapOnNotificationBySelector(
Selector(textContains: 'Tap'),
);
Click the notification from the notifications drawer (we repeated opening the notifications drawer because of slowish Firebase Studio emulators).
await $(RegExp('Your location')).waitUntilVisible(
timeout: const Duration(seconds: 30),
);
Finally, check if the expected content is visible at the end of the test. Increased timeout takes into account that getting user location might take some time.
As you can see, the Patrol code is easy to read, contains numerous functions for interacting with the native side of the device, and also allows you to overwrite default parameters, ensuring that you can test every possible scenario.
Now that you've inspected the test code and understand its structure, run the test again and see how Patrol interacts with the app.
Patrol is an open-source UI testing framework by LeanCode, designed specifically for Flutter apps. What sets Patrol apart is its focus on enabling full end-to-end testing, covering scenarios that other frameworks often can’t handle. With Patrol, you’re not limited to just widget testing or simple UI flows – you can go deeper and test complex, device-level behaviors that are critical in production apps.
Here’s what you can do with Patrol:
These capabilities make Patrol especially useful for testing apps with advanced native integrations or simulating real-world behavior.
And the best part? Patrol plays well with CI pipelines. Whether you're using Codemagic, GitHub Actions, Bitrise, or another provider, Patrol integrates smoothly across many CI platforms. Check the full list here.
Besides that, it’s worth knowing that Patrol is a grey-box testing framework, so it combines the advantages of both white-box and black-box testing approaches:
This hybrid approach allows you to write powerful, high-fidelity end-to-end tests that cover real user flows,including crossing boundaries between your Flutter code and native platform elements – all from a single, developer-friendly API.
If this hands-on tutorial sparked your interest: