with one click
with one click
| name | patrol-tests |
| description | Rules for writing Patrol E2E tests in Flutter apps |
When working with Patrol tests:
patrol-run({ "testFile": "patrol_test/your_test.dart" }) to run tests and wait for completionpatrol-screenshot({ "platform": "android" }) or patrol-screenshot({ "platform": "ios" }) to capture screenshots for debugging test failurespatrol-quit({}) to quit the session gracefullypatrol-status({}) to check current status and recent outputpatrol-native-tree({}) to fetch the current native UI tree hierarchy for writing native interactions and interactions with apps other than the app under test.$(), .scrollTo(), .tap(), .enterText(), .waitUntilVisible(), etc.) should import 'package:patrol/patrol.dart';$.platform methods before implementing test actionspatrol test for all tests. Never use flutter test command$.pump, waitUntilVisible or waitUntilExists and other wait methods after or before tap, scrollTo and enterText. Patrol handles it automatically. Do this only at the end of the testwaitUntilVisible as assertion at the end of the testexpect() for assertions only when waitUntilVisible is not enough$.platform.mobile.grantPermissionWhenInUse over $.platform.mobile.tapAssign a key ONLY to widgets involved in testing
ONLY add the key parameter to existing widgets
NEVER change widget signatures
NEVER refactor existing code structure
NEVER hardcode keys in the app, you must use keys from the keys file that is shared between app and tests
NEVER create new widgets in the app
NEVER create a key that is not assigned to a widget
Always make sure that each key value is unique
ALWAYS sort keys alphabetically
Add keys as first parameter to the widget constructor
If widget is not unique (for example generated from a list) use a parameterized key
Use individual keys when:
Use parameterized keys when: