Newsletter
Subscribe if you want to know how to build digital products
What do you do in IT?
By submitting your email you agree to receive the content requested and to LeanCode's Privacy Policy

Give Patrol a Try: Hands-On in 10 Minutes or Less

Oskar Zając - QA Engineer at LeanCode
Oskar Zając - QA Engineer at LeanCode
Jul 23, 2025 • 4 min
Patrol UI Testing Framework by LeanCode
Oskar Zając - QA Engineer at LeanCode
Oskar Zając
QA Engineer at LeanCode
Patrol UI Testing Framework by LeanCode

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.

Step-by-Step Patrol Guide

Step 1: Open Patrol example project in Firebase Studio

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 & Patrol

Interface of Firebase Studio

Step 2: Take a first look

After the import is finished, the test will run automatically. If you missed it or want to see it again, you need to:

  1. Expand terminal by grabbing the bar at the bottom and dragging it upward (or use ⌘ + J (mac) / CTRL + J (win/linux)).
  2. Type  “r” in the terminal to restart the test.

Step 3: Inspect Patrol code

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.

Step 4: Run the test again

Now that you've inspected the test code and understand its structure, run the test again and see how Patrol interacts with the app.

Unlock Better Testing – Why Patrol Is Worth It

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:

  • Interacting with permission dialogs
  • Using WebView
  • Tapping notifications
  • Google sign-in
  • Manipulating the internet connection
  • Setting device location
  • …and many more


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:

  • Like a white-box framework (e.g. Flutter’s flutter_test), Patrol can access the internal structure of your Flutter app. It understands widget trees, can locate elements by widget keys or text, and interact with them at the code level.
  • Like a black-box testing tool (e.g. Appium or Espresso), Patrol can also interact with the device outside your app’s codebase – such as permission dialogs, push notifications and system settings.


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.

Next Steps For You

If this hands-on tutorial sparked your interest:

Rate this article
Star 1Star 2Star 3Star 4Star 5
5.00 / 5 Based on 2 reviews

Read more

The Role of UI Testing in Large-Scale Applications

We dive into the topic of UI testing in Flutter. Read more about automated UI tests' benefits and available solutions and why UI testing plays a crucial role, especially in large-scale applications.
UI Testing in Flutter by LeanCode

Testing Flutter Apps Gets Faster - Hot Restart in Patrol Framework

Our UI testing and open source framework, Patrol, has just received a game-changing update - Hot Restart - it makes testing Flutter apps even faster and more efficient than before! See how we improved Patrol and run `patrol update.` to Patrol 1.1 version.
Hot Restart in Patrol Framework by LeanCode

6 Non-obvious Flutter and Dart Packages

Almost every production-grade app depends on tens of packages. Using them allows for quick implementation of standard functionalities. Take a closer look at 6 useful but not-so-popular Dart and Flutter packages made and tested by LeanCode's devs.
Flutter open source packages by LeanCode