diff --git a/docs/compatibility-table.mdx b/docs/compatibility-table.mdx index eea27570d..366cb39d5 100644 --- a/docs/compatibility-table.mdx +++ b/docs/compatibility-table.mdx @@ -13,7 +13,8 @@ the table below to assess which version you should use. | patrol_cli | patrol | Min Flutter Version | | -------------- | -------------- | ------------------- | -| 3.4.0+ | 3.13.0+ | 3.24.0 | +| 3.4.1+ | 3.13.1+ | 3.24.0 | +| 3.4.0 | 3.13.0 | 3.24.0 | | 3.3.0 | 3.12.0 | 3.24.0 | | 3.2.1 | 3.11.2 | 3.24.0 | | 3.2.0 | 3.11.0 - 3.11.1| 3.22.0 | diff --git a/packages/patrol/CHANGELOG.md b/packages/patrol/CHANGELOG.md index f69a43b08..c1da30793 100644 --- a/packages/patrol/CHANGELOG.md +++ b/packages/patrol/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.13.1 + +- Remove whitespace replacement on Android test name. (#2437) + ## 3.13.0 - Add support for the `patrol_log` package. (#2387) diff --git a/packages/patrol/example/pubspec.yaml b/packages/patrol/example/pubspec.yaml index 45da527da..63a20bb94 100644 --- a/packages/patrol/example/pubspec.yaml +++ b/packages/patrol/example/pubspec.yaml @@ -34,6 +34,8 @@ dev_dependencies: leancode_lint: ^14.2.0 patrol: path: .. + patrol_cli: + path: ../../patrol_cli flutter_launcher_icons: android: 'launcher_icon' diff --git a/packages/patrol/pubspec.yaml b/packages/patrol/pubspec.yaml index 54d482893..ed584f3a0 100644 --- a/packages/patrol/pubspec.yaml +++ b/packages/patrol/pubspec.yaml @@ -2,7 +2,7 @@ name: patrol description: > Powerful Flutter-native UI testing framework overcoming limitations of existing Flutter testing tools. Ready for action! -version: 3.13.0 +version: 3.13.1 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol issue_tracker: https://github.com/leancodepl/patrol/issues diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 8072712a5..3fa63465d 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,6 +1,7 @@ -## Unreleased +## 3.4.1 - Add android product flavor to dart-define. (#2425) +- Detect and warn about Orchestrator 1.5.0. (#2437) ## 3.4.0 diff --git a/packages/patrol_cli/lib/src/android/android_test_backend.dart b/packages/patrol_cli/lib/src/android/android_test_backend.dart index 99b0992f7..008732cdc 100644 --- a/packages/patrol_cli/lib/src/android/android_test_backend.dart +++ b/packages/patrol_cli/lib/src/android/android_test_backend.dart @@ -46,6 +46,7 @@ class AndroidTestBackend { Future build(AndroidAppOptions options) async { await buildApkConfigOnly(options.flutter.command); await loadJavaPathFromFlutterDoctor(options.flutter.command); + await detectOrchestratorVersion(options); await _disposeScope.run((scope) async { final subject = options.description; @@ -179,6 +180,38 @@ class AndroidTestBackend { ); } + /// Detects the orchestrator version and warns the user if it's 1.5.0. + /// Related to this regression: https://github.com/android/android-test/issues/2255 + Future detectOrchestratorVersion( + AndroidAppOptions options, + ) async { + await _disposeScope.run((scope) async { + Process process; + + process = await _processManager.start( + options.toGradleAppDependencies(isWindows: _platform.isWindows), + runInShell: true, + workingDirectory: _rootDirectory.childDirectory('android').path, + environment: switch (javaPath) { + final javaPath? => {'JAVA_HOME': javaPath}, + _ => {}, + }, + ) + ..disposedBy(scope); + process.listenStdOut((l) { + if (l.contains('androidx.test:orchestrator:1.5.0')) { + _logger.warn( + 'Orchestrator version 1.5.0 detected\n' + 'Orchestrator 1.5.0 does not support whitespace in the test name.\n' + 'Please update the orchestrator version to 1.5.1 or higher.\n', + ); + } + }).disposedBy(scope); + + await process.exitCode; + }); + } + /// Executes the tests of the given [options] on the given [device]. /// /// [build] must be called before this method. diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index d7fcb8c78..173085a39 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '3.4.0'; +const version = '3.4.1'; diff --git a/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart b/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart index 2f5e47ab4..83c80f152 100644 --- a/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart +++ b/packages/patrol_cli/lib/src/compatibility_checker/compatibility_checker.dart @@ -64,7 +64,7 @@ class CompatibilityChecker { process.listenStdOut( (line) async { if (line.startsWith('- patrol ')) { - packageCompleter.complete(line.split(' ').last); + packageCompleter.maybeComplete(line.split(' ').last); } }, onDone: () { @@ -215,6 +215,10 @@ final _patrolVersionRange = [ ), VersionRange( min: Version.parse('3.13.0'), + max: Version.parse('3.13.0'), + ), + VersionRange( + min: Version.parse('3.13.1'), ), ]; @@ -265,5 +269,9 @@ final _patrolCliVersionRange = [ ), VersionRange( min: Version.parse('3.4.0'), + max: Version.parse('3.4.0'), + ), + VersionRange( + min: Version.parse('3.4.1'), ), ]; diff --git a/packages/patrol_cli/lib/src/crossplatform/app_options.dart b/packages/patrol_cli/lib/src/crossplatform/app_options.dart index 342ecaac7..d822532c8 100644 --- a/packages/patrol_cli/lib/src/crossplatform/app_options.dart +++ b/packages/patrol_cli/lib/src/crossplatform/app_options.dart @@ -86,6 +86,20 @@ class AndroidAppOptions { ); } + List toGradleAppDependencies({required bool isWindows}) { + final List cmd; + if (isWindows) { + cmd = [r'.\gradlew.bat']; + } else { + cmd = ['./gradlew']; + } + + // Add Gradle task + cmd.add(':app:dependencies'); + + return cmd; + } + String get _buildMode => flutter.buildMode.androidName; String get _effectiveFlavor { diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index 8cfc211e5..4d88bd5b4 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 3.4.0 # Must be kept in sync with constants.dart +version: 3.4.1 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22