patrol library
Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action!
Classes
- AndroidNativeView
- AndroidSelector
- An Android-specific selector for finding UI elements.
- CompoundSelector
- A selector that can be used across platforms.
- Failure
- Representing a failure includes the method name and the failure details.
- GetNativeViewsResult
- This class represents the result of NativeAutomator.getNativeViews.
- IOSNativeView
- IOSSelector
- An iOS-specific selector for finding UI elements.
- MobileAutomator
- Mobile-specific automator that works across Android and iOS.
- MobileSelector
- A mobile-specific selector for finding UI elements.
- 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
- Represents a native view in the UI hierarchy.
- 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.PatrolTesterwith the ability to interact with native platform features via native. - PatrolTesterConfig
-
Common configuration for
PatrolTesterand PatrolFinder. - PlatformAction
- Platform-specific action router.
- PlatformAutomator
- Provides functionality to interact with the OS that the app under test is running on.
- PlatformAutomatorConfig
- Configuration for PlatformAutomator.
- PlatformSelector
- A selector that allows platform-specific selectors to be specified separately.
- Selector
- A cross-platform selector for finding UI elements.
- UploadFileData
- Represents a file to be uploaded via the web automator.
- WebSelector
- A Web-specific selector for finding UI elements.
Enums
- AppleApp
- GoogleApp
- IOSElementType
- KeyboardBehavior
- SettlePolicy
-
Specifies how methods such as
PatrolTester.taporPatrolTester.enterTextperform 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
-
createFinder(
dynamic matching) → Finder -
Creates a Finder from
matching. -
initAppService(
) → Future< void> - Initializes the app service.
-
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(printLogs: true), NativeAutomatorConfig? nativeAutomatorConfig, PlatformAutomatorConfig? platformAutomatorConfig, LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive}) → 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.
-
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.