feat(null-satefy): more lib version tweaks

This commit is contained in:
Jon Samwell 2021-05-01 15:02:44 +10:00
parent 31bf38cef1
commit a90f9fb223
9 changed files with 46 additions and 35 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-05-01 13:05:07.936285","version":"2.0.5"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-05-01 15:02:07.460210","version":"2.0.5"}

View File

@ -6,9 +6,9 @@
In order to progress this library and add support for the new integration_test package various things have had to be changed to enable this will still supporting Flutter Driver. The big of which is removing Flutter Driver instance from the `FlutterWorld` instance in favour of an adapter approach whereby driving of the app (whether that is via `flutter_driver` or `WidgetTester`) becomes agnostic see `https://github.com/jonsamwell/flutter_gherkin/blob/f1fb2d4a632362629f5d1a196a0c055f858ad1d7/lib/src/flutter/adapters/app_driver_adapter.dart`. In order to progress this library and add support for the new integration_test package various things have had to be changed to enable this will still supporting Flutter Driver. The big of which is removing Flutter Driver instance from the `FlutterWorld` instance in favour of an adapter approach whereby driving of the app (whether that is via `flutter_driver` or `WidgetTester`) becomes agnostic see `https://github.com/jonsamwell/flutter_gherkin/blob/f1fb2d4a632362629f5d1a196a0c055f858ad1d7/lib/src/flutter/adapters/app_driver_adapter.dart`.
- `FlutterDriverUtils` has been removed, use `world.appDriver` instead. You can still access the raw driver if needed via `world.appDriver.rawDriver` - `FlutterDriverUtils` has been removed, use `world.appDriver` instead. You can still access the raw driver if needed via `world.appDriver.rawDriver`
- If you are using a custom world object and still want to use Flutter Driver it will need to extend `FlutterDriverWorld` instead of `FlutterWorld` - If you are using a custom world object and still want to use Flutter Driver it will need to extend `FlutterDriverWorld` instead of `FlutterWorld` this will give you type safety on the `world.appDriver.rawDriver` property
The change to use the `integration_test` package is a fundamentally different approach. Where using the `flutter_driver` implementation your app is launch in a different process and then controlled by remote RPC calls from the flutter driver again in a different process. Using the new `integration_test` package your tests surround your app and become the app themselves. This removes the need for RPC communication from an external process into the app as well as giving you access to the internal state of your app. This is an altogether better approach, one that is quicker, more maintainable scalable to device testing labs. However, it brings with it, its own set of challenges when trying to make this library work with it. Traditionally this library has evaluated the Gherkin feature files at run time, then used that evaluation to invoke actions against the app under test. However, as the tests need to surround the app in the `integration_test` view of the world the Gherkin tests need to be generated at development time so they can be complied in to a test app. Much like `json_serializable` creates classes that are able to work with json data. The change to use the `integration_test` package is a fundamentally different approach. Where using the `flutter_driver` implementation your app is launch in a different process and then controlled by remote RPC calls from flutter driver in a different process. Using the new `integration_test` package your tests surround your app and become the app themselves. This removes the need for RPC communication from an external process into the app as well as giving you access to the internal state of your app. This is an altogether better approach, one that is quicker, more maintainable, scalable to device testing labs. However, it brings with it, its own set of challenges when trying to make this library work with it. Traditionally this library has evaluated the Gherkin feature files at run time, then used that evaluation to invoke actions against the app under test. However, as the tests need to surround the app in the `integration_test` view of the world the Gherkin tests need to be generated at development time so they can be complied in to a test app. Much like `json_serializable` creates classes that are able to work with json data.
### Steps to get going ### Steps to get going

View File

@ -1,12 +1,14 @@
import 'package:flutter_gherkin/flutter_gherkin.dart'; import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart'; import 'package:gherkin/gherkin.dart';
import 'gherkin/configuration.dart';
part 'gherkin_suite_test.g.dart'; part 'gherkin_suite_test.g.dart';
@GherkinTestSuite() @GherkinTestSuite()
void main() { void main() {
// executeTestSuite( executeTestSuite(
// gherkinTestConfiguration, gherkinTestConfiguration,
// appInitializationFn, appInitializationFn,
// ); );
} }

View File

@ -28,7 +28,7 @@ class _AddTodoComponentState extends State<AddTodoComponent>
widget.todo.takeUntil(disposed$).listen( widget.todo.takeUntil(disposed$).listen(
(model) { (model) {
setState(() { setState(() {
_textEditingController.text = model.action ?? ''; _textEditingController.text = model.action;
}); });
}, },
); );

View File

@ -57,7 +57,8 @@ void executeTestSuite(
.listValue .listValue
.map((path) => Glob(path.toStringValue()!)) .map((path) => Glob(path.toStringValue()!))
.map( .map(
(glob) => glob.listSync() (glob) => glob
.listSync()
.map((entity) => File(entity.path).readAsStringSync()) .map((entity) => File(entity.path).readAsStringSync())
.toList(), .toList(),
) )

View File

@ -1,4 +1,4 @@
CALL flutter analyze CALL flutter analyze
CALL "C:\Google\flutter\bin\cache\dart-sdk\bin\dartfmt" . -w CALL "C:\Google\flutter\bin\cache\dart-sdk\bin\dartfmt" . -w
CALL flutter packages upgrade CALL flutter packages upgrade
CALL flutter test CALL flutter test --no-sound-null-safety

View File

@ -23,12 +23,12 @@ packages:
source: hosted source: hosted
version: "2.0.13" version: "2.0.13"
args: args:
dependency: transitive dependency: "direct overridden"
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.0" version: "2.1.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -112,7 +112,7 @@ packages:
name: coverage name: coverage
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.15.2" version: "1.0.2"
crypto: crypto:
dependency: "direct overridden" dependency: "direct overridden"
description: description:
@ -152,10 +152,17 @@ packages:
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_test: flutter_test:
dependency: "direct main" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
fuchsia_remote_debug_protocol: fuchsia_remote_debug_protocol:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -169,7 +176,7 @@ packages:
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
glob: glob:
dependency: "direct dev" dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -190,7 +197,7 @@ packages:
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
integration_test: integration_test:
dependency: "direct dev" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.9.2+2" version: "0.9.2+2"
@ -249,7 +256,7 @@ packages:
name: node_preamble name: node_preamble
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.13" version: "2.0.0"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -403,12 +410,12 @@ packages:
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
test: test:
dependency: "direct dev" dependency: "direct overridden"
description: description:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.5" version: "1.17.3"
test_api: test_api:
dependency: "direct overridden" dependency: "direct overridden"
description: description:
@ -422,7 +429,7 @@ packages:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.15" version: "0.3.23"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -438,12 +445,12 @@ packages:
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
vm_service: vm_service:
dependency: transitive dependency: "direct overridden"
description: description:
name: vm_service name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.5.0" version: "6.2.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:

View File

@ -1,6 +1,6 @@
name: flutter_gherkin name: flutter_gherkin
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
version: 1.2.0 version: 2.0.0
homepage: https://github.com/jonsamwell/flutter_gherkin homepage: https://github.com/jonsamwell/flutter_gherkin
environment: environment:
@ -10,7 +10,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_test: integration_test:
sdk: flutter sdk: flutter
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
@ -23,18 +23,18 @@ dependencies:
# ref: f0b3f955191b53a78075ed2c9387ea8bee12f111 # ref: f0b3f955191b53a78075ed2c9387ea8bee12f111
dependency_overrides: dependency_overrides:
crypto: ^3.0.0 # flutter_driver still depends on 2.1.5 :-( crypto: ^3.0.0 # flutter_driver still depends on 2.1.5 see https://github.com/flutter/flutter/issues/80293
convert: ^3.0.0 # flutter_driver still depends on >=2.0.0 :-( convert: ^3.0.0 # flutter_driver still depends on >=2.0.0 see https://github.com/flutter/flutter/issues/80293
test: ^1.16.5 # gherkin still depends on 1.16.8 :-( test_api: ^0.3.0 # flutter_test still depends on 0.2.19 see https://github.com/flutter/flutter/issues/80293
test_api: ^0.3.0 # flutter_test still depends on 0.2.19 :-( vm_service: ^6.0.0 # flutter_test still depends on 5.5.0 see https://github.com/flutter/flutter/issues/80293
test: ^1.17.3 # integration_test still depends on 1.16.6 see https://github.com/flutter/flutter/issues/71379
args: ^2.0.0 # flutter_driver still depends on 1.6.0 see https://github.com/flutter/flutter/issues/80293
dev_dependencies: dev_dependencies:
integration_test: flutter_test:
sdk: flutter sdk: flutter
test: ^1.16.5
meta: ^1.3.0 meta: ^1.3.0
pedantic: ^1.11.0 pedantic: ^1.11.0
glob: ^2.0.1
source_gen: ^1.0.0 source_gen: ^1.0.0
build: ^2.0.1 build: ^2.0.1
build_config: ^1.0.0 build_config: ^1.0.0

View File

@ -1,6 +1,7 @@
import 'package:flutter_gherkin/flutter_gherkin_with_driver.dart'; import 'package:flutter_gherkin/flutter_gherkin_with_driver.dart';
import 'package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart'; import 'package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart';
import 'package:test/test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:test/test.dart' as test;
import 'mocks/parameter_mock.dart'; import 'mocks/parameter_mock.dart';
import 'mocks/step_definition_mock.dart'; import 'mocks/step_definition_mock.dart';
@ -8,7 +9,7 @@ import 'mocks/step_definition_mock.dart';
void main() { void main() {
group('config', () { group('config', () {
group('prepare', () { group('prepare', () {
test('flutter app runner hook added', () { test.test('flutter app runner hook added', () {
final config = FlutterDriverTestConfiguration(); final config = FlutterDriverTestConfiguration();
expect(config.hooks, isNull); expect(config.hooks, isNull);
config.prepare(); config.prepare();
@ -17,7 +18,7 @@ void main() {
expect(config.hooks!.elementAt(0), (x) => x is FlutterAppRunnerHook); expect(config.hooks!.elementAt(0), (x) => x is FlutterAppRunnerHook);
}); });
test('common steps definition added', () { test.test('common steps definition added', () {
final config = FlutterDriverTestConfiguration(); final config = FlutterDriverTestConfiguration();
expect(config.stepDefinitions, isNull); expect(config.stepDefinitions, isNull);
@ -28,7 +29,7 @@ void main() {
expect(config.customStepParameterDefinitions!.length, 2); expect(config.customStepParameterDefinitions!.length, 2);
}); });
test('common step definition added to existing steps', () { test.test('common step definition added to existing steps', () {
final config = FlutterTestConfiguration() final config = FlutterTestConfiguration()
..stepDefinitions = [MockStepDefinition()] ..stepDefinitions = [MockStepDefinition()]
..customStepParameterDefinitions = [MockParameter()]; ..customStepParameterDefinitions = [MockParameter()];