Giter Site home page Giter Site logo

jonsamwell / flutter_gherkin Goto Github PK

View Code? Open in Web Editor NEW
202.0 10.0 110.0 864 KB

A Gherkin parsers and runner for Dart and Flutter which is very similar to cucumber

License: MIT License

Java 0.19% Objective-C 1.05% Dart 93.77% Gherkin 4.70% Batchfile 0.28%
gherkin gherkin-parser cucumber dart flutter flutter-driver-extensions flutter-test

flutter_gherkin's People

Contributors

bartonhammond avatar christerdynamo avatar doubleo2 avatar dustin-graham avatar iqbalmineraltown avatar jonsamwell avatar kev52 avatar off-by-some avatar orevial avatar pholey avatar raddatzk avatar sebastiankutschbach avatar tshedor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_gherkin's Issues

Access to FlutterDriver from hooks?

Hi, I'm trying to setup a mock web server to help drive my integration tests. Today I've been struggling to find a nice way to communicate the address and port for my mock server to my instrumented application. The best I've been able to come up with so far is to use FlutterDriver.requestData to send the information and then in my instrumented test app I wait for this information via a Completer like this:

app.dart

void main() async {
  // This line enables the extension
  final baseUrlCompleter = Completer();
  String mockUrl;
  enableFlutterDriverExtension(handler: (arg) {
    mockUrl = arg;
    baseUrlCompleter.complete();
    return Future.value("");
  });
  
  // wait till the test tells us what the base url is
  await baseUrlCompleter.future;
  print("mockUrl: $mockUrl");

  FleetApiDiscriminator.setupDiscriminator();
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
  ]);
  HttpOverrides.global = StethoHttpOverrides();

  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((LogRecord rec) {
    print('${rec.level.name}: ${rec.time}: ${rec.message}');
  });

  final baseUrl = Constants.STAGING_BASE_URL;

  final crashReporter = DebugRTAEventReporter();
  final analyticsTracker = DefaultAnalyticsTracker();
  
  runApp(AppConfigurator(
    baseUrl: baseUrl,
    eventReporter: crashReporter,
    analyticsTracker: analyticsTracker,
  ));
}

Then in app_test.dart:

Future<void> main() {
  final config = FlutterTestConfiguration()
    ..features = [Glob(r"test_driver/features/**.feature")]
    ..reporters = [
      ProgressReporter(),
      TestRunSummaryReporter(),
      StdoutReporter()
    ] // you can include the "StdoutReporter()" without the message level parameter for verbose log information
    ..hooks = [MockServerHook()]
    ..stepDefinitions = [TheDashboardsAreListed()]
    ..restartAppBetweenScenarios = true
    ..targetAppPath = "test_driver/app.dart"
    ..createWorld = (config) async {
      final FlutterTestConfiguration flutterConfig = config;
      final flutterWorld = await flutterConfig.createFlutterWorld(config, null);
      await flutterWorld.driver.requestData("scooby doo");
      return flutterWorld;
    }
    ..exitAfterTestRun = true; // set to false if debugging to exit cleanly
  return GherkinRunner().execute(config);
}

From here I'm able to successfully send the string "scooby doo" to my instrumented app and have it available before the app is created.

However, what I'd like to be able to do is have a custom Hook class that manages my mock api server since it has start and stop lifecycle awareness.

Now, I do see that Hooks can get access to the configuration object. My latest idea is to extend FlutterTestConfiguration so that it can get access to the FlutterWorld which holds the FlutterDriver which can send my message to the app. But this feels messy.

I guess what I'm looking for is a way to have a test lifecycle aware context in which I can run my mock web server and communicate the address to my instrumented app before it initializes. Are there already good ways to do this? Am I on the right track if there are?

Thank you!

gherkin for dart only?

Is there a way to use this library for dart packages only?
AND/OR
Is is possible to test without flutter driver (Non UI acceptance tests)

feature files execution order

Hi I have written set of feature files each feature in a single file which consists of multiple scenarios and I only have a single step file which consists of all the step defination classes required to run the test
The problem is When I run the test the tests are executed in the order the feature files are in the directory is there any way to specify the order in which feature files should be executed,One way I understand is to write all the scenarios in one file,but I dont think its a good idea.
heres the folder structure
Peek 2019-11-28 11-19

test_config.dart

import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';

import 'steps/stepFile.dart';

Future<void> main() {
  final config = FlutterTestConfiguration()
    ..features = [Glob(r"test_driver/features/**.feature")]
    ..reporters = [
      ProgressReporter(),
      TestRunSummaryReporter(),
      JsonReporter(path: 'bddReport.json')
    ]
    ..stepDefinitions = [
      GivenPageIsPresent(),
      WhenSwipeRight(),
      ThenPageIsPresent(),
      WhenSwipeLeft()
    ]
    ..restartAppBetweenScenarios = false
    ..targetAppPath = "test_driver/app.dart"
    ..exitAfterTestRun = true;
  return GherkinRunner().execute(config);
}

let me know if you need some additional info

onAfterScenarioWorldCreated called after onBeforeScenario

I need to install some isolate extensions before my scenarios are run so that they can call back to flutter code. I need the world to do this so I can get at the flutter driver and its isolate.

I was hoping to do this with onAfterScenarioWorldCreated as it is passed the world and I assumed it was called before any scenario callbacks were called. Apparently onBeforeScenario is called first but it doesn't get passed the world object. I need the isolate extensions in place before onBeforeScenario is called.

Thoughts?

Writing step definitions using annotations

Hi @jonsamwell, thanks for writing this library.
I'm a relative Flutter noob, but have been working with Cucumber in a few other languages.
In most of those, a step definition is represented by a method with an annotation containing the RegEx part and some code generation / macro magic searches for such annotations, parses the method signature, aligns it with the RegEx and generates the required code.
Afais Dart's source_gen should be capable of doing sth. like this.
Have you thought about this and do you think it would work?

Unhandled exception in GherkinRunner.execute

@jonsamwell

I changed dependencies to 1.1.8-rc.2 and right now an error occurs when running tests

Unhandled exception:
Exception: Unknown runnable child given to Scenario 'TextLineRunnable'
#0 ScenarioRunnable.addChild (package:gherkin/src/gherkin/runnables/scenario.dart:33:9)
#1 GherkinParser._parseBlock (package:gherkin/src/gherkin/parser.dart:120:21)
#2 GherkinParser._parseBlock (package:gherkin/src/gherkin/parser.dart:109:15)
#3 GherkinParser.parseFeatureFile (package:gherkin/src/gherkin/parser.dart:55:7)
#4 GherkinRunner.execute (package:gherkin/src/test_runner.dart:47:43)

and that's my test_main.dart

Future main() {
final config = FlutterTestConfiguration()
..features = [Glob("ui_tests/features/**.feature")]
..reporters = [
ProgressReporter(),
TestRunSummaryReporter(),
JsonReporter(path: './report.json')
]
..stepDefinitions = [
LoginScreenOpened(),
]
..reporters = [ProgressReporter(), TestRunSummaryReporter()]
..restartAppBetweenScenarios = true
..targetAppPath = "ui_tests/ui_main.dart"
..exitAfterTestRun = true;
return GherkinRunner().execute(config);
}

and the step:

class LoginScreenOpened extends GivenWithWorld {
@OverRide
Future executeStep() async {
await world.driver
.waitFor(find.byValueKey(UiTestKeys.executeLoginUserNameKey));
await world.driver
.waitFor(find.byValueKey(UiTestKeys.executeLoginPasswordKey));
await world.driver
.waitFor(find.byValueKey(UiTestKeys.executeLoginButtonKey));
}
@OverRide
RegExp get pattern => RegExp(r"login screen opened");
}

Setting up initial test

Hey Jon,
First of all, great work to have this plugin out. I am looking forward to use this to write automated tests.

For my demo app I would like to have your help in setting up my first test properly. I tried to follow along instructions in readme file but getting an error while running the test. Here's what I've done till now:

login.feature:

Feature: Login
User should be able to login successfully after clicking login button.

Scenario: User logs in successfully
Given I expect the user enters email

steps.dart:

import 'package:flutter_driver/flutter_driver.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';

class LoginValidation extends Given1WithWorld<String, FlutterWorld> {

  @override
  Future<void> executeStep(input1) async {
    String input1 = "[email protected]";
    await FlutterDriverUtils.tap(world.driver, find.byValueKey('inputKeyString'));
    await FlutterDriverUtils.enterText(world.driver, find.byValueKey('inputKeyString'), input1);
  }

  @override
  // TODO: implement pattern
  RegExp get pattern => null;

}

app_test.dart:

import 'dart:async';
import 'package:glob/glob.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';

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

Demo app screen:

Screen Shot 2019-04-11 at 5 25 06 PM

When I tried to run this test, I got following exception:


[info ] FlutterDriver: Connected to Flutter application.
Running scenario: User logs in successfully # ./test_driver/features/login.feature:3
0 scenario ()
0 step ()
0:00:00.299000
Unhandled exception:
Instance of 'GherkinStepNotDefinedException'
#0      FeatureFileRunner._matchStepToExectuableStep (package:flutter_gherkin/src/feature_file_runner.dart:209:7)
#1      FeatureFileRunner._runStep (package:flutter_gherkin/src/feature_file_runner.dart:133:33)
#2      _AsyncAwaitCompleter.start (dart:async/runtime/lib/async_patch.dart:49:6)
#3      FeatureFileRunner._runStep (package:flutter_gherkin/src/feature_file_runner.dart:130:30)
#4      FeatureFileRunner._runScenario (package:flutter_gherkin/src/feature_file_runner.dart:107:28)
#5      _RootZone.runUnary (dart:async/zone.dart:1379:54)
#6      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#8      Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#9      Future._complete (dart:async/future_impl.dart:473:7)
#10     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#11     _AsyncAwaitCompleter.complete (dart:async/runtime/lib/async_patch.dart:28:18)
#12     _completeOnAsyncReturn (dart:async/runtime/lib/async_patch.dart:294:13)
#13     AggregatedReporter.onScenarioStarted (package:flutter_gherkin/src/reporters/aggregated_reporter.dart)
#14     _RootZone.runUnary (dart:async/zone.dart:1379:54)
#15     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#16     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#17     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#18     Future._complete (dart:async/future_impl.dart:473:7)
#19     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#20     _AsyncAwaitCompleter.complete (dart:async/runtime/lib/async_patch.dart:28:18)
#21     _completeOnAsyncReturn (dart:async/runtime/lib/async_patch.dart:294:13)
#22     AggregatedReporter._invokeReporters (package:flutter_gherkin/src/reporters/aggregated_reporter.dart)
#23     _RootZone.runUnary (dart:async/zone.dart:1379:54)
#24     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#25     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#26     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#27     Future._complete (dart:async/future_impl.dart:473:7)
#28     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#29     _AsyncAwaitCompleter.complete (dart:async/runtime/lib/async_patch.dart:28:18)
#30     _completeOnAsyncReturn (dart:async/runtime/lib/async_patch.dart:294:13)
#31     AggregatedReporter.onScenarioStarted.<anonymous closure> (package:flutter_gherkin/src/reporters/aggregated_reporter.dart)
#32     _RootZone.runUnary (dart:async/zone.dart:1379:54)
#33     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#34     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#35     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#36     Future._complete (dart:async/future_impl.dart:473:7)
#37     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#38     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/lib/async_patch.dart:33:20)
#39     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#40     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#41     _runPendingImmediateCallback (dart:isolate/runtime/lib/isolate_patch.dart:115:13)
#42     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:172:5)

I am guessing I might have missed some configuration while setting up the feature and steps.dart files, but would like to know how to fix this error. My folder structure in project is as below:

Screen Shot 2019-04-11 at 5 30 21 PM

Also, I am curious to know if there's a way to generate step definition file from the cucumber steps itself, like there is a provision in Espresso framework. That would be really handy. Example in case:

Screen Shot 2019-04-11 at 5 36 56 PM

And lastly, if I want to add another step in feature file, how do I write method for that step ? I am basically trying to see if I can achieve something similar to Espresso test framework, wherein, the stepdef is automatically generated for each step and we just write the code to handle the condition.

An example pertaining to my demo app would be really helpful for me to get started.

Build flavor on iOS not working

Hi,

When running a simple integration test(without gherkin) with flutter driver --flavor=development --target=test_driver/app.dart, it works on android and iOS emulators.

I'm trying to integrate Gherkin, and I've set the FlutterTestConfiguration.buildFlavor to development. It works fine on Android, but fails on iOS.

Stacktrace:
DriverError: Failed to fulfill GetHealth due to remote error
Original error: JSON-RPC error -32601 (method not found): Method not found
Original stack trace:
package:json_rpc_2/src/client.dart 110:64 Client.sendRequest
package:json_rpc_2/src/peer.dart 79:15 Peer.sendRequest
package:vm_service_client/src/scope.dart 64:23 Scope.sendRequestRaw
package:vm_service_client/src/isolate.dart 361:19 VMIsolateRef.invokeExtension
package:flutter_driver/src/driver/driver.dart 438:62 FlutterDriver._sendCommand
package:flutter_driver/src/driver/driver.dart 472:34 FlutterDriver.checkHealth
package:flutter_driver/src/driver/driver.dart 361:29 FlutterDriver.connect.checkHealth
package:flutter_driver/src/driver/driver.dart 376:44 FlutterDriver.connect
===== asynchronous gap ===========================
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 118:34 FlutterTestConfiguration._attemptDriverConnection
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 75:18 FlutterTestConfiguration.createFlutterDriver
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 81:26 FlutterTestConfiguration.createFlutterWorld
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 95:20 FlutterTestConfiguration.prepare.
package:gherkin/src/feature_file_runner.dart 159:31 FeatureFileRunner._runScenario
===== asynchronous gap ===========================
package:gherkin/src/feature_file_runner.dart 118:30 FeatureFileRunner._runScenarioInZone.
dart:async/zone.dart 1126:13 _rootRun
dart:async/zone.dart 1023:19 _CustomZone.run
dart:async/zone.dart 1518:10 _runZoned
dart:async/zone.dart 1502:12 runZoned
package:gherkin/src/feature_file_runner.dart 116:5 FeatureFileRunner._runScenarioInZone
package:gherkin/src/feature_file_runner.dart 63:21 FeatureFileRunner._runFeature
===== asynchronous gap ===========================
package:gherkin/src/feature_file_runner.dart 36:38 FeatureFileRunner.run
package:gherkin/src/test_runner.dart 77:45 GherkinRunner.execute
===== asynchronous gap ===========================
test_driver/main_tests/test_config.dart 34:28 TestConfig.execute
test_driver/main_tests/app_dev_test.dart 7:21 main
dart:isolate-patch/isolate_patch.dart 307:19 _startIsolate.
dart:isolate-patch/isolate_patch.dart 174:12 _RawReceivePortImpl._handleMessage

Unhandled exception:
Bad state: No element
#0 List.last (dart:core-patch/growable_array.dart:227:5)
#1 JsonFeature.currentScenario (package:gherkin/src/reporters/json/json_feature.dart:33:22)
#2 JsonReporter.onException (package:gherkin/src/reporters/json/json_reporter.dart:40:10)
#3 AggregatedReporter.onException. (package:gherkin/src/reporters/aggregated_reporter.dart:58:30)
#4 AggregatedReporter._invokeReporters (package:gherkin/src/reporters/aggregated_reporter.dart:70:21)

#5 AggregatedReporter.onException (package:gherkin/src/reporters/aggregated_reporter.dart:57:11)
#6 FeatureFileRunner._runScenarioInZone. (package:gherkin/src/feature_file_runner.dart:131:23)
#7 _rootRunBinary (dart:async/zone.dart:1150:13)
#8 _RootZone.runBinary (dart:async/zone.dart:1387:12)
#9 runZoned. (dart:async/zone.dart:1481:21)
#10 _CustomZone.handleUncaughtError (dart:async/zone.dart:1005:19)
#11 Future._propagateToListeners (dart:async/future_impl.dart:596:16)
#12 Future._completeError (dart:async/future_impl.dart:532:5)
#13 Future.timeout. (dart:async/future_impl.dart:783:16)
#14 _rootRunBinary (dart:async/zone.dart:1146:38)
#15 _CustomZone.runBinary (dart:async/zone.dart:1039:19)
#16 _FutureListener.handleError (dart:async/future_impl.dart:153:20)
#17 Future._propagateToListeners.handleError (dart:async/future_impl.dart:692:47)
#18 Future._propagateToListeners (dart:async/future_impl.dart:713:24)
#19 Future._propagateToListeners (dart:async/future_impl.dart:607:9)
#20 Future._completeError (dart:async/future_impl.dart:532:5)
#21 _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:38:15)
#22 Scope.sendRequestRaw (package:vm_service_client/src/scope.dart)

#23 VMIsolateRef.invokeExtension (package:vm_service_client/src/isolate.dart:361:19)
#24 FlutterDriver._sendCommand (package:flutter_driver/src/driver/driver.dart:438:62)
#25 FlutterDriver.checkHealth (package:flutter_driver/src/driver/driver.dart:472:34)
#26 FlutterDriver.connect.checkHealth (package:flutter_driver/src/driver/driver.dart:361:29)
#27 FlutterDriver.connect (package:flutter_driver/src/driver/driver.dart:376:44)

#28 FlutterTestConfiguration._attemptDriverConnection (package:flutter_gherkin/src/flutter/flutter_test_configuration.dart:118:34)
#29 FlutterTestConfiguration.createFlutterDriver (package:flutter_gherkin/src/flutter/flutter_test_configuration.dart:75:18)
#30 FlutterTestConfiguration.createFlutterWorld (package:flutter_gherkin/src/flutter/flutter_test_configuration.dart:81:26)
#31 FlutterTestConfiguration.prepare. (package:flutter_gherkin/src/flutter/flutter_test_configuration.dart:95:20)
#32 FeatureFileRunner._runScenario (package:gherkin/src/feature_file_runner.dart:159:31)

#33 FeatureFileRunner._runScenarioInZone. (package:gherkin/src/feature_file_runner.dart:118:30)
#34 _rootRun (dart:async/zone.dart:1126:13)
#35 _CustomZone.run (dart:async/zone.dart:1023:19)
#36 _runZoned (dart:async/zone.dart:1518:10)
#37 runZoned (dart:async/zone.dart:1502:12)
#38 FeatureFileRunner._runScenarioInZone (package:gherkin/src/feature_file_runner.dart:116:5)
#39 FeatureFileRunner._runFeature (package:gherkin/src/feature_file_runner.dart:63:21)

#40 FeatureFileRunner.run (package:gherkin/src/feature_file_runner.dart:36:38)
#41 GherkinRunner.execute (package:gherkin/src/test_runner.dart:77:45)

#42 TestConfig.execute (file:///Users/app/test_driver/main_tests/test_config.dart:34:28)
#43 main (file:///Users/app/test_driver/main_tests/app_dev_test.dart:7:21)
#44 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307:19)
#45 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

Flutter doctor:
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-RO)
• Flutter version 1.12.13+hotfix.5
• Framework revision 27321ebbad (5 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• ANDROID_HOME = Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1

[✓] Connected device (1 available)
• iPhone 11 Pro Max • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

Example's README

Re: https://github.com/jonsamwell/flutter_gherkin/tree/master/example

Any chance this can be changed from the default generated README ("For help getting started with Flutter, view our online documentation.") and have something that shows the reader how to run the supplied example?

Also: would need a link and a H1 in the root README :)

Why? Some of us are allergic to tutorials, and can only grasp a 'new' technologies from tight and complete examples. You have that example, but the how-to-run-it info is missing.

Great work, by the way.

Version set in pubspec.yaml is not honored

Without any change of my code or pubspec.yaml I got errors from flutter analyze:

error • 'RuntimeHooks.onAfterScenarioWorldCreated' ('Future<void> Function(World, String)') isn't a valid override of 'Hook.onAfterScenarioWorldCreated' ('Future<void> Function(World, String, Iterable<Tag>)') • test_driver/gherkin_tests.dart:74:16 • invalid_override
...

I read in CHANGELOG.md, breaking change in version 1.1.7+6 is happened.

But when I try to set any version (1.1.6+4 p.e.) via pubspec.yaml which worked before breaking change, version 1.1.7 is still used.

I think to update CHANGELOG.md is not enough, one tag/release with new version must be created with every new version of software too...

How to correctly work with Given steps?

@jonsamwell question for you. I'm working on implementing steps for the following scenario for a feature in my app called "paperless shop":

  Scenario: User cannot use paperless shop without permissions
    Given that the User does not have permissions to paperless shop
    When the User views the menu options
    Then the User does not see paperless shop.

I'm new to gherkin and BDD so please provide me correction to my understanding if needed, but I'm struggling to find a way to fulfill the Given scenario displayed above. The intent here is that of a "set up" step. Given the following from the Gherkin language spec, I think it's an appropriate statement:

Given
Given steps are used to describe the initial context of the system - the scene of the scenario. It is typically something that happened in the past.

However, by the time my given step runs my application is already started and running and my opportunity to put the system in a specific state for the test is very limited. Owing to this, I think the example project suffers from the same dilemma I'm currently facing:

Example Given

class GivenIPickAColour extends Given1<Colour> {
  @override
  Future<void> executeStep(Colour input1) async {
    print("The picked colour was: '$input1'");
  }

  @override
  RegExp get pattern => RegExp(r"I pick the colour {colour}");
}

The step simply prints out and does nothing, but then again, how would this step influence the "initial context of the system" now that the system is already running?

A further evidence that I think we have something missing here is in the drawer.feature

Feature: Drawer

  Scenario: should open the drawer
    Given I open the drawer
    Given I close the drawer

The Gherkin spec also advises in the Given step: The purpose of Given steps is to put the system in a known state before the user (or external system) starts interacting with the system (in the When steps). Avoid talking about user interaction in Given’s. If you were creating use cases, Given’s would be your preconditions. the example of I open the drawer feels inappropriate for a Given step.

My initial thoughts on how to achieve this are similar to what I did to start my mock web server and provide my url to the running app via requestData and an await in the main method of my app. Since my step has access to the created driver, I could perhaps send data to the running app and have my app instrumented to wait for specific Given instructions.

This would certainly give me the opportunity to do something, but what can be done with such a primitive interface like requestData? If I'm limited to sending just a string, I could send a request to execute a pre-arranged command in the host app. To make this effective though, We'd need the ability to write code that runs on the device that can perform work on the test runner's behalf. It would do things like writing values to shared preferences and databases.

Today I'm going to try and prototype something along these lines. I'd like your feedback on these thoughts and ideas though.

Thanks!

Error after upgrading to Flutter 1.7

Hi,

I encountered an error after upgrading to Flutter 1.7:

file:///Users/abanv2/Documents/Flutter/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/gherkin-1.0.3/lib/src/gherkin/steps/step_definition_implementations.dart:35:16: Error: Found unsupported uses of 'TInput1' in supertype 'StepDefinitionBase'.
abstract class StepDefinition1<TWorld extends World, TInput1>

Here is what I have in my pubspec.yaml:
dev_dependencies:
flutter_test:
sdk: flutter

flutter_driver:
sdk: flutter
test: any
flutter_gherkin: ^1.0.4

Kindly advise. Thank you!


More info:

flutter doctor --verbose
[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.4 18E226, locale en-US)
• Flutter version 1.7.8+hotfix.3 at /Users/abanv2/Documents/Flutter/sdk/flutter
• Framework revision b712a172f9 (2 days ago), 2019-07-09 13:14:38 -0700
• Engine revision 54ad777fd2
• Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/abanv2/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/abanv2/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2, Build version 10E125
• CocoaPods version 1.6.1

[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4

[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 33.4.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 33.4.3
• Dart plugin version 191.6183.87

[✓] Connected device (1 available)
• SM A520F • 52105109ea678475 • android-arm64 • Android 8.0.0 (API 26) (emulator)

• No issues found!
Process finished with exit code 0

How to use in widget test

Hi, this is more of a question than an issue.

Which components do we look at if we want to use this plugin for widget testing? We plan to have a set of widget tests per feature and to have html reporting on our widget tests as well.

Thank you.

Change default flutter sdk path?

On my machine, I had 2 flutter versions, 1.9.1+hotfix.6 and latest stable 1.12.13+hotfix.8
and the default flutter command is binded to 1.9.1+hotfix.6

I already set the VSCode SDK to 1.12.13+hotfix.8 and there were no trouble for running other projects.
But when I tried to run with my other flutter version, it always run with my default flutter version.

Do you have any idea about this @jonsamwell ?

Unable to execute a test

Hey @jonsamwell,

I was trying to recreate an issue, but was unable to execute the test. I am getting below error:


file:///Users/deeptibelsare/Documents/Flutter-sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-0.0.12/lib/src/gherkin/steps/step_definition_implementations.dart:55:16: Error: Found unsupported uses of 'TInput3' in supertype 'StepDefinitionBase'.
abstract class StepDefinition3<TWorld extends World, TInput1, TInput2, TInput3>
               ^
file:///Users/deeptibelsare/Documents/Flutter-sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-0.0.12/lib/src/gherkin/steps/step_definition_implementations.dart:68:16: Error: Found unsupported uses of 'TInput1' in supertype 'StepDefinitionBase'.
abstract class StepDefinition4<TWorld extends World, TInput1, TInput2, TInput3,

I am revisiting this setup after a long time so not sure if anything has changed. I noticed that when I try to write GWT statements in .feature file, I am getting an error as unimplemented substep definition.

Feature: Login
  User should be able to login successfully after clicking login button.

Scenario: User logs in successfully
    Given I expect the user enters sign

If I comment out Feature section and only keep Scenario section then I don't get the error but the main error shown above remains.

steps.dart:

import 'package:flutter_driver/flutter_driver.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';


class AstroSignValidation extends GivenWithWorld<FlutterWorld> {
  @override
  Future<void> executeStep() async {
    await FlutterDriverUtils.getText(world.driver, find.text('Choose a sign'));
    await FlutterDriverUtils.tap(world.driver, find.byValueKey('sign_list')); // open drop down menu is ok
  //  await FlutterDriverUtils.tap(world.driver, find.byValueKey('sign_cancer_item')); // here test not passed
  }

  RegExp get pattern => RegExp(r"I expect the user enters sign");
}

app_test.dart:

import 'dart:async';
import 'package:glob/glob.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'steps/steps.dart';

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

I am on flutter_gherkin: ^0.0.12. After I upgraded to latest version of this plugin, I don't see GivenWithWorld class or other similar classes that I used earlier. Would like to know how do I use the new ones to run a simple test.

Appreciate your help on this and let me know if you need more details.

[Suggest] I can't getText in title app

Dear,

I am using getText for title app >> But it can't support for that:
Log
Exception: DriverError: Error in Flutter application: Uncaught extension error while executing get_text: Unsupported operation: Type MaterialApp is currently not supported by getText

Pls help me to support for that

Debugging the app with Android Studio

Hi,

I have seen from the documentation that you need to add a configuration for vscode to be able to debugging. There is also a similar configuration to do for Android Studio?

Specifically, I am able to debug all code that is inside the test_driver folder but not my app code (the one under the lib folder.

I have already set

..exitAfterTestRun = false; // set to false if debugging to exit cleanly

Change Locale using flutter drive

Hi All,

Can you please tell there is any property exists into gherkin framework to change locale of device.
If not , Can you please share code to change device language using flutter driver.

Regards
Garima

LogLevel not found

Hello thank you your for writing such an awesome framework!

I am having trouble with the flutter_driver_reporter using flutter_gherkin: 1.1.5

Right now it is throwing the errors:
flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.3/lib/src/flutter/reporters/flutter_driver_reporter.dart:46:45: Error: Getter not found: 'LogLevel'.
(log) => _isLevel(log.level, [LogLevel.critical, LogLevel.error]))

My flutter doctor output is:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.13.0, on Mac OS X 10.15.1 19B88, locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
[✓] VS Code (version 1.40.2)
[✓] Connected device (3 available)

Cannot verify text of RichText widget

Hi @jonsamwell , have a good day.
I tried to used our dependency to verify text of a RichText widget
This is how the RichText looks like

RichText(
    key: ValueKey("richtext"),
    text: TextSpan(
        text: 'main rich text ',
        style: DefaultTextStyle.of(context).style,
        children: <TextSpan>[
            TextSpan(
                 style: TextStyle(fontSize: 18, color: Colors.red),
                 text: 'Text span 1 '
            ),
            TextSpan(
                 style: TextStyle(fontSize: 15, color: Colors.blue),
                 text: 'Text span 2'
             )
         ]
    )
)

This is feature step ( I just use the format of predefined step)
Then I expect the "richtext" to be "main rich text Text span 1 Text span 2"

This is the output

Exception: DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'RichText' is not a subtype of type 'Text'
#0      FlutterDriverExtension._getText (package:flutter_driver/src/extension/extension.dart:537:16)
<asynchronous suspension>
#1      FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:204:53)
#2      BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:518:32)
<asynchronous suspension>
#3      _runExtension (dart:developer-patch/developer.dart:86:23)

Original error: null
Original stack trace:
null

#0      FlutterDriver._sendCommand (package:flutter_driver/src/driver/driver.dart:456:7)
<asynchronous suspension>
#1      FlutterDriver.getText (package:flutter_driver/src/driver/driver.dart:713:41)
#2      FlutterDriverUtils.getText (package:flutter_gherkin/src/flutter/utils/driver_utils.dart:46:31)
<asynchronous suspension>
#3      ThenExpectElementToHaveValue.executeStep (package:flutter_gherkin/src/flutter/steps/then_expect_element_to_have_value_step.dart:24:45)
#4      StepDefinition2.onRun (package:gherkin/src/gherkin/steps/step_definition_implementations.dart:52:13)
#5      StepDefinitionGeneric.run.<anonymous closure> (package:gherkin/src/gherkin/steps/step_definition.dart:35:30)
#6      Perf.measure (package:gherkin/src/utils/perf.dart:11:26)
#7      StepDefinitionGeneric.run (package:gherkin/src/gherkin/steps/step_definition.dart:31:18)
#8      FeatureFileRunner._runStep.<anonymous closure> (package:gherkin/src/feature_file_runner.dart:210:16)
#9      FeatureFileRunner._runWithinTest (package:gherkin/src/feature_file_runner.dart:228:32)
#10     FeatureFileRunner._runStep (package:gherkin/src/feature_file_runner.dart:207:22)
<asynchronous suspension>
#11     FeatureFileRunner._runScenario (package:gherkin/src/feature_file_runner.dart:164:17)
<asynchronous suspension>
#12     FeatureFileRunner._runFeature (package:gherkin/src/feature_file_runner.dart:62:21)
<asynchronous suspension>
#13     FeatureFileRunner.run (package:gherkin/src/feature_file_runner.dart:35:38)
#14     GherkinRunner.execute (package:gherkin/src/test_runner.dart:77:45)
<asynchronous suspension>
#15     main (file:///Users/long.tranhoang/FlutterAppTest/FlutterApp/test_driver/app_test.dart:15:26)
#16     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

I think the point is Uncaught extension error while executing get_text: type 'RichText' is not a subtype of type 'Text'. Why does this happen ? Do we have any solution for this ?
Thanks in advanced.

Hook error

I tried updating gherkin to :

flutter_gherkin: 1.1.8-rc.1

but keep getting:
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.8-rc.1/lib/src/flutter/hooks/app_runner_hook.dart:51:16: Error: The method 'FlutterAppRunnerHook.onAfterScenarioWorldCreated' has fewer positional arguments than those of overridden method 'Hook.onAfterScenarioWorldCreated'. Future<void> onAfterScenarioWorldCreated(

Run test on device/emulator/simulator

Hi,
we are extending our functionality to support flutter and our cucumber-based integration tests are planned also to move.
Unfortunately the example which is located in directory 'test_driver' is not able to run on device and seems that it can't do it as well as dart_gherkin can't.
Is there plans to move in this direction?

Unable to debug on VS Code

I am getting the following exception when trying to debug my tests:

E/flutter (25735): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Directory listing failed, path = './test_driver/features/' (OS Error: No such file or directory, errno = 2)

Here's my test configuration.

Future<void> main(List<String> arguments) {  
//by default run all features unless specified by arguments.
  var features = [Glob("test_driver/features/**.feature")];
  if(arguments != null && arguments.length > 0) {
    var parser = ArgParser();
    parser.addOption('feature');
    var results = parser.parse(arguments);
    features = [Glob("test_driver/features/" + results["feature"])];
  }
  
  final config = FlutterTestConfiguration()
    ..features = features
    ..reporters = [
      ProgressReporter(),
      TestRunSummaryReporter(),
      JsonReporter(path: './report.json')
    ] // you can include the "StdoutReporter()" without the message level parameter for verbose log information
//    ..hooks = [HookExample()]
    ..stepDefinitions = [
      //my steps here
    ]
//    ..customStepParameterDefinitions = [ColourParameter()]
    ..restartAppBetweenScenarios = true
    ..targetAppPath = "test_driver/app.dart"
    // ..tagExpression = "@smoke" // uncomment to see an example of running scenarios based on tag expressions
    ..exitAfterTestRun = false; // set to false if debugging to exit cleanly
  return GherkinRunner().execute(config);
}

The tests run fine when I run without debugging with this command:
dart test_driver\app_test.dart

Also, here's my vs code launch.json config.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug"
        },
        {
            "name": "Debug Features Tests",
            "request": "launch",
            "type": "dart",
            "program": "test_driver/app_test.dart",
            "flutterMode": "debug",
        }
    ]
}

It appears that the configuration isn't working well when debugging and might be looking for feature files in my device/emulator and not in my development machine.

Can't run codemagic CI for flutter_gherkin:1.1.8...

Dear,

Today, I run codemagic CI but that is not success. I got an issue for version 1.1.8 of flutter_gherkin

Pls, see the log for more details:

iPhone 11 Pro Max • 3542DBEA-36D3-47E9-A374-64798E37294B • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

== /usr/local/bin/flutter drive --target=test_driver/bdd.dart ==
Using device iPhone 11 Pro Max.
Starting application: test_driver/bdd.dart
Removing obsolete reference to flutter_assets from Runner.app
Running pod install... 10.3s
Running Xcode build...
Xcode build done. 89.1s
flutter: Observatory listening on http://127.0.0.1:49506/AaYjVz3pWhs=/
../programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.8-rc.1/lib/src/flutter/reporters/flutter_driver_reporter.dart:28:5: Error: The setter 'driverLog' isn't defined for the class 'FlutterDriverReporter'.

  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.8-rc.1/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing setter, or defining a setter or field named 'driverLog'.
    driverLog = _driverLogMessageHandler;
    ^^^^^^^^^
    ../programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.8-rc.1/lib/src/flutter/reporters/flutter_driver_reporter.dart:32:5: Error: The setter 'driverLog' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.8-rc.1/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing setter, or defining a setter or field named 'driverLog'.
    driverLog = null;
    ^^^^^^^^^
    Stopping application instance.
    Driver tests failed: 254

Running Gherkin code within a Step definition

Is there a way to run Gherkin code within a step definition?

For example:

class GivenOnboardingScreenStep extends GivenWithWorld<FlutterWorld> 
{
  @override
  Future<void> executeStep() async
  {
      run("
      Given I am on Login screen
      Then entered valid credentials
      And pressed login button
      ");
  }

  @override
  RegExp get pattern => RegExp(r"I am on Onboarding screen");
}

With Calabash it was possible to run steps within a step definition. I found that a very useful feature when writing pre-conditions. It cut down quite much on the number of repeating steps.

For example lets say we have the following interface:
Welcome screen -> Login screen -> Onboarding screen.

To open the onboarding screen right now, I have to do something like this.

Feature: Onboarding

Scenario: Skip onboarding
  Given I am on Welcome screen
  And pressed login button
  And I entered valid credentials
  And pressed login button
  When I press skip button
  Then I should see Main screen

I could put that in the background for the feature. But it does not solve the issue that I might need to repeat myself with multiple features within the same screen.

But if I were able to run Gherkin code within a step definition I can do a setup like this:

Feature: Onboarding

Scenario: Skip onboarding
  Given I am on Onboarding screen
  When I press skip button
  Then I should see Main screen
class GivenOnboardingScreenStep extends GivenWithWorld<FlutterWorld> 
{
  @override
  Future<void> executeStep() async
  {
      run("
      Given I am on Login screen
      Then entered valid credentials
      And pressed login button
      ");
  }

  @override
  RegExp get pattern => RegExp(r"I am on Onboarding screen");
}

class GivenLoginScreenStep extends GivenWithWorld<FlutterWorld> 
{
  @override
  Future<void> executeStep() async
  {
      run("
      Given I am on Welcome screen
      Then pressed login button
      ");
  }

  @override
  RegExp get pattern => RegExp(r"I am on Login screen");
}

class GivenWelcomeScreenStep extends GivenWithWorld<FlutterWorld> 
{
  @override
  Future<void> executeStep() async
  {
      final locator = find.byValueKey("welcome message");
      await world.driver.isPresent(locator);
  }

  @override
  RegExp get pattern => RegExp(r"I am on Welcome screen");
}

Now I can now easily reuse these steps defintions. It's also very easy to add new "Given I am on x screen" step definitions, as they can reference existing step definitions.

Maybe there is a better way of doing what I am trying to accomplish?

Cannot run example

Hi, I cannot run example from this repo. Could you take a look at my error log?
I'm using VSCode with launch.json from this repo, no modifications were made

flutter doctor -v output:

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale en-ID)
    • Flutter version 1.5.4-hotfix.2 at /Users/iqbal/dev/flutter
    • Framework revision 7a4c33425d (2 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/iqbal/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/iqbal/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 34.0.2
    • Dart plugin version 183.5901
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.33.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.0.0

[✓] Connected device (1 available)
    • iPhone 6s • D1418693-3CA8-4E54-9D5A-C1E4AE6D893F • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

Error log:

Shell: Starting Flutter app under test 'test_driver/app.dart', this might take a few moments
Shell: �[33;31mFlutter run error: Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is currently executing will be used instead.
Shell:   running Flutter tool: /Users/iqbal/dev/flutter_stable_dev
Shell:   previous reference  : /Users/iqbal/dev/flutter
Shell: This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path).
Shell: �[33;0m
Shell: �[33;31mFlutter run error:
Shell: �[33;0m
before run hook
running hook before scenario 'Counter increases when the button is pressed'
Shell: [info ] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:64551/
Shell: [trace] FlutterDriver: Isolate found with number: 482971998
Shell: [trace] FlutterDriver: Isolate is not paused. Assuming application is ready.
Failed to load "/Users/iqbal/Documents/cobacoba/flutter_gherkin/example/test_driver/app_test.dart": JSON-RPC error -32601 (method not found): Method not found
package:json_rpc_2/src/client.dart 110:64                                                          Client.sendRequest
package:json_rpc_2/src/peer.dart 68:15                                                             Peer.sendRequest
package:vm_service_client/src/scope.dart 64:23                                                     Scope.sendRequestRaw
===== asynchronous gap ===========================
package:vm_service_client/src/isolate.dart 361:19                                                  VMIsolateRef.invokeExtension
package:flutter_driver/src/driver/driver.dart 413:63                                               FlutterDriver._sendCommand
===== asynchronous gap ===========================
package:flutter_driver/src/driver/driver.dart 447:34                                               FlutterDriver.checkHealth
===== asynchronous gap ===========================
package:flutter_driver/src/driver/driver.dart 365:29                                               FlutterDriver.connect.checkHealth
===== asynchronous gap ===========================
package:flutter_driver/src/driver/driver.dart 380:44                                               FlutterDriver.connect
===== asynchronous gap ===========================
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 30:40                          FlutterTestConfiguration.createFlutterDriver
===== asynchronous gap ===========================
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 40:26                          FlutterTestConfiguration.createFlutterWorld
===== asynchronous gap ===========================
package:flutter_gherkin/src/flutter/flutter_test_configuration.dart 54:20                          FlutterTestConfiguration.prepare.<fn>
===== asynchronous gap ===========================
package:gherkin/src/feature_file_runner.dart 86:29                                                 FeatureFileRunner._runScenario
===== asynchronous gap ===========================
package:gherkin/src/feature_file_runner.dart 48:21                                                 FeatureFileRunner._runFeature
===== asynchronous gap ===========================
package:gherkin/src/feature_file_runner.dart 32:38                                                 FeatureFileRunner.run
===== asynchronous gap ===========================
package:gherkin/src/test_runner.dart 73:45                                                         GherkinRunner.execute
===== asynchronous gap ===========================
test_driver/app_test.dart 25:26                                                                    main
===== asynchronous gap ===========================
package:test_api                                                                                   RemoteListener.start
/var/folders/12/zj3ddh45479b3jhmmfm4j97r0000gn/T/flutter_test_listener.ZeKRcm/listener.dart 16:25  serializeSuite
/var/folders/12/zj3ddh45479b3jhmmfm4j97r0000gn/T/flutter_test_listener.ZeKRcm/listener.dart 42:27  main
✖ loading /Users/iqbal/Documents/cobacoba/flutter_gherkin/example/test_driver/app_test.dart
Exited (1)

Restart App method needed

Hello,
In our app, we need to verify particular behavior remains after the app is restarted.
For example:
Scenario: verify that user stays logged in after restart
Given: I'm on login page
When: I login with "user1" credentials
Then: I'm on home page as "user1"
When: I restart the app
Then: I'm on home page as "user1"

Current implementation of restarts constraints the restart of application to only be available by separating the steps into different, sequential scenarios, so the above example would be:

Scenario: verify that user stays logged in after restart part1
Given: I'm on login page
When: I login with "user1" credentials
Then: I'm on home page as "user1"

Scenario: verify that user stays logged in after restart part2
Then: I'm on home page as "user1"

Which does not make much sense to me, as it is one scenario by design.

I've investigated how I can change that - and it's by getting access to the _restartApp() method in the app_runner_hook.dart hook. By calling it, I will be able to painlessly restart the app, just like it does in between scenarios.
But I think that it would be more convenient to have a native support from flutter_gherkin project for that and have a separate method for that in, for example, FlutterDriverUtils class.

Please let me know what you think about that.
Thanks

adding flutter_gerkin to some projects seems to cause packages get to break

I've been working on a Flutter project and trying to get cucumber testing added using flutter_gherkin.
The problem is when I add it to the pubspec file and run Packages get, dart starts eating up never ending amounts of Ram and never seems to complete.
It's been running for well over two hours now and has risen to over 5 GB of ram used.

My pubspec looks like this;
dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 json_annotation: qr_flutter: 2.0.0+51 qr_reader: ^0.1.3 font_awesome_flutter: intl: http: shared_preferences: 0.4.3 flutter_local_notifications: ^0.5.2 flutter_gherkin:

The output from flutter doctor is;
`Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Version 10.0.18362.418], locale en-NZ)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.5)
[!] IntelliJ IDEA Community Edition (version 2019.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code, 64-bit edition (version 1.38.1)
[√] Connected device (1 available)

! Doctor found issues in 2 categories.
`

Could this be a corrupted packages cache issue and is there some way to clear it out?
Any other suggestions would be appreciated.

It can't verify title page or content alert

Hello,

Today, I write a scenario to automation testing
homePage.feature:
Feature: AddFeature
Test add features
Scenario Outline: Verify clicking on "add" button
And I click the add button
Then I verify alert displays "<verifyAlertDisplay "
Examples:
| verifyAlertDisplay |
| Welcome to ExecuteAutomation 0 |

homePage�Steps.dart

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

@OverRide
Future executeStep(String value) async {
HomePage homePage = HomePage(world.driver);
expectMatch(await homePage.getAlertContent(), value);
}

@OverRide
RegExp get pattern => RegExp(r"I verify alert display {string}");
}

I run the command : flutter drive --target=test_driver/bdd.dart

I only passed run step "I click the add button"

Log:

Hieus-Mac-mini:flutter hieu$ flutter drive --target=test_driver/bdd.dart
Using device Samsung Galaxy S10.
Starting application: test_driver/bdd.dart
Installing build/app/outputs/apk/app.apk... 6.6s
[!] Your app isn't using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 10.7s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
I/flutter ( 8087): Observatory listening on http://127.0.0.1:44287/SJCofh5hQRU=/
Starting Flutter app under test 'test_driver/bdd.dart', this might take a few moments
I/flutter ( 8151): Observatory listening on http://127.0.0.1:34320/sCu7p7Fz0Cg=/
before run hook
VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:63534/sCu7p7Fz0Cg=/
VMServiceFlutterDriver: Isolate found with number: 400653289989467
VMServiceFlutterDriver: Isolate is not paused. Assuming application is ready.
VMServiceFlutterDriver: Connected to Flutter application.
running hook before scenario 'Verify clicking on "add" button (Example 1)'
Running scenario: Verify clicking on "add" button (Example 1) # ./test_driver/features/homePage.feature:10
√ And I click the add button # ./test_driver/features/homePage.feature:11 took 1464ms
GherkinStepNotDefinedException: Step definition not found for text:

    'Then I verify alert displays "Welcome to ExecuteAutomation 0"'

  File path: ./test_driver/features/homePage.feature#12
  Line:      Then I verify alert displays "Welcome to ExecuteAutomation 0"

  ---------------------------------------------

  You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:

  /// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
  /// All classes can take up to 5 input parameters anymore and you should probably us a table
  /// For example: `When4<String, bool, int, num>`
  /// You can also specify the type of world context you want
  /// `When4WithWorld<String, bool, int, num, MyWorld>`
  class Given_Then_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
    @override
    RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");

    @override
    Future<void> executeStep(String input1) async {
      // If the step is "Given I do a 'windy pop'"
      // in this example input1 would equal 'windy pop'

      // your code...
    }
  }

GherkinStepNotDefinedException: Step definition not found for text:

    'Then I verify alert displays "Welcome to ExecuteAutomation 0"'

  File path: ./test_driver/features/homePage.feature#12
  Line:      Then I verify alert displays "Welcome to ExecuteAutomation 0"

  ---------------------------------------------

  You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:

  /// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
  /// All classes can take up to 5 input parameters anymore and you should probably us a table
  /// For example: `When4<String, bool, int, num>`
  /// You can also specify the type of world context you want
  /// `When4WithWorld<String, bool, int, num, MyWorld>`
  class Given_Then_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
    @override
    RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");

    @override
    Future<void> executeStep(String input1) async {
      // If the step is "Given I do a 'windy pop'"
      // in this example input1 would equal 'windy pop'

      // your code...
    }
  }

PASSED: Scenario Verify clicking on "add" button (Example 1) # ./test_driver/features/homePage.feature:10
Restarting Flutter app under test
E/flutter ( 8151): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Exception: operation failed
E/flutter ( 8151): #0 ShaderWarmUp.execute (package:flutter/src/painting/shader_warm_up.dart:92:5)
E/flutter ( 8151):
E/flutter ( 8151): #1 PaintingBinding.initInstances (package:flutter/src/painting/binding.dart:25:20)
E/flutter ( 8151): #2 SemanticsBinding.initInstances (package:flutter/src/semantics/binding.dart:22:11)
E/flutter ( 8151): #3 RendererBinding.initInstances (package:flutter/src/rendering/binding.dart:29:11)
E/flutter ( 8151): #4 WidgetsBinding.initInstances (package:flutter/src/widgets/binding.dart:255:11)
E/flutter ( 8151): #5 new BindingBase (package:flutter/src/foundation/binding.dart:57:5)
E/flutter ( 8151): #6 new __DriverBinding&BindingBase&ServicesBinding (package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #7 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding (package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #8 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding (package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #9 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding (package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #10 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding
(package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #11 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding&RendererBinding
(package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #12 new __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding
(package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #13 new _DriverBinding (package:flutter_driver/src/extension/extension.dart)
E/flutter ( 8151): #14 enableFlutterDriverExtension (package:flutter_driver/src/extension/extension.dart:91:3)
E/flutter ( 8151): #15 main (file:///Users/hieu/Desktop/flutter_auto/flutter/test_driver/bdd.dart:6:3)
E/flutter ( 8151): #16 _runMainZoned.. (dart:ui/hooks.dart:240:25)
E/flutter ( 8151): #17 _rootRun (dart:async/zone.dart:1126:13)
E/flutter ( 8151): #18 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 8151): #19 _runZoned (dart:async/zone.dart:1518:10)
E/flutter ( 8151): #20 runZoned (dart:async/zone.dart:1502:12)
E/flutter ( 8151): #21 _runMainZoned. (dart:ui/hooks.dart:232:5)
E/flutter ( 8151): #22 _startIsolate. (dart:isolate-patch/isolate_patch.dart:301:19)
E/flutter ( 8151): #23 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter ( 8151):
running hook after scenario 'Verify clicking on "add" button (Example 1)'
GherkinStepNotDefinedException: Step definition not found for text:

    'Then I verify alert displays "Welcome to ExecuteAutomation 0"'

  File path: ./test_driver/features/homePage.feature#12
  Line:      Then I verify alert displays "Welcome to ExecuteAutomation 0"

  ---------------------------------------------

  You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:

  /// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
  /// All classes can take up to 5 input parameters anymore and you should probably us a table
  /// For example: `When4<String, bool, int, num>`
  /// You can also specify the type of world context you want
  /// `When4WithWorld<String, bool, int, num, MyWorld>`
  class Given_Then_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
    @override
    RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");

    @override
    Future<void> executeStep(String input1) async {
      // If the step is "Given I do a 'windy pop'"
      // in this example input1 would equal 'windy pop'

      // your code...
    }
  }

GherkinStepNotDefinedException: Step definition not found for text:

    'Then I verify alert displays "Welcome to ExecuteAutomation 0"'

  File path: ./test_driver/features/homePage.feature#12
  Line:      Then I verify alert displays "Welcome to ExecuteAutomation 0"

  ---------------------------------------------

  You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:

  /// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
  /// All classes can take up to 5 input parameters anymore and you should probably us a table
  /// For example: `When4<String, bool, int, num>`
  /// You can also specify the type of world context you want
  /// `When4WithWorld<String, bool, int, num, MyWorld>`
  class Given_Then_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
    @override
    RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");

    @override
    Future<void> executeStep(String input1) async {
      // If the step is "Given I do a 'windy pop'"
      // in this example input1 would equal 'windy pop'

      // your code...
    }
  }

1 scenario (1 passed)
1 step (1 passed)
0:00:06.832000
Unhandled exception:
GherkinStepNotDefinedException: Step definition not found for text:

    'Then I verify alert displays "Welcome to ExecuteAutomation 0"'

  File path: ./test_driver/features/homePage.feature#12
  Line:      Then I verify alert displays "Welcome to ExecuteAutomation 0"

  ---------------------------------------------

  You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:

  /// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
  /// All classes can take up to 5 input parameters anymore and you should probably us a table
  /// For example: `When4<String, bool, int, num>`
  /// You can also specify the type of world context you want
  /// `When4WithWorld<String, bool, int, num, MyWorld>`
  class Given_Then_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
    @override
    RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");

    @override
    Future<void> executeStep(String input1) async {
      // If the step is "Given I do a 'windy pop'"
      // in this example input1 would equal 'windy pop'

      // your code...
    }
  }

#0 FeatureFileRunner._matchStepToExectuableStep (package:gherkin/src/feature_file_runner.dart:337:7)
#1 FeatureFileRunner._runStep (package:gherkin/src/feature_file_runner.dart:258:20)
#2 _rootRunUnary (dart:async/zone.dart:1134:38)
#3 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#4 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#6 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#7 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#8 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#9 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#10 AggregatedReporter.onStepStarted (package:gherkin/src/reporters/aggregated_reporter.dart)
#11 _rootRunUnary (dart:async/zone.dart:1134:38)
#12 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#13 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#14 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#15 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#16 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#17 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#18 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#19 AggregatedReporter._invokeReporters (package:gherkin/src/reporters/aggregated_reporter.dart)
#20 _rootRunUnary (dart:async/zone.dart:1134:38)
#21 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#22 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#23 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#24 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#25 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#26 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#27 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#28 AggregatedReporter.onStepStarted. (package:gherkin/src/reporters/aggregated_reporter.dart)
#29 _rootRunUnary (dart:async/zone.dart:1134:38)
#30 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#31 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#32 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#33 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#34 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#35 Future._asyncComplete. (dart:async/future_impl.dart:556:7)
#36 _rootRun (dart:async/zone.dart:1126:13)
#37 _CustomZone.run (dart:async/zone.dart:1023:19)
#38 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#39 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
#40 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#41 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#42 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#43 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
Stopping application instance.
Driver tests failed: 255

Add robust example for creating custom world

First, this lib is fantastic. Thank you.

I'm trying to add a custom FlutterWorld to the config that would allow state (such as credentials) to persist. I'm struggling to do so.

Also, I'd be happy to add a robust example if you can give me a short explanation here. I'm using this for a project at work, and I'll happily turn it into a big example / use it to expand some docs.

edit 2: kind of figured it out. I was trying to use createFlutterWorld rather than createWorld. I see now how that works. I'm closing this.

Uninstalling app in between scenario?

Hi @jonsamwell ,
In my test scenarios I need to make sure that my app's state is always clean in between the scenarios. So, I tried few hooks in between scenarios like uninstalling app or cleaning app data in between scenario, then after that restarting the app; all done with adb commands.

However, when I do this, the test driver cannot connect with the app after it is restarted back again and gets stuck at:
[warning] FlutterDriver: It is taking an unusually long time to connect to the VM...

Is there a way to achieve what I am trying to do?

Executing Some Given Steps before app launches.

Right now the way app is initialised is by means of hook that is executed before any step executes.
Will it be possible to launch the app as one of step itself like
Given I open my app
This would help for doing some steps that might be preparatory for scenario like data setup etc and would look more Gherkinish
e.g.
Given User with name "abc" exists (This step can ingest data or mock data before even app is launched)
When I Open App
I see user "abc" in members section
......

Errors when launching Flutter Gherkin tests

This is likely an issue with Flutter Driver but I wanted to throw it out there in case you had seen similar problems.

We are experiencing random failures running Flutter Gherkin tests with the following stack trace.

We are seeing 2 specific errors occurring randomly. One run will error out, then a another run will work. Have you seen something similar?

dart test_driver/app_test.dart

Starting Flutter app under test 'test_driver/app.dart', this might take a few moments
Unhandled exception:
TimeoutException after 0:01:30.000000: Timeout while waiting for observatory debugger uri
#0      FlutterRunProcessHandler.waitForObservatoryDebuggerUri (package:flutter_gherkin/src/flutter/flutter_run_process_handler.dart:120:29)
<asynchronous suspension>
#1      FlutterAppRunnerHook._runApp (package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart:66:41)
<asynchronous suspension>
#2      FlutterAppRunnerHook.onBeforeRun (package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart:19:11)
<asynchronous suspension>
#3      AggregatedHook.onBeforeRun.<anonymous closure> (package:gherkin/src/hooks/aggregated_hook.dart:15:35)
#4      AggregatedHook._invokeHooks (package:gherkin/src/hooks/aggregated_hook.dart:52:21)
<asynchronous suspension>
#5      AggregatedHook.onBeforeRun (package:gherkin/src/hooks/aggregated_hook.dart:15:13)
<asynchronous suspension>
#6      GherkinRunner.execute (package:gherkin/src/test_runner.dart:70:19)
<asynchronous suspension>
#7      main (file:///Users/distiller/project/test_driver/app_test.dart:34:26)
#8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
Exited with code 255

Then a second error we also are seeing is...

dart test_driver/app_test.dart

Starting Flutter app under test 'test_driver/app.dart', this might take a few moments
Running Integration Tests
Running Scenerio - 'Test user can successfully login'
[info ] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:49363/91wD5HhROrE=/
[trace] FlutterDriver: Isolate found with number: 474622607
[trace] FlutterDriver: Isolate is not paused. Assuming application is ready.
[info ] FlutterDriver: Connected to Flutter application.
Running scenario: Test user can successfully login # ./test_driver/features/login.feature:5
   × Given I expect the user enters email # ./test_driver/features/login.feature:6 took 10016ms  
TimeoutException after 0:00:10.000000: Future not completed
#0      StepDefinitionGeneric.run.<anonymous closure> (package:gherkin/src/gherkin/steps/step_definition.dart:35:24)
<asynchronous suspension>
#1      Perf.measure (package:gherkin/src/utils/perf.dart:9:26)
<asynchronous suspension>
#2      StepDefinitionGeneric.run (package:gherkin/src/gherkin/steps/step_definition.dart:31:18)
<asynchronous suspension>
#3      FeatureFileRunner._runStep.<anonymous closure> (package:gherkin/src/feature_file_runner.dart:200:16)
<asynchronous suspension>
#4      FeatureFileRunner._runWithinTest (package:gherkin/src/feature_file_runner.dart:218:32)
<asynchronous suspension>
#5      FeatureFileRunner._runStep (package:gherkin/src/feature_file_runner.dart:197:22)
<asynchronous suspension>
#6      FeatureFileRunner._runScenario (package:gherkin/src/feature_file_runner.dart:154:17)
<asynchronous suspension>
#7      FeatureFileRunner._runFeature (package:gherkin/src/feature_file_runner.dart:62:21)
<asynchronous suspension>
#8      FeatureFileRunner.run (package:gherkin/src/feature_file_runner.dart:35:38)
<asynchronous suspension>
#9      GherkinRunner.execute (package:gherkin/src/test_runner.dart:77:45)
<asynchronous suspension>
#10     main (file:///Users/distiller/project/test_driver/app_test.dart:34:26)
#11     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
FAILED: Scenario Test user can successfully login # ./test_driver/features/login.feature:5
Restarting Flutter app under test
Unhandled exception:
Bad state: The client closed with pending request "ext.flutter.driver".
#0      new Client.withoutJson.<anonymous closure> (package:json_rpc_2/src/client.dart:70:24)
#1      _RootZone.run (dart:async/zone.dart:1374:54)
#2      _FutureListener.handleWhenComplete (dart:async/future_impl.dart:150:18)
#3      Future._propagateToListeners.handleWhenCompleteCallback (dart:async/future_impl.dart:609:39)
#4      Future._propagateToListeners (dart:async/future_impl.dart:665:37)
#5      Future._propagateToListeners (dart:async/future_impl.dart:566:9)
#6      Future._completeWithValue (dart:async/future_impl.dart:483:5)
#7      Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:513:7)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#10     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:391:30)
#11     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
Exited with code 255

Have you seen either of these happen?

Error: Type 'LogLevel' not found

Hello,

I run install flutter_gherkin: ^1.1.7+5 in pubspec.yaml file
with the command on MAC : flutter drive --target=test_driver/bdd.dart

I got an error:
✓ Built build/app/outputs/apk/debug/app-debug.apk.
I/flutter ( 3730): Observatory listening on http://127.0.0.1:43529/wrXAD3eclvE=/
../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:58:17: Error: Type 'LogLevel' not found.
bool _isLevel(LogLevel level, Iterable levels) =>
^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:58:42: Error: Type 'LogLevel' not found.
bool _isLevel(LogLevel level, Iterable levels) =>
^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:28:25: Error: The getter 'flutterDriverLog' isn't defined for the class 'FlutterDriverReporter'.

  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flutterDriverLog'.
    subscriptions.add(flutterDriverLog
    ^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:29:48: Error: The getter 'LogLevel' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'LogLevel'.
    .where((log) => _isLevel(log.level, [LogLevel.info, LogLevel.trace]))
    ^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:29:63: Error: The getter 'LogLevel' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'LogLevel'.
    .where((log) => _isLevel(log.level, [LogLevel.info, LogLevel.trace]))
    ^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:36:25: Error: The getter 'flutterDriverLog' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flutterDriverLog'.
    subscriptions.add(flutterDriverLog
    ^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:37:48: Error: The getter 'LogLevel' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'LogLevel'.
    .where((log) => _isLevel(log.level, [LogLevel.warning]))
    ^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:44:25: Error: The getter 'flutterDriverLog' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'flutterDriverLog'.
    subscriptions.add(flutterDriverLog
    ^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:46:45: Error: The getter 'LogLevel' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'LogLevel'.
    (log) => _isLevel(log.level, [LogLevel.critical, LogLevel.error]))
    ^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart:46:64: Error: The getter 'LogLevel' isn't defined for the class 'FlutterDriverReporter'.
  • 'FlutterDriverReporter' is from 'package:flutter_gherkin/src/flutter/reporters/flutter_driver_reporter.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_gherkin-1.1.7+5/lib/src/flutter/reporters/flutter_driver_reporter.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'LogLevel'.
    (log) => _isLevel(log.level, [LogLevel.critical, LogLevel.error]))

Remove flutter specific dependencies?

Any chance that the flutter specific dependencies could be removed from the pubspec.yaml or moved so they're not a required dependency? We've had success with a proof of concept using just the gherkin/non-flutter parts of the library for a dart web app, but there's some concerns about having to include the flutter sdk in order to use it on a larger scale.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.