Last updated:
0 purchases
patrol finders
patrol #
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
copied to clipboard
Documentation #
Read our docs to learn more.
Custom finders #
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:patrol_finders/patrol_finders.dart';
void main() {
patrolWidgetTest(
'logs in successfully',
($) async {
await $.pumpWidgetAndSettle(const ExampleApp());
/// Finds widget with Key('emailInput') and enters text into it
///
await $(#emailInput).enterText('[email protected]');
/// Finds widget with Key('passwordInput') and enters text into it
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 taps
// on the first 'Log in' text.
await $(Scaffold).$(#box1).$('Log in').tap();
// Finds all Scrollables which have Text descendant, and taps on the first
// Scrollable
await $(Scrollable).containing(Text).tap();
// Finds all Scrollables which have ElevatedButton descendant and Text
// descendant, and taps on the first Scrollable
await $(Scrollable).containing(ElevatedButton).containing(Text).tap();
// Finds all Scrollables which have TextButton descendant which has Text
// descendant, and taps on the first Scrollabke
await $(Scrollable).containing($(TextButton).$(Text)).tap();
},
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.