• Stars
    star
    757
  • Rank 58,215 (Top 2 %)
  • Language
    Dart
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flutter-first UI testing framework. Ready for action!

Patrol

patrol on pub.dev patrol_cli on pub.dev code style powered by

Patrol promotial graphics

Simple yet powerful Flutter-native UI testing framework overcoming limitations of flutter_test, integration_test, and flutter_driver.

Learn more about Patrol:

Patrol custom finders

Flutter's finders are powerful, but not very intuitive to use.

We took them and made something awesome.

Thanks to Patrol's custom finders, you'll take your tests from this:

testWidgets('signs up', (WidgetTester tester) async {
  await tester.pumpWidget(AwesomeApp());
  await tester.pumpAndSettle();

  await tester.enterText(
    find.byKey(Key('emailTextField')),
    '[email protected]',
  );
  await tester.pumpAndSettle();

  await tester.enterText(
    find.byKey(Key('nameTextField')),
    'Charlie',
  );
  await tester.pumpAndSettle();

  await tester.enterText(
    find.byKey(Key('passwordTextField')),
    'ny4ncat',
  );
  await tester.pumpAndSettle();

  await tester.tap(find.byKey(Key('termsCheckbox')));
  await tester.pumpAndSettle();

  await tester.tap(find.byKey(Key('signUpButton')));
  await tester.pumpAndSettle();

  expect(find.text('Welcome, Charlie!'), findsOneWidget);
});

to this:

patrolTest('signs up', (PatrolTester $) async {
  await $.pumpWidgetAndSettle(AwesomeApp());

  await $(#emailTextField).enterText('[email protected]');
  await $(#nameTextField).enterText('Charlie');
  await $(#passwordTextField).enterText('ny4ncat');
  await $(#termsCheckbox).tap();
  await $(#signUpButton).tap();

  await $('Welcome, Charlie!').waitUntilVisible();
});

Learn more about custom finders in the docs!

Patrol native automation

Flutter's default integration_test package can't interact with the OS your Flutter app is running on. This makes it impossible to test many critical business features, such as:

  • granting runtime permissions
  • signing into the app which through WebView or Google Services
  • tapping on notifications
  • much more!

Patrol's native automation feature solves these problems:

void main() {
  patrolTest('showtime', nativeAutomation: true, (PatrolTester $) async {
    await $.pumpWidgetAndSettle(AwesomeApp());
    // prepare network conditions
    await $.native.enableCellular();
    await $.native.disableWifi();

    // toggle system theme
    await $.native.enableDarkMode();

    // handle native location permission request dialog
    await $.native.selectFineLocation();
    await $.native.grantPermissionWhenInUse();

    // tap on the first notification
    await $.native.openNotifications();
    await $.native.tapOnNotificationByIndex(0);
  });
}

CLI

See packages/patrol_cli.

The CLI is needed to enable Patrol's native automation feature in integration tests. It also makes development of integration tests much faster thanks to Hot Restart.

To run widget tests, you can continue to use flutter test.

Package

See packages/patrol.

More Repositories

1

ts-routes

Strongly typed parameterized routing paths
TypeScript
46
star
2

flutter_corelibrary

Our core packages used for building the best Flutter apps.
Dart
45
star
3

arb_translate

A command-line tool for automatically adding missing message translations to ARB files using Google Gemini LLM by LeanCode
Dart
32
star
4

poe2arb

POEditor JSON to Flutter ARB converter
Go
29
star
5

corelibrary

Our core framework for building backend services.
C#
29
star
6

bloc_presentation

Extends blocs with an additional stream which can serve as a way of indicating single-time events (so-called "presentation events").
Dart
24
star
7

flutter-at-mini

C++
22
star
8

dashed_line

Draw dashed lines with any shape and style you want. Just like that.
Dart
21
star
9

comms

Simple communication pattern abstraction on streams.
Dart
20
star
10

dart-problem-matcher

JavaScript
13
star
11

address

Addresses internationalization library. Format various physical addresses in various languages and build localized address forms.
Dart
9
star
12

flutter-add2app-background-services

Example of how to integrate native background services with Flutter add-to-app
Kotlin
8
star
13

spyglass

Dependency injection POC
Dart
8
star
14

contractsgenerator

C#
7
star
15

whiteboard-demo

Dart
6
star
16

render-box-boilerplate-generator

Flutter `RenderBox` boilerplate generator
JavaScript
4
star
17

pdf-generator

TypeScript
3
star
18

leancode_cubit_utils

Dart
3
star
19

contractsgenerator-dart

Dart contracts client generator for a CQRS API
Dart
2
star
20

arbsort

Simple CLI tool for sorting ARB files contents alphabetically
Go
2
star
21

terraform-kubernetes-cluster

HCL
2
star
22

logging_bugfender

A library helping integrate Bugfender with the logging package.
Dart
2
star
23

mobile-tools

Simple programs and shellscripts to make our mobile developers' lives easier.
Shell
2
star
24

patrol-workshop

Dart
2
star
25

leanpipe

C#
1
star
26

platform_channel_poc

Swift
1
star
27

poc-deeplinking-flavors-provider

Dart
1
star
28

chat

Firestoreโ€“based chat module
Dart
1
star
29

exampleapp

C#
1
star
30

Landmarks

A simple, native iOS app built in SwiftUI. We use it mostly for playing around with native iOS test tooling.
Swift
1
star
31

corelib-docgen-example

C#
1
star
32

contractsgenerator-typescript

JavaScript
1
star
33

leancode_forms

Dart
1
star