feat: implement Patrol runner and support BDD-style UI testing#9
Open
Kahoulam wants to merge 2 commits intomarcglasberg:mainfrom
Open
feat: implement Patrol runner and support BDD-style UI testing#9Kahoulam wants to merge 2 commits intomarcglasberg:mainfrom
Kahoulam wants to merge 2 commits intomarcglasberg:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Closes #2