Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It can't verify title page or content alert #55

Closed
hieutrandn9889 opened this issue Feb 21, 2020 · 4 comments
Closed

It can't verify title page or content alert #55

hieutrandn9889 opened this issue Feb 21, 2020 · 4 comments

Comments

@hieutrandn9889
Copy link

hieutrandn9889 commented Feb 21, 2020

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

@jonsamwell
Copy link
Owner

jonsamwell commented Feb 21, 2020 via email

@hieutrandn9889
Copy link
Author

hieutrandn9889 commented Feb 22, 2020

Hello,
Sorry man, I will show image my feature:

Screenshot_4

This step will get value from table >> I verify alert displays Welcome to ExecuteAutomation 0

And step:
Screenshot_5

When I will getText() of alert by command: homePage.getAlertContent()
Next step, It will verify between get value from table and getText() of alert:
expectMatch(await homePage.getAlertContent(), value);
But Gherkin can't support in log:
"GherkinStepNotDefinedException: Step definition not found for text:
'Then I verify alert displays "Welcome to ExecuteAutomation 0"'"

@jonsamwell
Copy link
Owner

jonsamwell commented Feb 22, 2020 via email

@hieutrandn9889
Copy link
Author

hieutrandn9889 commented Feb 24, 2020

OK thank man. I got it
It is fixed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants