Skip to content

feat: implement Patrol runner and support BDD-style UI testing#9

Open
Kahoulam wants to merge 2 commits intomarcglasberg:mainfrom
Kahoulam:feature/patrol-test-support
Open

feat: implement Patrol runner and support BDD-style UI testing#9
Kahoulam wants to merge 2 commits intomarcglasberg:mainfrom
Kahoulam:feature/patrol-test-support

Conversation

@Kahoulam
Copy link

@Kahoulam Kahoulam commented Mar 2, 2026

Overview

This PR introduces Patrol integration test support for the bdd_framework. By providing a dedicated runner, users can now combine BDD syntax with the powerful native automation and enhanced finder capabilities of Patrol for writing UI integration tests.

Changes

  • Added Patrol Dependency: Added patrol: ^4.1.1 to pubspec.yaml.
  • Implemented Patrol Runner: Created lib/src/runners/patrol_test_runner.dart implementing BddPatrolTestRunner and BddPatrolTestCodeable extensions. These provide .run() and .code((ctx, $) async { ... }) entry points.
  • New Public Entry Point: Added lib/patrol_test.dart to export relevant components.
  • Verification Tests: Added patrol_test/patrol_test_runner_test.dart to verify PatrolIntegrationTester ($) injection and UI interaction.
  • Updated .gitignore: Excluded Patrol-specific artifacts such as test_bundle.dart, playwright-report/, and test-results/.

Closes #2

Kahoulam added 2 commits March 2, 2026 07:58
This refactor enables `bdd_framework` to drive UI-based logic using Flutter's `testWidgets`.

### Problem Solved
Previously, the framework was strictly tied to the standard `test()` function, making it impossible to:
1. Access the `WidgetTester` instance within Gherkin steps.
2. Handle the specific asynchronous zones required by Flutter UI tests.
3. Perform async operations like `await tester.pump()` in the Gherkin execution flow.

### Solutions
- **Runner Decoupling**: Re-architected the execution flow to support framework-specific runners (Dart, Flutter, and Flutter Widget).
- **Widget-Specifc API**: Introduced `package:bdd_framework/flutter_widget_test.dart` which provides the `.runTestWidgets()` extension to correctly bridge the BDD engine with Flutter's `testWidgets`.
- **Tester Injection**: Steps executed via the widget runner now correctly receive the `WidgetTester` instance in their callback.
- **Improved Context**: `BddContext` now handles both logic-only and UI-based scenarios.

### Other Improvements
- Reorganized project structure for better maintainability (separate core vs. runners).
- Isolated reporter exports into `lib/src/reporter.dart`.
- Maintained 100% backward compatibility for existing pure-logic tests via `lib/bdd_framework.dart`.

Closes marcglasberg#5
- Added patrol dependency to pubspec.yaml.
- Implemented PatrolRunner with .run() and .code() extensions in lib/src/runners/patrol_runner.dart.
- Added lib/patrol_test.dart as the public entry point for Patrol BDD tests.
- Created patrol_test/patrol_runner_test.dart to verify PatrolIntegrationTester injection and UI interaction.
- Updated .gitignore to exclude Patrol-generated files (test_bundle.dart, playwright-report/, test-results/).
- Aligned API signature with FlutterWidgetTestRunner for consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for integration tests using patrol

1 participant