fix(integration_test): ensure tearDownAll is always run
This commit is contained in:
parent
230a8e8d5f
commit
ef04fa3386
|
@ -109,6 +109,9 @@ flutter drive --driver=test_driver/integration_test_driver.dart --target=integra
|
|||
11. Custom world need to extend `FlutterWorld` note `FlutterDriverWorld`.
|
||||
12. If you change any of the feature files you will need to re-generate the tests using the below command
|
||||
```
|
||||
# you might need to run the clean command first if you have just changed feature files
|
||||
flutter pub run build_runner clean
|
||||
|
||||
flutter pub run build_runner build
|
||||
```
|
||||
|
||||
|
|
|
@ -23,3 +23,4 @@ Feature: Creating todos
|
|||
| Buy apples |
|
||||
| Buy carrots |
|
||||
Given I wait 5 seconds for the animation to complete
|
||||
When I test the default step timeout is not applied to step with custom timeout
|
|
@ -8,6 +8,7 @@ import 'package:gherkin/gherkin.dart';
|
|||
import 'hooks/reset_app_hook.dart';
|
||||
import 'steps/expect_todos_step.dart';
|
||||
import 'steps/when_await_animation.dart';
|
||||
import 'steps/when_step_has_timeout.dart';
|
||||
import 'world/custom_world.dart';
|
||||
|
||||
FlutterTestConfiguration gherkinTestConfiguration =
|
||||
|
@ -15,6 +16,7 @@ FlutterTestConfiguration gherkinTestConfiguration =
|
|||
[
|
||||
thenIExpectTheTodos,
|
||||
whenAnAnimationIsAwaited,
|
||||
whenStepHasTimeout,
|
||||
],
|
||||
)
|
||||
// ..tagExpression = '@debug'
|
||||
|
@ -35,7 +37,6 @@ FlutterTestConfiguration gherkinTestConfiguration =
|
|||
writeReport: (_, __) => Future<void>.value(),
|
||||
),
|
||||
]
|
||||
..defaultTimeout = const Duration(minutes: 1)
|
||||
..createWorld = (config) => Future.value(CustomWorld());
|
||||
|
||||
void Function(World) appInitializationFn = (World world) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,12 @@
|
|||
import 'package:gherkin/gherkin.dart';
|
||||
import 'package:flutter_gherkin/flutter_gherkin_integration_test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
final whenStepHasTimeout = when<FlutterWidgetTesterWorld>(
|
||||
'I test the default step timeout is not applied to step with custom timeout',
|
||||
(_) async {
|
||||
await Future<void>.delayed(const Duration(seconds: 30));
|
||||
},
|
||||
configuration: StepDefinitionConfiguration()
|
||||
..timeout = const Duration(seconds: 15),
|
||||
);
|
|
@ -54,13 +54,13 @@ abstract class GherkinIntegrationTestRunner {
|
|||
|
||||
_safeInvokeFuture(() async => await reporter.onTestRunStarted());
|
||||
|
||||
onRun();
|
||||
|
||||
tearDownAll(
|
||||
() {
|
||||
onRunComplete();
|
||||
},
|
||||
);
|
||||
|
||||
onRun();
|
||||
}
|
||||
|
||||
void onRun();
|
||||
|
|
Loading…
Reference in New Issue