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`.
- `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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
name: flutter_gherkin
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
environment:
@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_test:
integration_test:
sdk: flutter
flutter_driver:
sdk: flutter
@ -23,18 +23,18 @@ dependencies:
# ref: f0b3f955191b53a78075ed2c9387ea8bee12f111
dependency_overrides:
crypto: ^3.0.0 # flutter_driver still depends on 2.1.5 :-(
convert: ^3.0.0 # flutter_driver still depends on >=2.0.0 :-(
test: ^1.16.5 # gherkin still depends on 1.16.8 :-(
test_api: ^0.3.0 # flutter_test still depends on 0.2.19 :-(
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 see https://github.com/flutter/flutter/issues/80293
test_api: ^0.3.0 # flutter_test still depends on 0.2.19 see https://github.com/flutter/flutter/issues/80293
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:
integration_test:
flutter_test:
sdk: flutter
test: ^1.16.5
meta: ^1.3.0
pedantic: ^1.11.0
glob: ^2.0.1
source_gen: ^1.0.0
build: ^2.0.1
build_config: ^1.0.0

View File

@ -1,6 +1,7 @@
import 'package:flutter_gherkin/flutter_gherkin_with_driver.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/step_definition_mock.dart';
@ -8,7 +9,7 @@ import 'mocks/step_definition_mock.dart';
void main() {
group('config', () {
group('prepare', () {
test('flutter app runner hook added', () {
test.test('flutter app runner hook added', () {
final config = FlutterDriverTestConfiguration();
expect(config.hooks, isNull);
config.prepare();
@ -17,7 +18,7 @@ void main() {
expect(config.hooks!.elementAt(0), (x) => x is FlutterAppRunnerHook);
});
test('common steps definition added', () {
test.test('common steps definition added', () {
final config = FlutterDriverTestConfiguration();
expect(config.stepDefinitions, isNull);
@ -28,7 +29,7 @@ void main() {
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()
..stepDefinitions = [MockStepDefinition()]
..customStepParameterDefinitions = [MockParameter()];