jonsamwell/flutter_gherkin

Unhandled exception: TimeoutException after 0:01:30.000000: Timeout while waiting for observatory debugger uri

aminJamali opened this issue · 0 comments

I have used flutter gherkin to automate my app, in short, this is my scenario:

Feature: Counter
  The counter should be incremented when the button is pressed.

  Scenario: Counter increases when the button is pressed
    When I tap the "increment" button 10 times

and this is my step definition:

class TapButtonNTimesStep extends When2WithWorld<String, int, FlutterWorld> {
  TapButtonNTimesStep()
      : super(
          StepDefinitionConfiguration()
            ..timeout = Duration(
              seconds: 10,
            ),
        );

  @override
  Future<void> executeStep(input1, input2) async {
    final locator = find.byValueKey(input1);
    for (var i = 0; i < input2; i += 1) {
      await FlutterDriverUtils.tap(world.driver, locator);
    }
    final textLocator = find.byValueKey('counter');
    expectMatch(world.driver!.getText(textLocator), input2.toString());
  }

  @override
  Pattern get pattern => r"I tap the {string} button {int} times";
}

also I have created an app.dart file that contains the void method and enables the flutterDriver:

void main() {
 
  enableFlutterDriverExtension();


  runApp(MyApp());
}

and finally, this is my app_test.dart file that configures the gherkin:

Future<void> main() {
  final config = FlutterTestConfiguration()
    ..features = [RegExp('features/*.*.feature')]
    ..reporters = [
      ProgressReporter(),
      TestRunSummaryReporter(),
    ]
    ..stepDefinitions = [
      TapButtonNTimesStep(),
    ]
    ..restartAppBetweenScenarios = true
    ..targetAppPath = "test_driver/app.dart";
  return GherkinRunner().execute(config);
}

but when I run the command flutter drive --target=test_driver/app.dart I get below error:

The Dart VM service is listening on http://127.0.0.1:53867/_Ff1HnFl60Y=/
Starting Flutter app under test 'test_driver/app.dart', this might take a few moments
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate 
to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying G
radle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
I/art     ( 5182): Debugger is no longer active
I/art     ( 5182): Starting a blocking GC Instrumentation
I/flutter ( 5275): The Dart VM service is listening on http://127.0.0.1:38142/xJ0IMG2GTyk=/
Unhandled exception:
TimeoutException after 0:01:30.000000: Timeout while waiting for observatory debugger uri

I also tried setting build time out to 10 min but didn't work.
I'm using flutter 3.22.2