diff --git a/.github/workflows/patrol-prepare.yaml b/.github/workflows/patrol-prepare.yaml index 71357795f..28f23c945 100644 --- a/.github/workflows/patrol-prepare.yaml +++ b/.github/workflows/patrol-prepare.yaml @@ -174,7 +174,7 @@ jobs: strategy: fail-fast: false matrix: - flutter-version: ['3.3.x', '3.7.x', '3.10.x'] + flutter-version: ['3.3.x', '3.7.x', '3.10.0'] defaults: run: diff --git a/.github/workflows/patrol_cli-prepare.yaml b/.github/workflows/patrol_cli-prepare.yaml index 2ccfcb9a4..82231ceb4 100644 --- a/.github/workflows/patrol_cli-prepare.yaml +++ b/.github/workflows/patrol_cli-prepare.yaml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - flutter-version: ['3.3.x', '3.7.x', '3.10.x'] + flutter-version: ['3.3.x', '3.7.x', '3.10.0'] defaults: run: diff --git a/packages/patrol/lib/src/common.dart b/packages/patrol/lib/src/common.dart index 6cf5c2073..6e1e82562 100644 --- a/packages/patrol/lib/src/common.dart +++ b/packages/patrol/lib/src/common.dart @@ -82,10 +82,9 @@ void patrolTest( tags: tags, (widgetTester) async { if (patrolBinding != null) { - // If Patrol's native automation feature is enabled, then the test will - // only execute if the native side requests it. - - // FIXME: Too strict assumption + // If Patrol's native automation feature is enabled, then this test will + // be executed only if the native side requested it to be executed. + // Otherwise, it returns early. // // The assumption here is that this test doesn't have any extra parent // groups. Every Dart test suite has an implict, unnamed, top-level @@ -93,12 +92,12 @@ void patrolTest( // its name is equal to the path to the Dart test file in the // integration_test directory. // + // In other words, the developer cannot use `group()` in the tests. + // // Example: if this function is called from the Dart test file named // "example_test.dart", and that file is located in the // "integration_test/examples" directory, we assume that the name of the - // immediate parent group is "examples/example_test.dart". - // - // It's good enough for now. + // immediate parent group is "examples.example_test". final parentGroupName = Invoker.current!.liveTest.groups.last.name; final requestedToExecute = await patrolBinding.patrolAppService @@ -107,9 +106,9 @@ void patrolTest( if (!requestedToExecute) { return; } - } - // await nativeAutomator?.configure(); // TODO: Move to bundled_test.dart or add again + await nativeAutomator?.configure(); + } final patrolTester = PatrolTester( tester: widgetTester, diff --git a/packages/patrol_cli/lib/src/test_bundler.dart b/packages/patrol_cli/lib/src/test_bundler.dart index 67e15d549..b5d67d455 100644 --- a/packages/patrol_cli/lib/src/test_bundler.dart +++ b/packages/patrol_cli/lib/src/test_bundler.dart @@ -15,8 +15,8 @@ class TestBundler { } final contents = ''' -// ignore_for_file: invalid_use_of_internal_member, -// depend_on_referenced_packages, directives_ordering +// GENERATED CODE - DO NOT MODIFY BY HAND AND DO NOT COMMIT TO VERSION CONTROL +// ignore_for_file: type=lint, invalid_use_of_internal_member import 'dart:async'; @@ -25,32 +25,30 @@ import 'package:patrol/patrol.dart'; import 'package:patrol/src/native/contracts/contracts.pbgrpc.dart'; import 'package:test_api/src/backend/invoker.dart'; -// START: GENERATED CODE +// START: GENERATED TEST IMPORTS ${generateImports(testFilePaths)} -// END: GENERATED CODE +// END: GENERATED TEST IMPORTS Future main() async { - final nativeAutomator = NativeAutomator(config: NativeAutomatorConfig()); - final binding = PatrolBinding.ensureInitialized(); - // This is the entrypoint of the bundled Dart test. // // Its responsibilies are: - // * Run a special Dart test that explores the hierarchy of groups and tests, - // so it can... - // * ... host a service that the native side of Patrol uses to get the list - // of Dart tests, and to request execution of a specific Dart test. + // * Running a special Dart test that runs before all the other tests and + // explores the hierarchy of groups and tests. + // * Hosting a PatrolAppService, which the native side of Patrol uses to get + // the Dart tests, and to request execution of a specific Dart test. // // When running on Android, the Android Test Orchestrator, before running the // tests, makes an initial run to gather the tests that it will later run. The // native side of Patrol (specifically: PatrolJUnitRunner class) is hooked // into the Android Test Orchestrator lifecycle and knows when that initial // run happens. When it does, PatrolJUnitRunner makes an RPC call to - // PatrolAppService and asks it for the list of Dart tests. + // PatrolAppService and asks it for Dart tests. // // When running on iOS, the native side of Patrol (specifically: the - // PATROL_INTEGRATION_TEST_IOS_RUNNER macro) makes an RPC call to - // PatrolAppSevice and asks it for the list of Dart tests. + // PATROL_INTEGRATION_TEST_IOS_RUNNER macro) makes an initial run to gather + // the tests that it will later run (same as the Android). During that initial + // run, it makes an RPC call to PatrolAppSevice and asks it for Dart tests. // // Once the native runner has the list of Dart tests, it dynamically creates // native test cases from them. On Android, this is done using the @@ -65,6 +63,8 @@ Future main() async { // test (out of which they had been created) and wait for it to complete. // The result of running the Dart test is the result of the native test case. + final nativeAutomator = NativeAutomator(config: NativeAutomatorConfig()); + final binding = PatrolBinding.ensureInitialized(); final testExplorationCompleter = Completer(); // A special test to expore the hierarchy of groups and tests. This is a @@ -78,9 +78,9 @@ Future main() async { testExplorationCompleter.complete(dartTestGroup); }); - // START: GENERATED CODE + // START: GENERATED TEST GROUPS ${generateGroupsCode(testFilePaths).split('\n').map((e) => ' $e').join('\n')} - // END: GENERATED CODE + // END: GENERATED TEST GROUPS final dartTestGroup = await testExplorationCompleter.future; final appService = PatrolAppService(topLevelDartTestGroup: dartTestGroup);