patrol library

Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action!

Classes

AndroidNativeView
AndroidSelector
Failure
Representing a failure includes the method name and the failure details.
GetNativeViewsResult
This class represents the result of NativeAutomator.getNativeViews.
IOSNativeView
IOSSelector
NativeAutomator
Provides functionality to interact with the OS that the app under test is running on.
NativeAutomator2
Provides functionality to interact with the OS that the app under test is running on.
NativeAutomatorConfig
Configuration for NativeAutomator.
NativeSelector
This class aggregates native selectors.
NativeView
Notification
PatrolAppService
Implements a stateful HTTP service for querying and executing Dart tests.
PatrolBinding
Binding that enables some of Patrol's custom functionality, such as tapping on WebViews during a test.
PatrolFinder
Patrol custom finder, also known as $.
PatrolIntegrationTester
PatrolIntegrationTester extends the capabilities of finders.PatrolTester with the ability to interact with native platform features via native.
PatrolTesterConfig
Common configuration for PatrolTester and PatrolFinder.
Selector

Enums

IOSElementType
KeyboardBehavior
Specifies how the OS keyboard should behave when using NativeAutomator.enterText and NativeAutomator.enterTextByIndex.
SettlePolicy
Specifies how methods such as PatrolTester.tap or PatrolTester.enterText perform pumping, i.e. rendering new frames.

Extensions

ActionCombiner on Future<PatrolFinder>
Useful methods that make chained finders more readable.

Constants

defaultScrollDelta → const double
Default amount to drag by when scrolling.
defaultScrollMaxIteration → const int
Default maximum number of drags during scrolling.

Functions

createDartTestGroup(Group parentGroup, {String name = '', int level = 0, int maxTestCaseLength = global_state.maxTestLength}) → DartGroupEntry
Creates a DartGroupEntry by visiting the subgroups of parentGroup.
createFinder(dynamic matching) Finder
Creates a Finder from matching.
deduplicateGroupEntryName(String parentName, String currentName) String
Allows for retrieving the name of a GroupEntry by stripping the names of all ancestor groups.
patrolSetUp(dynamic body()) → void
A modification of setUp that works with Patrol's native automation.
patrolTearDown(dynamic body()) → void
A modification of tearDown that works with Patrol's native automation.
patrolTest(String description, PatrolTesterCallback callback, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, PatrolTesterConfig config = const finders.PatrolTesterConfig(), NativeAutomatorConfig nativeAutomatorConfig = const NativeAutomatorConfig(), LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers}) → void
Like testWidgets, but with support for Patrol custom finders.
patrolWidgetTest(String description, PatrolWidgetTestCallback callback, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, PatrolTesterConfig config = const PatrolTesterConfig()}) → void
Like testWidgets, but with support for Patrol custom finders.
printGroupStructure(DartGroupEntry group, {int indentation = 0}) → void
Recursively prints the structure of the test suite.
runAppService(PatrolAppService service) Future<void>
Starts the gRPC server that runs the PatrolAppService.

Typedefs

PatrolTesterCallback = Future<void> Function(PatrolIntegrationTester $)
Signature for callback to patrolTest.
PatrolWidgetTestCallback = Future<void> Function(PatrolTester $)
Signature for callback to patrolWidgetTest.

Exceptions / Errors

PatrolActionException
Thrown when a native action fails.
PatrolFinderException
Thrown when some PatrolFinder's method fails.
PatrolTimeoutException
Thrown when some Patrol method fails to complete within the allowed time.
WaitUntilExistsTimeoutException
Thrown when PatrolFinder did not find anything in the allowed time and timed out.
WaitUntilVisibleTimeoutException
Indicates that PatrolFinder did not find anything in the allowed time and timed out.