Skip to content

feat(ensemble_test_runner): add ensemble test runner workflow and enh… - #2371

Merged
sharjeelyunus merged 11 commits into
mainfrom
extend-test-runner-host
Sep 21, 2026
Merged

sharjeelyunus merged 11 commits into
mainfrom
extend-test-runner-host

Conversation

@sharjeelyunus

@sharjeelyunus sharjeelyunus commented Sep 21, 2026

Copy link
Copy Markdown
Member

Description

Extends ensemble_test_runner so standalone Ensemble, pure Flutter, and mixed Flutter+Ensemble apps share one YAML engine, CLI, reports, and locator/action model—without framework selectors or a second runner.

Also addresses PR review P1s: negative structured assertions, integration viewport/service ownership, host-driver mock branching, element-identity Finders, text-locator collapse, fixtures-before-launch, screenshot error handling, plus partial teardown, structured timeoutMs, and retry duration summing.

Related Issue

N/A (extends #2367 / #2368 test-runner work)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

What Has Changed

  • Single execution path for host and standalone YAML suites (LocalTestExecutionSession + YamlStepDispatcher)
  • Application driver contract + example_host mixed Flutter + Ensemble demo
  • Structured locators (target / within / occurrence / text) with element-identity resolution and actionable text collapse
  • Host fixtures applied before launch; unsupported API/storage mocks fail closed
  • Integration mode preserves device viewport and skips device-side fixture process starts (ensembleTestHostOwnsServices)
  • Widget-only plugin mocks in the example host driver; integration uses real native channels
  • Package CI workflow for analyze, schema drift, package tests, and widget suites
  • Docs for host/application testing

How to Test

  1. Package analyze + schema + unit tests:
    cd tools/ensemble_test_runner
    flutter analyze --no-pub
    dart run tool/generate_schema.dart && git diff --exit-code
    flutter test
  2. Standalone Ensemble widget suite:
    cd tools/ensemble_test_runner/example
    flutter pub get
    dart run ensemble_test_runner:ensemble_test --tests-dir=tests --test-entry=test/ensemble_yaml_tests.dart --mode=widget
  3. Mixed host widget suite:
    cd tools/ensemble_test_runner/example_host
    flutter pub get
    dart run ensemble_test_runner:ensemble_test --tests-dir=tests --test-entry=test/application_yaml_tests.dart --mode=widget
  4. Still needed before claiming device support — Android emulator and iOS simulator host integration (including an intentional assertion failure and artifact collection). Not verified in this PR yet.

Screenshots / Videos

HTML reports from widget suites under:

  • tools/ensemble_test_runner/example/build/ensemble_test_runner/report/
  • tools/ensemble_test_runner/example_host/build/ensemble_test_runner/report/

Checklist

  • I have run flutter analyze and addressed any new warnings
  • I have run flutter test and all tests pass
  • I have tested my changes on the relevant platform(s)
  • I have updated documentation if needed
  • My changes do not introduce new warnings or errors

…ance documentation

- Introduced a new GitHub Actions workflow for the Ensemble Test Runner, enabling automated testing for standalone and mixed Flutter/Ensemble applications.
- Updated README and documentation to clarify usage, including the new `target` syntax for element matching and the requirement for `startScreen` in standalone tests.
- Added example host application structure to demonstrate integration with Ensemble.
- Enhanced schema definitions to support new testing capabilities and element targeting.
…umentation

- Added support for capturing step screenshots and logging app console, API, and storage logs in the HTML report for host tests.
- Introduced `skip` functionality for password fields to prevent test failures when secure content is visible.
- Updated example host application to demonstrate new API calls and logging features.
- Enhanced configuration options in `config.yaml` for enabling per-step screenshots and API mocks.
- Improved test cases to validate new features, ensuring robust testing of host interactions.
…and documentation

- Updated device.dart to handle uncaught plugin errors gracefully during device info retrieval.
- Enhanced README and documentation to clarify the integration testing mode and its usage.
- Modified application_yaml_tests.dart to support conditional execution based on the test mode.
- Improved test harness to ensure native plugins are registered during integration tests.
- Added new tests to validate device info mock behavior and integration mode functionality.
…e clarity

- Removed unnecessary imports from various files to streamline the codebase.
- Updated a method call to use `await` for better asynchronous handling in `mock_composition.dart`.
- Enhanced variable scoping in `local_action_executor.dart` for improved readability.
…ub Actions

- Introduced a new GitHub Actions workflow for the Ensemble Test Runner, enabling automated analysis, testing, and example suite execution for Flutter applications.
- The workflow includes steps for code checkout, Flutter SDK setup, Melos installation, package analysis, schema drift checks, and running tests for both the main application and example widgets.
…g in test execution

- Enhanced the `mapExecutorFailure` method to provide more accurate error classifications for tap/wait-for-id timeouts, distinguishing between `elementNotFound` and `elementNotInteractable`.
- Updated the `TestStepExecutor` to throw specific errors when widgets are off-screen or not hit-testable.
- Added unit tests to validate the new error mapping logic and ensure correct behavior for various timeout scenarios.
- Cleaned up imports and improved code clarity in the local execution session.
…ing capabilities

- Introduced timeout support for tap, double tap, and long press actions in the test framework, allowing for more flexible interaction handling.
- Improved the resolution of element targets by adding support for actionable controls and refining the logic for handling text locators.
- Enhanced error handling in the local execution session to better manage visibility assertions and element existence checks.
- Updated the host application test driver to ensure proper runtime initialization based on execution mode.
- Added new tests to validate the behavior of structured locators and timeout functionality in various scenarios.
…dling

- Added support for secondary failure tracking during host test execution, allowing for better diagnostics of application errors.
- Improved the `ensureHostFixturesSupported` function to validate API mocks and storage fixtures before test execution.
- Enhanced error handling to classify pending application errors as crashes after screenshots are taken.
- Introduced new tests to validate the behavior of API mocks and error handling in various scenarios, ensuring robust test coverage.
- Removed specific push path triggers from the Ensemble Test Runner workflow, streamlining the conditions under which the workflow is executed.
…egration handling

- Updated the README to clarify the usage of `runApplicationYamlTests` and its integration with the `ensembleTestExecutionMode` dart-define.
- Simplified the main entry point for application YAML tests to directly call `runApplicationYamlTests`.
- Enhanced the CLI to adapt host entries for integration testing, ensuring proper binding selection based on the execution mode.
- Improved the handling of integration and widget test modes, allowing for more flexible test execution.
- Added documentation to emphasize the preferred usage of `runApplicationYamlTests` for better clarity.
@sharjeelyunus sharjeelyunus self-assigned this Sep 21, 2026
- Updated the `toString` method in `TestExecutionError` to return only the message, improving clarity in error reporting.
@sharjeelyunus
sharjeelyunus merged commit a8a80e1 into main Sep 21, 2026
9 checks passed
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.

1 participant