diff --git a/AutomatorServer/app/build.gradle b/AutomatorServer/app/build.gradle index 8e365c320..307dc49fd 100644 --- a/AutomatorServer/app/build.gradle +++ b/AutomatorServer/app/build.gradle @@ -17,7 +17,7 @@ android { minSdkVersion 26 targetSdkVersion 31 versionCode 1 - versionName "0.3.1" + versionName "0.3.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/maestro_cli/CHANGELOG.md b/packages/maestro_cli/CHANGELOG.md index 29843a2b9..1eec711f0 100644 --- a/packages/maestro_cli/CHANGELOG.md +++ b/packages/maestro_cli/CHANGELOG.md @@ -1,7 +1,13 @@ +## 0.3.2 + +- Fix a crash which occured when ADB daemon was not initialized +- Make it possible to add `--dart-define`s in `maestro.toml` +- Fix templates generated by `maestro bootstrap` + ## 0.3.1 -- Automatically inform about new version when it is available. -- Add `maestro update` command to easily update the package. +- Automatically inform about new version when it is available +- Add `maestro update` command to easily update the package ## 0.3.0 @@ -15,24 +21,24 @@ ## 0.1.5 -- Allow for running on many devices simultaneously. -- A usual portion of smaller improvements and bug fixes. +- Allow for running on many devices simultaneously +- A usual portion of smaller improvements and bug fixes ## 0.1.4 -- Be more noisy when an error occurs. -- Change waiting timeout for native widgets from 10s to 2s. +- Be more noisy when an error occurs +- Change waiting timeout for native widgets from 10s to 2s ## 0.1.3 -- Fix a bug which made `flavor` option required. +- Fix a bug which made `flavor` option required - Add `--debug` flag to `maestro drive`, which allows to use default, - non-versioned artifacts from `$MAESTRO_ARTIFACT_PATH`. + non-versioned artifacts from `$MAESTRO_ARTIFACT_PATH` ## 0.1.2 -- Fix typo in generated `integration_test/app_test.dart`. -- Depend on [package:adb](https://pub.dev/packages/adb). +- Fix typo in generated `integration_test/app_test.dart` +- Depend on [package:adb](https://pub.dev/packages/adb) ## 0.1.1 @@ -48,37 +54,37 @@ ## 0.0.9 - Add `--device` option for `maestro drive`, which allows you to specify the - device to use. Devices can be obtained using `adb devices`. + device to use. Devices can be obtained using `adb devices` ## 0.0.8 -- Fix `maestro drive` on Windows crashing with ProcessException. +- Fix `maestro drive` on Windows crashing with ProcessException ## 0.0.7 -- Fix a few bugs. +- Fix a few bugs ## 0.0.6 -- Fix `maestro bootstrap` on Windows crashing with ProcessException. +- Fix `maestro bootstrap` on Windows crashing with ProcessException ## 0.0.5 -- Make versions match AutomatorServer. +- Make versions match AutomatorServer ## 0.0.4 -- Nothing. +- Nothing ## 0.0.3 -- Add support for `maestro.toml` config file. +- Add support for `maestro.toml` config file ## 0.0.2 -- Split `maestro` and `maestro_cli` into separate packages. -- Add basic, working command line interface with. +- Split `maestro` and `maestro_cli` into separate packages +- Add basic, working command line interface with ## 0.0.1 -- Initial version. +- Initial version diff --git a/packages/maestro_cli/lib/src/command_runner.dart b/packages/maestro_cli/lib/src/command_runner.dart index 1cc8fbaf5..0fae80bf1 100644 --- a/packages/maestro_cli/lib/src/command_runner.dart +++ b/packages/maestro_cli/lib/src/command_runner.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:adb/adb.dart'; import 'package:args/command_runner.dart'; import 'package:maestro_cli/src/common/common.dart'; import 'package:maestro_cli/src/features/bootstrap/bootstrap_command.dart'; @@ -11,12 +10,7 @@ import 'package:maestro_cli/src/features/update/update_command.dart'; import 'package:pub_updater/pub_updater.dart'; Future maestroCommandRunner(List args) async { - // TODO: Move this initalization to a better place. - final adb = Adb(); - await adb.init(); - final devices = await adb.devices(); - - final runner = MaestroCommandRunner(devices: devices); + final runner = MaestroCommandRunner(); try { final exitCode = await runner.run(args) ?? 0; @@ -40,13 +34,13 @@ bool debugFlag = false; bool verboseFlag = false; class MaestroCommandRunner extends CommandRunner { - MaestroCommandRunner({required List devices}) + MaestroCommandRunner() : super( 'maestro', 'Tool for running Flutter-native UI tests with superpowers', ) { addCommand(BootstrapCommand()); - addCommand(DriveCommand(devices)); + addCommand(DriveCommand()); addCommand(DoctorCommand()); addCommand(CleanCommand()); addCommand(UpdateCommand()); @@ -126,7 +120,7 @@ Future _checkIfUsingLatestVersion() async { currentVersion: version, ); - if (!isLatestVersion) { + if (!isLatestVersion && !debugFlag) { log ..info( 'Newer version of $maestroCliPackage is available ($latestVersion)', diff --git a/packages/maestro_cli/lib/src/common/constants.dart b/packages/maestro_cli/lib/src/common/constants.dart index c1018c19f..73446976d 100644 --- a/packages/maestro_cli/lib/src/common/constants.dart +++ b/packages/maestro_cli/lib/src/common/constants.dart @@ -1,5 +1,5 @@ /// Version of Maestro CLI. Must be kept in sync with pubspec.yaml. -const version = '0.3.1'; +const version = '0.3.2'; const maestroPackage = 'maestro_test'; const maestroCliPackage = 'maestro_cli'; diff --git a/packages/maestro_cli/lib/src/features/drive/drive_command.dart b/packages/maestro_cli/lib/src/features/drive/drive_command.dart index 7ad9d89d6..12b7622cf 100644 --- a/packages/maestro_cli/lib/src/features/drive/drive_command.dart +++ b/packages/maestro_cli/lib/src/features/drive/drive_command.dart @@ -10,7 +10,7 @@ import 'package:maestro_cli/src/features/drive/flutter_driver.dart' import 'package:maestro_cli/src/maestro_config.dart'; class DriveCommand extends Command { - DriveCommand(List devices) { + DriveCommand() { argParser ..addOption( 'host', @@ -38,7 +38,14 @@ class DriveCommand extends Command { ..addMultiOption( 'devices', help: 'List of devices to drive the app on.', - allowed: ['all', ...devices], + valueHelp: 'all, emulator-5554', + ) + ..addMultiOption( + 'dart-define', + help: + 'List of additional key-value pairs that will be available to the ' + 'app under test.', + valueHelp: 'SOME_VAR=SOME_VALUE', ) ..addFlag( 'parallel', @@ -93,9 +100,23 @@ class DriveCommand extends Command { } final dartDefines = config.driveConfig.dartDefines ?? {}; + final dynamic cliDartDefines = argResults?['dart-define']; + if (cliDartDefines != null && cliDartDefines is! List) { + throw FormatException( + '`dart-define` argument $cliDartDefines is not a list', + ); + } + + for (final entry in cliDartDefines as List) { + final split = entry.split('='); + if (split.length != 2) { + throw FormatException('`dart-define` value $split is not valid'); + } + dartDefines[split[0]] = split[1]; + } for (final dartDefine in dartDefines.entries) { - log.info('dartDefine: ${dartDefine.key}=${dartDefine.value}'); + log.info('Passed --dart--define: ${dartDefine.key}=${dartDefine.value}'); } final devicesArg = argResults?['devices'] as List?; diff --git a/packages/maestro_cli/lib/src/features/drive/drive_config.dart b/packages/maestro_cli/lib/src/features/drive/drive_config.dart index 0f77c159e..f7c5ec524 100644 --- a/packages/maestro_cli/lib/src/features/drive/drive_config.dart +++ b/packages/maestro_cli/lib/src/features/drive/drive_config.dart @@ -56,8 +56,8 @@ class DriveConfig { target: target, driver: driver, flavor: flavor as String?, - dartDefines: (dartDefines as Map) - .map((key, dynamic value) => MapEntry(key, value.toString())), + dartDefines: (dartDefines as Map?) + ?.map((key, dynamic value) => MapEntry(key, value.toString())), ); } diff --git a/packages/maestro_cli/pubspec.yaml b/packages/maestro_cli/pubspec.yaml index 454e7fe44..48690d20e 100644 --- a/packages/maestro_cli/pubspec.yaml +++ b/packages/maestro_cli/pubspec.yaml @@ -1,6 +1,6 @@ name: maestro_cli description: CLI for Maestro. -version: 0.3.1 +version: 0.3.2 homepage: https://github.com/leancodepl/maestro environment: diff --git a/packages/maestro_test/CHANGELOG.md b/packages/maestro_test/CHANGELOG.md index f46cd1d90..2382e0172 100644 --- a/packages/maestro_test/CHANGELOG.md +++ b/packages/maestro_test/CHANGELOG.md @@ -1,13 +1,25 @@ +## 0.3.2 + +- Improve selector engine: + + - Make it possible to pass a `Key` as `matching` to + `MaestroTester.call(dynamic matching)` and `MaestroFinder.$(dynamic matching)` + +- Add `sleep` parameter for `maestroTest` method +- Make `WidgetTester`'s forwarded methods in `MaestroTester` accept less + arguments +- Add more in-code documentation + ## 0.3.1 - Improve selector engine: - - Make it possible to pass a `MaestroFinder` as `expression` to - `MaestroTester.call(dynamic expression)` and `MaestroFinder.$(dynamic expression)` - - Fix a bug which caused chaining expressions (e.g + - Make it possible to pass a `MaestroFinder` as `matching` to + `MaestroTester.call(dynamic matching)` and `MaestroFinder.$(dynamic matching)` + - Fix a bug which caused chaining `MaestroFinder`s (e.g `$(Scaffold).$(Container).$(#someText)`) to not work. -- Add more in-code documentation and improve README. +- Add more in-code documentation and improve README ## 0.3.0 @@ -26,39 +38,39 @@ - Make `Maestro.forTest()` automatically call `IntegrationTestWidgetsFlutterBinding.ensureInitialized()` -- Fix many smaller issues. +- Fix many smaller issues ## 0.1.4 -- Allow for running on many devices simultaneously. -- Rename class `Automator` to `Maestro`. -- Simpified test-side initialization. Now all you need is `Maestro.forTest()`. +- Allow for running on many devices simultaneously +- Rename class `Automator` to `Maestro` +- Simpified test-side initialization. Now all you need is `Maestro.forTest()` - Simpified driver-side initialization. Now all you need is - `Maestro.forDriver()`. + `Maestro.forDriver()` ## 0.1.3 -- Add support for enabling/disabling Bluetooth. +- Add support for enabling/disabling Bluetooth ## 0.1.2 -- Be more noisy when an error occurs. +- Be more noisy when an error occurs ## 0.1.1 -- Fix minor logging bug. +- Fix minor logging bug ## 0.1.0 - Add basic means of controlling platform-native Widgets (`TextView`, `EditText`, and `Button` on Android). This also applies to WebView. -- Add enabling and disabling of Wi-Fi, Celluar, and Night Mode. -- Improve stability. +- Add enabling and disabling of Wi-Fi, Celluar, and Night Mode +- Improve stability ## 0.0.6 -- Set minimum Dart version to 2.16. -- Fix links to `package:leancode_lint` in README. +- Set minimum Dart version to 2.16 +- Fix links to `package:leancode_lint` in README ## 0.0.5 @@ -66,16 +78,16 @@ ## 0.0.4 -- Update README. +- Update README ## 0.0.3 -- Rename from `maestro` to `maestro_test`. +- Rename from `maestro` to `maestro_test` ## 0.0.2 -- Split `maestro` and `maestro_cli` into separate packages. +- Split `maestro` and `maestro_cli` into separate packages ## 0.0.1 -- Initial version. +- Initial version diff --git a/packages/maestro_test/README.md b/packages/maestro_test/README.md index 2183b44ee..eea49a529 100644 --- a/packages/maestro_test/README.md +++ b/packages/maestro_test/README.md @@ -1,7 +1,7 @@ # maestro_test -[![maestro_test on pub.dev][pub_badge]][pub_link] [![code -style][pub_badge_style]][pub_badge_link] +[![maestro_test on pub.dev][pub_badge]][pub_link] +[![codestyle][pub_badge_style]][pub_badge_link] `maestro_test` package builds on top of `flutter_driver` to make it easy to control the native device from Dart. It does this by using Android's @@ -16,10 +16,10 @@ Add `maestro_test` as a dev dependency in `pubspec.yaml`: ``` dev_dependencies: - maestro_test: ^0.3.1 + maestro_test: ^0.3.2 ``` -### Using features of the underlying native platform +### Accessing native platform features ```dart // example/integration_test/example_test.dart diff --git a/packages/maestro_test/pubspec.yaml b/packages/maestro_test/pubspec.yaml index 80afe2d93..1fd598470 100644 --- a/packages/maestro_test/pubspec.yaml +++ b/packages/maestro_test/pubspec.yaml @@ -2,7 +2,7 @@ name: maestro_test description: > Simple, easy-to-learn, Flutter-native UI testing framework eliminating limitations of flutter_driver -version: 0.3.1 +version: 0.3.2 homepage: https://github.com/leancodepl/maestro/tree/master/packages/maestro_test environment: