Skip to content

Commit 2db755d

Browse files
committed
- BREAKING CHANGE: Made appMainFunction return a Future<void> so it can be async
- Fix: #159: Swipe step not working - Ensure Hook.onBeforeRun is called before the run starts - Set Frame policy- defaults to `LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive` to slightly improve performance
1 parent 3c0e1c6 commit 2db755d

15 files changed

+78
-104
lines changed

.flutter-plugins-dependencies

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +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-09-16 11:36:24.117283","version":"2.5.0"}
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-10-27 20:12:58.071212","version":"2.5.3"}

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [3.0.0-rc.6] - 27/10/2021
2+
3+
- BREAKING CHANGE: Made `appMainFunction` return a `Future<void>` so it can be async
4+
- Fix: #159: Swipe step not working
5+
- Ensure Hook.onBeforeRun is called before the run starts
6+
- Set Frame policy- defaults to `LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive` to slightly improve performance
7+
18
## [3.0.0-rc.5] - 22/06/2021
29

310
- Ensure scenario support files (world etc) as always disposed ensure when test throws error
+6-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
# example_with_integration_test
1+
```
2+
# generate the test suite
3+
flutter pub run build_runner build
24
3-
A new Flutter project.
4-
5-
## Getting Started
6-
7-
This project is a starting point for a Flutter application.
8-
9-
A few resources to get you started if this is your first Flutter project:
10-
11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13-
14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
5+
# run the tests
6+
flutter drive --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart
7+
```

example_with_integration_test/integration_test/gherkin/configuration.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ FlutterTestConfiguration gherkinTestConfiguration =
4141
]
4242
..createWorld = (config) => Future.value(CustomWorld());
4343

44-
void Function(World) appInitializationFn = (World world) {
44+
Future<void> Function(World) appInitializationFn = (World world) async {
4545
// ensure a new injector instance is created each time
4646
final injector = Injector(DateTime.now().microsecondsSinceEpoch.toString());
4747
final externalApplicationManager = ExternalApplicationManager(injector);
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"gherkin_reports": "[[{\"description\":\"\",\"id\":\"user can create a new todo item\",\"keyword\":\"Feature\",\"line\":1,\"name\":\"User can create a new todo item\",\"uri\":\"\",\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"},{\"line\":1,\"name\":\"@tag_two\"}],\"elements\":[{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can create a new todo item;user can create a new todo item\",\"name\":\"User can create a new todo item\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"},{\"line\":1,\"name\":\"@tag_two\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy carrots\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":637000000}},{\"keyword\":\"When \",\"name\":\"I tap the 'add' button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":803000000}},{\"keyword\":\"Then \",\"name\":\"I expect the todo list\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":127000000},\"rows\":[{\"cells\":[\"Todo\"]},{\"cells\":[\"Buy carrots\"]}]}]},{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can create a new todo item;user can create multiple new todo items\",\"name\":\"User can create multiple new todo items\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@debug\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy carrots\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":501000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":719000000}},{\"keyword\":\"And \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy apples\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":379000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":722000000}},{\"keyword\":\"And \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy blueberries\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":374000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":720000000}},{\"keyword\":\"Then \",\"name\":\"I expect the todo list\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":367000000},\"rows\":[{\"cells\":[\"Todo\"]},{\"cells\":[\"Buy blueberries\"]},{\"cells\":[\"Buy apples\"]},{\"cells\":[\"Buy carrots\"]}]},{\"keyword\":\"Given \",\"name\":\"I wait 5 seconds for the animation to complete\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":113000000}}]}]},{\"description\":\"\",\"id\":\"user can have data\",\"keyword\":\"Feature\",\"line\":1,\"name\":\"User can have data\",\"uri\":\"\",\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"}],\"elements\":[{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can have data;user can have data\",\"name\":\"User can have data\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I have item with data\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":0},\"docString\":{\"content_type\":\"\",\"value\":\"{\\n \\\"glossary\\\": {\\n \\\"title\\\": \\\"example glossary\\\",\\n \\\"GlossDiv\\\": {\\n \\\"title\\\": \\\"S\\\",\\n \\\"GlossList\\\": {\\n \\\"GlossEntry\\\": {\\n \\\"ID\\\": \\\"SGML\\\",\\n \\\"SortAs\\\": \\\"SGML\\\",\\n \\\"GlossTerm\\\": \\\"Standard Generalized Markup Language\\\",\\n \\\"Acronym\\\": \\\"SGML\\\",\\n \\\"Abbrev\\\": \\\"ISO 8879:1986\\\",\\n \\\"GlossDef\\\": {\\n \\\"para\\\": \\\"A meta-markup language, used to create markup languages such as DocBook.\\\",\\n \\\"GlossSeeAlso\\\": [\\n \\\"GML\\\",\\n \\\"XML\\\"\\n ]\\n },\\n \\\"GlossSee\\\": \\\"markup\\\"\\n }\\n }\\n }\\n }\\n}\",\"line\":2}}]}]}]]"
2+
"gherkin_reports": "[[{\"description\":\"\",\"id\":\"user can create a new todo item\",\"keyword\":\"Feature\",\"line\":1,\"name\":\"User can create a new todo item\",\"uri\":\"\",\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"},{\"line\":1,\"name\":\"@tag_two\"}],\"elements\":[{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can create a new todo item;user can create a new todo item\",\"name\":\"User can create a new todo item\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"},{\"line\":1,\"name\":\"@tag_two\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy carrots\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":541000000}},{\"keyword\":\"When \",\"name\":\"I tap the 'add' button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":714000000}},{\"keyword\":\"Then \",\"name\":\"I expect the todo list\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":124000000},\"rows\":[{\"cells\":[\"Todo\"]},{\"cells\":[\"Buy carrots\"]}]}]},{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can create a new todo item;user can create multiple new todo items\",\"name\":\"User can create multiple new todo items\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@debug\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy carrots\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":469000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":625000000}},{\"keyword\":\"And \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy apples\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":315000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":825000000}},{\"keyword\":\"And \",\"name\":\"I fill the \\\"todo\\\" field with \\\"Buy blueberries\\\"\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":317000000}},{\"keyword\":\"When \",\"name\":\"I tap the \\\"add\\\" button\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":727000000}},{\"keyword\":\"Then \",\"name\":\"I expect the todo list\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":328000000},\"rows\":[{\"cells\":[\"Todo\"]},{\"cells\":[\"Buy blueberries\"]},{\"cells\":[\"Buy apples\"]},{\"cells\":[\"Buy carrots\"]}]},{\"keyword\":\"Given \",\"name\":\"I wait 5 seconds for the animation to complete\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":104000000}}]}]},{\"description\":\"\",\"id\":\"user can have data\",\"keyword\":\"Feature\",\"line\":1,\"name\":\"User can have data\",\"uri\":\"\",\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"}],\"elements\":[{\"keyword\":\"Scenario\",\"type\":\"scenario\",\"id\":\"user can have data;user can have data\",\"name\":\"User can have data\",\"description\":\"\",\"line\":1,\"tags\":[{\"line\":1,\"name\":\"@tag\"},{\"line\":1,\"name\":\"@tag1\"}],\"steps\":[{\"keyword\":\"Given \",\"name\":\"I have item with data\",\"line\":1,\"match\":{\"location\":\":1\"},\"result\":{\"status\":\"passed\",\"duration\":0},\"docString\":{\"content_type\":\"\",\"value\":\"{\\n \\\"glossary\\\": {\\n \\\"title\\\": \\\"example glossary\\\",\\n \\\"GlossDiv\\\": {\\n \\\"title\\\": \\\"S\\\",\\n \\\"GlossList\\\": {\\n \\\"GlossEntry\\\": {\\n \\\"ID\\\": \\\"SGML\\\",\\n \\\"SortAs\\\": \\\"SGML\\\",\\n \\\"GlossTerm\\\": \\\"Standard Generalized Markup Language\\\",\\n \\\"Acronym\\\": \\\"SGML\\\",\\n \\\"Abbrev\\\": \\\"ISO 8879:1986\\\",\\n \\\"GlossDef\\\": {\\n \\\"para\\\": \\\"A meta-markup language, used to create markup languages such as DocBook.\\\",\\n \\\"GlossSeeAlso\\\": [\\n \\\"GML\\\",\\n \\\"XML\\\"\\n ]\\n },\\n \\\"GlossSee\\\": \\\"markup\\\"\\n }\\n }\\n }\\n }\\n}\",\"line\":2}}]}]}]]"
33
}

example_with_integration_test/integration_test/gherkin_suite_test.g.dart

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_with_integration_test/lib/models/todo_model.g.dart

+1-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example_with_integration_test/pubspec.lock

+21-28
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: _fe_analyzer_shared
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "25.0.0"
10+
version: "30.0.0"
1111
analyzer:
1212
dependency: transitive
1313
description:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.2.0"
17+
version: "2.7.0"
1818
archive:
1919
dependency: transitive
2020
description:
@@ -49,7 +49,7 @@ packages:
4949
name: build
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "2.1.0"
52+
version: "2.1.1"
5353
build_config:
5454
dependency: transitive
5555
description:
@@ -63,7 +63,7 @@ packages:
6363
name: build_daemon
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "3.0.0"
66+
version: "3.0.1"
6767
build_resolvers:
6868
dependency: transitive
6969
description:
@@ -77,14 +77,14 @@ packages:
7777
name: build_runner
7878
url: "https://pub.dartlang.org"
7979
source: hosted
80-
version: "2.1.2"
80+
version: "2.1.4"
8181
build_runner_core:
8282
dependency: transitive
8383
description:
8484
name: build_runner_core
8585
url: "https://pub.dartlang.org"
8686
source: hosted
87-
version: "7.1.0"
87+
version: "7.2.2"
8888
built_collection:
8989
dependency: transitive
9090
description:
@@ -126,7 +126,7 @@ packages:
126126
name: cli_util
127127
url: "https://pub.dartlang.org"
128128
source: hosted
129-
version: "0.3.3"
129+
version: "0.3.5"
130130
clock:
131131
dependency: transitive
132132
description:
@@ -168,7 +168,7 @@ packages:
168168
name: dart_style
169169
url: "https://pub.dartlang.org"
170170
source: hosted
171-
version: "2.1.0"
171+
version: "2.2.0"
172172
fake_async:
173173
dependency: transitive
174174
description:
@@ -213,7 +213,7 @@ packages:
213213
path: ".."
214214
relative: true
215215
source: path
216-
version: "3.0.0-rc.3"
216+
version: "3.0.0-rc.6"
217217
flutter_simple_dependency_injection:
218218
dependency: "direct main"
219219
description:
@@ -256,7 +256,7 @@ packages:
256256
name: glob
257257
url: "https://pub.dartlang.org"
258258
source: hosted
259-
version: "2.0.1"
259+
version: "2.0.2"
260260
graphs:
261261
dependency: transitive
262262
description:
@@ -303,14 +303,14 @@ packages:
303303
name: json_annotation
304304
url: "https://pub.dartlang.org"
305305
source: hosted
306-
version: "4.1.0"
306+
version: "4.3.0"
307307
json_serializable:
308308
dependency: "direct main"
309309
description:
310310
name: json_serializable
311311
url: "https://pub.dartlang.org"
312312
source: hosted
313-
version: "5.0.0"
313+
version: "6.0.1"
314314
logging:
315315
dependency: transitive
316316
description:
@@ -338,7 +338,7 @@ packages:
338338
name: mime
339339
url: "https://pub.dartlang.org"
340340
source: hosted
341-
version: "1.0.0"
341+
version: "1.0.1"
342342
package_config:
343343
dependency: transitive
344344
description:
@@ -374,13 +374,6 @@ packages:
374374
url: "https://pub.dartlang.org"
375375
source: hosted
376376
version: "2.0.3"
377-
pedantic:
378-
dependency: transitive
379-
description:
380-
name: pedantic
381-
url: "https://pub.dartlang.org"
382-
source: hosted
383-
version: "1.11.1"
384377
platform:
385378
dependency: transitive
386379
description:
@@ -394,7 +387,7 @@ packages:
394387
name: plugin_platform_interface
395388
url: "https://pub.dartlang.org"
396389
source: hosted
397-
version: "2.0.1"
390+
version: "2.0.2"
398391
pool:
399392
dependency: transitive
400393
description:
@@ -422,7 +415,7 @@ packages:
422415
name: pubspec_parse
423416
url: "https://pub.dartlang.org"
424417
source: hosted
425-
version: "1.0.0"
418+
version: "1.1.0"
426419
rxdart:
427420
dependency: "direct main"
428421
description:
@@ -436,7 +429,7 @@ packages:
436429
name: shared_preferences
437430
url: "https://pub.dartlang.org"
438431
source: hosted
439-
version: "2.0.7"
432+
version: "2.0.8"
440433
shared_preferences_linux:
441434
dependency: transitive
442435
description:
@@ -497,14 +490,14 @@ packages:
497490
name: source_gen
498491
url: "https://pub.dartlang.org"
499492
source: hosted
500-
version: "1.1.0"
493+
version: "1.1.1"
501494
source_helper:
502495
dependency: transitive
503496
description:
504497
name: source_helper
505498
url: "https://pub.dartlang.org"
506499
source: hosted
507-
version: "1.2.1"
500+
version: "1.3.0"
508501
source_span:
509502
dependency: transitive
510503
description:
@@ -581,7 +574,7 @@ packages:
581574
name: uuid
582575
url: "https://pub.dartlang.org"
583576
source: hosted
584-
version: "3.0.4"
577+
version: "3.0.5"
585578
vector_math:
586579
dependency: transitive
587580
description:
@@ -602,7 +595,7 @@ packages:
602595
name: watcher
603596
url: "https://pub.dartlang.org"
604597
source: hosted
605-
version: "1.0.0"
598+
version: "1.0.1"
606599
web_socket_channel:
607600
dependency: transitive
608601
description:
@@ -623,7 +616,7 @@ packages:
623616
name: win32
624617
url: "https://pub.dartlang.org"
625618
source: hosted
626-
version: "2.2.9"
619+
version: "2.2.10"
627620
xdg_directories:
628621
dependency: transitive
629622
description:

example_with_integration_test/pubspec.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ environment:
1212
dependencies:
1313
flutter:
1414
sdk: flutter
15-
json_serializable: ^5.0.0
16-
json_annotation: ^4.1.0
15+
json_serializable: ^6.0.1
16+
json_annotation: ^4.3.0
1717
rxdart: ^0.27.2
18-
shared_preferences: ^2.0.7
19-
uuid: ^3.0.4
18+
shared_preferences: ^2.0.8
19+
uuid: ^3.0.5
2020
flutter_simple_dependency_injection: ^2.0.0
2121

2222
dev_dependencies:

lib/src/flutter/adapters/widget_tester_app_driver_adapter.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ class WidgetTesterAppDriverAdapter
1818
Duration? timeout = const Duration(seconds: 30),
1919
}) async {
2020
try {
21-
return await nativeDriver.pumpAndSettle(
22-
duration!,
21+
final pumps = await nativeDriver.pumpAndSettle(
22+
duration ?? const Duration(milliseconds: 100),
23+
EnginePhase.sendSemanticsUpdate,
24+
timeout ?? const Duration(seconds: 30),
2325
);
26+
27+
return pumps;
2428
} catch (_) {
2529
return 1;
2630
}

lib/src/flutter/code_generation/generators/gherkin_suite_test_generator.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GherkinSuiteTestGenerator
1616
class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
1717
_CustomGherkinIntegrationTestRunner(
1818
TestConfiguration configuration,
19-
void Function(World) appMainFunction,
19+
Future<void> Function(World) appMainFunction,
2020
) : super(configuration, appMainFunction);
2121
2222
@override
@@ -29,7 +29,7 @@ class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner {
2929
3030
void executeTestSuite(
3131
TestConfiguration configuration,
32-
void Function(World) appMainFunction,
32+
Future<void> Function(World) appMainFunction,
3333
) {
3434
_CustomGherkinIntegrationTestRunner(configuration, appMainFunction).run();
3535
}

0 commit comments

Comments
 (0)