General Questions
What is Patrol?
What is Patrol?
How is Patrol different from integration_test?
How is Patrol different from integration_test?
- Native automation: Interact with platform UI elements outside your Flutter app
- Better finders: More intuitive and powerful widget finding with chaining support
- Hot restart: Quickly iterate on tests without full rebuilds
- Test bundling: Run tests as native instrumented tests for better reliability
- Web support: Run the same tests on web browsers with platform-specific automation
- DevTools extension: Inspect native view hierarchy while developing tests
Do I need to uninstall integration_test to use Patrol?
Do I need to uninstall integration_test to use Patrol?
patrol_test/ instead of integration_test/) to avoid
conflicts. You can configure Patrol to use a custom directory if needed.Which platforms does Patrol support?
Which platforms does Patrol support?
- Android (emulators and physical devices)
- iOS (simulators and physical devices)
- macOS (alpha support)
- Web (Chrome, Firefox, Safari, Edge, Webkit)
Is Patrol free to use?
Is Patrol free to use?
Installation & Setup
Testing fails with error inside 'patrol_test/test_bundle.dart'
Testing fails with error inside 'patrol_test/test_bundle.dart'
patrol and patrol_cli.
Check the Compatibility Table to ensure
you’re using compatible versions. Update both packages:'example_test.dart' passed but I can't get my application to run within the patrol test
'example_test.dart' passed but I can't get my application to run within the patrol test
$.pumpWidgetAndSettle()
and pass your application’s main widget to it. Make sure you register all necessary
services before calling $.pumpWidgetAndSettle().Where do I get package_name and bundle_id?
Where do I get package_name and bundle_id?
android/app/build.gradle and look for
applicationId in the defaultConfig section.iOS bundle_id: Go to ios/Runner.xcodeproj/project.pbxproj and look for
PRODUCT_BUNDLE_IDENTIFIER.macOS bundle_id: Go to macos/Runner.xcodeproj/project.pbxproj and look for
PRODUCT_BUNDLE_IDENTIFIER.How do I configure a custom test directory?
How do I configure a custom test directory?
test_directory to your pubspec.yaml:Android Issues
Running patrol test fails with 'Unsupported class file major version' error
Running patrol test fails with 'Unsupported class file major version' error
javac -version to
check your JDK version. Patrol officially supports JDK 17.If you have Android Studio or IntelliJ IDEA installed, you can find the path to
JDK by opening your project’s android directory and going to Settings →
Build, Execution, Deployment → Build Tools → Gradle → Gradle JDK.Learn more about JDK managementBuild gets stuck during 'patrol test' or 'patrol build android'
Build gets stuck during 'patrol test' or 'patrol build android'
--verbose shows it stuck at
$ flutter build apk --config-only, updating orchestrator to 1.6.1 in your
build.gradle might help.Tests fail with 'Instrumentation run failed due to Process crashed'
Tests fail with 'Instrumentation run failed due to Process crashed'
- Version mismatch between patrol and patrol_cli
- Incorrect configuration in pubspec.yaml
- Issues with Android test orchestrator
patrol doctor to diagnose the issue.How do I test WebViews on Android?
How do I test WebViews on Android?
iOS Issues
When I run tests the simulator is getting cloned
When I run tests the simulator is getting cloned
Running test stops on 'Wait for com.example.myapp to idle'
Running test stops on 'Wait for com.example.myapp to idle'
FLUTTER_TARGET in your project files and remove it (both value and key)
from *.xcconfig and *.pbxproj files.After removing it, regenerate the configuration:When running a test, real app without test is opened instead
When running a test, real app without test is opened instead
FLUTTER_TARGET in your project files and remove it (both value and key)
from *.xcconfig and *.pbxproj files.Build is failing with errors on mismatching iOS deployment versions
Build is failing with errors on mismatching iOS deployment versions
Podfile is present and uncommented:How do I run Patrol tests on physical iOS devices?
How do I run Patrol tests on physical iOS devices?
I get App Store warnings about non-public selectors
I get App Store warnings about non-public selectors
Test Writing
How do I find widgets in my test?
How do I find widgets in my test?
- Text:
$("Login") - Key:
$(#loginButton) - Type:
$(TextField) - Icon:
$(Icons.add) - Chaining:
$(Scaffold).$(ListView).$("Item")
Should I use keys, text, or widget types to find widgets?
Should I use keys, text, or widget types to find widgets?
- More reliable than text (which can change with translations)
- More semantic than widget types (which are implementation details)
- Less likely to break when refactoring
How do I interact with native UI elements like permission dialogs?
How do I interact with native UI elements like permission dialogs?
How do I scroll to an item that's not yet visible?
How do I scroll to an item that's not yet visible?
scrollTo() method:How do I handle flaky tests?
How do I handle flaky tests?
- Not waiting for animations: Use
$.pumpAndSettle()after actions - Race conditions: Use
waitUntilVisible()orwaitUntilExists()before assertions - Hardcoded timeouts: Use proper waiting mechanisms instead
- Multiple matching widgets: Use
.at(),.first, or.lastto be specific
Can I use environment variables in tests?
Can I use environment variables in tests?
--dart-define to pass environment variables:.patrol.env file in your project root.How do I debug Patrol tests?
How do I debug Patrol tests?
- patrol develop: Hot restart during test development
- DevTools Extension: Inspect native view hierarchy
- VS Code extension: Run and debug tests from your editor
- Logging: Use
$.log('message')to add logs - Breakpoints: Standard Dart debugging with IDE breakpoints
Web Testing
Does Patrol support web testing?
Does Patrol support web testing?
- Cookie management
- Browser navigation
- Keyboard shortcuts
- File uploads/downloads
- Dialog handling
Which browsers does Patrol support?
Which browsers does Patrol support?
- Chrome
- Firefox
- Safari
- Edge
- Webkit
CI/CD Integration
Can I run Patrol tests in CI/CD?
Can I run Patrol tests in CI/CD?
- GitHub Actions
- GitLab CI
- Bitrise
- Codemagic
- Firebase Test Lab
- BrowserStack
- LambdaTest
How do I run tests on cloud device farms?
How do I run tests on cloud device farms?
Performance & Advanced
How fast are Patrol tests compared to other testing frameworks?
How fast are Patrol tests compared to other testing frameworks?
patrol develop command with hot restart makes test
development much faster than traditional approaches.Can I run multiple tests in parallel?
Can I run multiple tests in parallel?
How do I organize tests with setup and teardown?
How do I organize tests with setup and teardown?
patrolSetUp() and patrolTearDown():Can I use Patrol with other testing tools?
Can I use Patrol with other testing tools?
- patrol_finders: Can be used in regular widget tests
- Mockito/Mocktail: For mocking dependencies
- flutter_driver: For alternative test approaches
- Allure: For test reporting (see Allure Integration)
Getting Help
Where can I get help with Patrol?
Where can I get help with Patrol?
- Discord: Join our Discord community for quick help
- GitHub Issues: Report bugs or request features on GitHub
- Documentation: Browse our comprehensive documentation
- Contact: Reach out through our contact page
How do I report a bug?
How do I report a bug?
- Clear description of the problem
- Steps to reproduce
- Patrol and patrol_cli versions
- Flutter and Dart versions
- Platform (Android/iOS/Web/macOS)
- Relevant logs and error messages
I couldn't find an answer to my question
I couldn't find an answer to my question
- Check the full documentation
- Search existing GitHub issues
- Ask on our Discord server
- Create a new GitHub issue