patrol library
Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action!
Classes
- AndroidAutomator
- Provides functionality to interact with the OS that the app under test is running on.
- AndroidAutomatorConfig
- Configuration for AndroidAutomator.
- AndroidGetNativeViewsResponse
- 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.
- IOSAutomator
- Provides functionality to interact with the OS that the app under test is running on.
- IOSAutomatorConfig
- Configuration for IOSAutomator.
- IOSGetNativeViewsResponse
- IOSNativeView
- IOSSelector
- An iOS-specific selector for finding UI elements.
- MacOSAutomator
- Provides functionality to interact with native macOS UI that Flutter cannot see (alerts, menu bar, system dialogs, and other AppKit / system views).
- MacOSAutomatorConfig
- Configuration for MacOSAutomator.
- MobileAutomator
- Mobile-specific automator that works across Android and iOS.
- MobileAutomatorConfig
-
Configuration for
MobileAutomator. - MobileSelector
- A mobile-specific selector for finding UI elements.
- NativeView
- Represents a native view in the UI hierarchy.
- Notification
- PatrolAppLaunch
- How Patrol launches the app before a phase.
- 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 platform. - PatrolPhase
- One Dart part of a phased Patrol test.
- 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.
- Point2D
- Rectangle
- Selector
- A cross-platform selector for finding UI elements.
- UploadFileData
- Represents a file to be uploaded via the web automator.
- WebAutomator
- Provides functionality to interact with web applications.
- WebAutomatorConfig
- Configuration for WebAutomator.
- WebGetNativeViewsResponse
-
Response of the web
getNativeViewsaction. - WebNativeView
- A DOM element of the page under test, as reported by the Playwright driver.
- WebSelector
- A Web-specific selector for finding UI elements.
- WebViewBounds
- The bounding box of a WebNativeView.
- WindowsAutomator
- Windows-specific OS automation (experimental).
- WindowsAutomatorConfig
- Configuration for WindowsAutomator.
- WindowsKey
-
Common Win32 virtual-key codes for
WindowsAutomator.pressKey. - WindowsScope
- Root for desktop UI Automation finds.
- WindowsSelector
- Finder for desktop UI Automation elements on Windows.
- WindowsUiElement
- Snapshot of a desktop UI Automation element.
Enums
- AppleApp
- FoldPosture
- Posture of a foldable device. Experimental.
- GoogleApp
- IOSElementType
- KeyboardBehavior
- PatrolTargetPlatform
- A platform Patrol runs tests on.
- 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.
Properties
- patrolNativeServerUri → Uri
-
Base URI of the Patrol native automation server — the same server that
backs
$.platform.mobile.*(defaultlocalhost:8081).no setter - patrolTargetPlatform → PatrolTargetPlatform
-
The platform this test run targets.
no setter
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), PlatformAutomatorConfig? platformAutomatorConfig, LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive, bool deterministicCursor = true}) → 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.
-
phases(
List< PatrolPhase> phases) → PatrolPhaseCallback -
Creates a phased body accepted by
patrolTest.
Typedefs
-
PatrolPhaseCallback
= Future<
void> Function(PatrolIntegrationTester $) - A callback containing the Dart part of a Patrol test.
-
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.
- PatrolStepException
- Thrown when a Patrol action with a description 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 any visible widget in the allowed time and timed out.