patrolTest() is the main entry point for writing Patrol tests. It extends Flutter’s testWidgets() with powerful custom finders and native automation capabilities.
Signature
Parameters
A description of the test, which will appear in test output and reports.
The test body function that receives a
PatrolIntegrationTester instance (commonly named $).Signature: Future<void> Function(PatrolIntegrationTester $)Whether to skip this test. Defaults to
false.The timeout for this test. If not specified, uses the default test timeout.
Whether to enable semantics in this test.
The test variant to use for parameterized testing.
Tags to apply to this test for filtering or organization.
Configuration for Patrol’s custom finders and test behavior.Controls timeouts, settle policies, and logging.
Configuration for native automation features. Controls timeouts and behavior for Android, iOS, and Web native interactions.
Controls how frames are scheduled during the test.
Usage
Basic Test
Using Native Automation
With Custom Configuration
Accessing Flutter’s WidgetTester
You can access the underlyingWidgetTester for advanced operations:
PatrolTesterCallback Type
The callback parameter has this signature:$ parameter is a PatrolIntegrationTester instance that provides:
- All methods from
PatrolTester(custom finders) platform- Native automation capabilitiestester- Access to Flutter’sWidgetTester
Related Functions
patrolSetUp()
Setup function that runs before each test with native automation support
patrolTearDown()
Teardown function that runs after each test with native automation support
See Also
- PatrolIntegrationTester - The tester object passed to your test
- PatrolFinder - Custom finder API for locating widgets
- PlatformAutomator - Native automation interface