patrol_finders 1.0.0 copy "patrol_finders: ^1.0.0" to clipboard
patrol_finders: ^1.0.0 copied to clipboard

Streamlined, high-level API on top of `flutter_test`.

patrol #

patrol_finders on pub.dev codestyle

patrol_finders is a streamlined, high-level API on top of flutter_test.

It provides a new custom finder system to make Flutter widget tests more concise and understandable, and writing them – faster and more fun.

Installation #

$ dart pub add patrol_finders --dev

Documentation #

Read our docs to learn more.

Custom finders #

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);
    },
  );
}
37
likes
80
pub points
86%
popularity

Publisher

verified publisherleancode.co

Streamlined, high-level API on top of `flutter_test`.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_test, meta

More

Packages that depend on patrol_finders