E2EWidgetsFlutterBinding constructor

E2EWidgetsFlutterBinding()

Sets up a listener to report that the tests are finished when everything is torn down.

Implementation

E2EWidgetsFlutterBinding() {
  // TODO(jackson): Report test results as they arrive
  tearDownAll(() async {
    try {
      // For web integration tests we are not using the
      // `plugins.flutter.io/e2e`. Mark the tests as complete before invoking
      // the channel.
      if (kIsWeb) {
        if (!_allTestsPassed.isCompleted) {
          _allTestsPassed.complete(true);
        }
      }
      await _channel.invokeMethod<void>(
        'allTestsFinished',
        <String, dynamic>{'results': _results},
      );
    } on MissingPluginException {
      print('Warning: E2E test plugin was not detected.');
    }
    if (!_allTestsPassed.isCompleted) _allTestsPassed.complete(true);
  });
}