Dart packages

patrol on pub.dev patrol_cli on pub.dev patrol_finders on pub.dev patrol_mcp on pub.dev patrol_discord code style patrol_github_stars patrol_x

A powerful, multiplatform E2E UI testing framework for Flutter apps that overcomes the limitations of integration_test by handling native interactions. Developed by LeanCode since 2022, battle-tested and shaped by production-grade experience.

Patrol promotional graphics

Patrol is an open-source framework created and maintained by LeanCode. However, if your company wants to scale fast and accelerate Patrol’s adoption, we offer a set of value-added services on top of the core framework.

You can find out more below:

Patrol 4.7.0 adds Swift Package Manager support for iOS and macOS! If you migrate your project to SPM, a few small setup changes are needed β€” see the iOS setup guide for details.

patrol package builds on top of flutter_test and integration_test to make it easy to control the native UI from Dart test code. It must be used together with patrol_cli.

It also provides a new custom finder system to make Flutter widget tests more concise and understandable, and writing them – faster and more fun. It you want to only use custom finders, check out patrol_finders.

$ dart pub add patrol --dev

⚠️ Additional setup is required to run tests – install patrol_cli and complete native setup.

Patrol has 2 main features – native automation and custom finders.

Read our docs to learn more about them!

// example/patrol_test/example_test.dart
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';
void main() {
  patrolTest(
    'counter state is the same after going to home and going back',
    ($) async {
      await $.pumpWidgetAndSettle(const MyApp());
      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '1');
      await $.platform.mobile.pressHome();
      await $.platform.mobile.pressDoubleRecentApps();
      expect($(#counterText).text, '1');
      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '2');
      await $.platform.mobile.openNotifications();
      await $.platform.mobile.pressBack();
    },
  );
}
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';
void main() {
  patrolTest(
    'logs in successfully',
    ($) async {
      await $.pumpWidgetAndSettle(const MyApp());
      await $(#emailInput).enterText('user@leancode.co');
      await $(#passwordInput).enterText('ny4ncat');
      // Finds all widgets with text 'Log in' which are descendants of widgets with key
      // box1, which are descendants of a Scaffold widget and tap on the first one.
      await $(Scaffold).$(#box1).$('Log in').tap();
      // Finds all Scrollables which have Text descendant
      $(Scrollable).containing(Text);
      // Finds all Scrollables which have a Button descendant which has a Text descendant
      $(Scrollable).containing($(Button).containing(Text));
      // Finds all Scrollables which have a Button descendant and a Text descendant
      $(Scrollable).containing(Button).containing(Text);
    },
  );
}

Patrol ships agent skills that teach AI coding agents how to write Patrol tests following best practices β€” see the catalog for what's available and how to install them.

πŸ› οΈ Maintained by LeanCode #

LeanCode Logo

This package is built with πŸ’™ by LeanCode. We are top-tier experts focused on Flutter Enterprise solutions.

  • Creators of Patrol – the next-gen testing framework for Flutter.

  • Production-Ready – We use this package in apps with millions of users.

  • Full-Cycle Product Development – We take your product from scratch to long-term maintenance.

712

likes

150

points

455k

downloads

screenshot

Documentation

Documentation
API reference

Publisher

verified publisherleancode.co

Weekly Downloads

Metadata

A powerful, multiplatform E2E UI testing framework for Flutter apps that overcomes the limitations of integration_test by handling native interactions.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#testing #integration-test #ui-test #e2e #native-automation

License

Apache-2.0 (license)

Dependencies

boolean_selector, equatable, flutter, flutter_test, http, http_multi_server, json_annotation, meta, patrol_finders, patrol_log, shelf, test_api, web

More

Read the original on pub.dev β†—