diff --git a/CHANGELOG.md b/CHANGELOG.md index a8576c1..ffdfcdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.1.8+9] - 20/09/2020 + +* Fixes #84 - pre-defined `present within N seconds` is limited by system timeout (thanks @doubleo2) +* Added build mode to enable profile build and performance profiling (thanks @lsuhov) +* Updated to latest dart_gherkin library which fixes access to the default step timeout see #81 + + ## [1.1.8+8] - 11/08/2020 * Added well know steps and a driver helper method to long press a widget (fixed issue and documentation) diff --git a/example/test_driver/report.json b/example/test_driver/report.json index fd078da..7d1d6e6 100644 --- a/example/test_driver/report.json +++ b/example/test_driver/report.json @@ -1 +1 @@ -[{"description":"","id":"navigation","keyword":"Feature","line":1,"name":"Navigation","uri":".\\features\\back_navigation.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"navigation;user can navigate back from page two","name":"User can navigate back from page two","description":"","line":4,"tags":[{"line":3,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":5,"match":{"location":".\\features\\back_navigation.feature:5"},"result":{"status":"passed","duration":59000000}},{"keyword":"When ","name":"I tap the \"increment\" button","line":6,"match":{"location":".\\features\\back_navigation.feature:6"},"result":{"status":"passed","duration":393000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":7,"match":{"location":".\\features\\back_navigation.feature:7"},"result":{"status":"passed","duration":30000000}},{"keyword":"Given ","name":"I tap the label that contains the text \"Open page 2\"","line":9,"match":{"location":".\\features\\back_navigation.feature:9"},"result":{"status":"passed","duration":443000000}},{"keyword":"Then ","name":"I expect the text \"Contents of page 2\" to be present","line":10,"match":{"location":".\\features\\back_navigation.feature:10"},"result":{"status":"passed","duration":18000000}},{"keyword":"Given ","name":"I tap the back button","line":12,"match":{"location":".\\features\\back_navigation.feature:12"},"result":{"status":"passed","duration":386000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":13,"match":{"location":".\\features\\back_navigation.feature:13"},"result":{"status":"passed","duration":26000000}}]}]},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\sub-features\\counter_increases.feature"},{"description":"","id":"startup","keyword":"Feature","line":1,"name":"Startup","uri":".\\features\\counter.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"startup;should increment counter","name":"should increment counter","description":"","line":4,"tags":[{"line":3,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"I expect the \"longPressText\" to be \"Text that has not been long pressed\"","line":5,"match":{"location":".\\features\\counter.feature:5"},"result":{"status":"passed","duration":49000000}},{"keyword":"When ","name":"I long press the \"longPressText\" text","line":6,"match":{"location":".\\features\\counter.feature:6"},"result":{"status":"passed","duration":683000000}},{"keyword":"Then ","name":"I expect the \"longPressText\" to be \"Text has been long pressed!\"","line":7,"match":{"location":".\\features\\counter.feature:7"},"result":{"status":"passed","duration":31000000}}]}]},{"description":"","id":"custom parameter example","keyword":"Feature","line":1,"name":"Custom Parameter Example","uri":".\\features\\custom_parameter_example.feature"},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\counter_increases.feature"},{"description":"","id":"startup","keyword":"Feature","line":1,"name":"Startup","uri":".\\features\\app_restart.feature"},{"description":"","id":"interaction","keyword":"Feature","line":1,"name":"Interaction","uri":".\\features\\long_press_widget.feature"},{"description":"","id":"counter","keyword":"Feature","line":2,"name":"Counter","uri":".\\features\\counter_increases_french.feature"},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\counter_increases_scenerio_outline_example.feature"},{"description":"","id":"drawer","keyword":"Feature","line":1,"name":"Drawer","uri":".\\features\\drawer.feature"}] \ No newline at end of file +[{"description":"","id":"counter","keyword":"Feature","line":2,"name":"Counter","uri":".\\features\\counter_increases_french.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"counter;counter increases when the button is pressed","name":"Counter increases when the button is pressed","description":"","line":5,"steps":[{"keyword":"Etant ","name":"donné que I pick the colour red","line":6,"match":{"location":".\\features\\counter_increases_french.feature:6"},"result":{"status":"passed","duration":48000000}},{"keyword":"Et ","name":"I expect the \"counter\" to be \"0\"","line":7,"match":{"location":".\\features\\counter_increases_french.feature:7"},"result":{"status":"passed","duration":121000000}},{"keyword":"Quand ","name":"I tap the \"increment\" button 10 times","line":8,"match":{"location":".\\features\\counter_increases_french.feature:8"},"result":{"status":"passed","duration":2578000000}},{"keyword":"Alors ","name":"I expect the \"counter\" to be \"10\"","line":9,"match":{"location":".\\features\\counter_increases_french.feature:9"},"result":{"status":"passed","duration":43000000}}]}]},{"description":"","id":"interaction","keyword":"Feature","line":1,"name":"Interaction","uri":".\\features\\long_press_widget.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"interaction;widget can be long pressed","name":"Widget can be long pressed","description":"","line":3,"steps":[{"keyword":"Given ","name":"I expect the \"longPressText\" to be \"Text that has not been long pressed\"","line":4,"match":{"location":".\\features\\long_press_widget.feature:4"},"result":{"status":"passed","duration":70000000}},{"keyword":"When ","name":"I long press the \"longPressText\" text","line":5,"match":{"location":".\\features\\long_press_widget.feature:5"},"result":{"status":"passed","duration":895000000}},{"keyword":"Then ","name":"I expect the \"longPressText\" to be \"Text has been long pressed!\"","line":6,"match":{"location":".\\features\\long_press_widget.feature:6"},"result":{"status":"passed","duration":36000000}}]}]},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\counter_increases.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"counter;counter increases when the button is pressed","name":"Counter increases when the button is pressed","description":"","line":4,"steps":[{"keyword":"Given ","name":"I pick the colour red","line":5,"match":{"location":".\\features\\counter_increases.feature:5"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":6,"match":{"location":".\\features\\counter_increases.feature:6"},"result":{"status":"passed","duration":42000000}},{"keyword":"When ","name":"I tap the \"increment\" button 10 times","line":7,"match":{"location":".\\features\\counter_increases.feature:7"},"result":{"status":"passed","duration":2543000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"10\"","line":8,"match":{"location":".\\features\\counter_increases.feature:8"},"result":{"status":"passed","duration":31000000}}]}]},{"description":"","id":"delayed navigation","keyword":"Feature","line":1,"name":"Delayed navigation","uri":".\\features\\counter_increases_slowly.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"delayed navigation;user can navigate to page two. eventually","name":"User can navigate to page two. Eventually","description":"","line":3,"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":4,"match":{"location":".\\features\\counter_increases_slowly.feature:4"},"result":{"status":"passed","duration":46000000}},{"keyword":"When ","name":"I long press the \"openPage2\" button","line":5,"match":{"location":".\\features\\counter_increases_slowly.feature:5"},"result":{"status":"passed","duration":784000000}},{"keyword":"Then ","name":"I expect the widget \"pageTwo\" to be present within 15 seconds","line":6,"match":{"location":".\\features\\counter_increases_slowly.feature:6"},"result":{"status":"passed","duration":12158000000}}]}]},{"description":"","id":"startup","keyword":"Feature","line":1,"name":"Startup","uri":".\\features\\app_restart.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"startup;counter should reset when app is restarted","name":"counter should reset when app is restarted","description":"","line":3,"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":4,"match":{"location":".\\features\\app_restart.feature:4"},"result":{"status":"passed","duration":44000000}},{"keyword":"When ","name":"I tap the \"increment\" button","line":5,"match":{"location":".\\features\\app_restart.feature:5"},"result":{"status":"passed","duration":348000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":6,"match":{"location":".\\features\\app_restart.feature:6"},"result":{"status":"passed","duration":35000000}},{"keyword":"When ","name":"I restart the app","line":7,"match":{"location":".\\features\\app_restart.feature:7"},"result":{"status":"passed","duration":2627000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"0\"","line":8,"match":{"location":".\\features\\app_restart.feature:8"},"result":{"status":"passed","duration":44000000}}]}]},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\sub-features\\counter_increases.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"counter;counter increases when the button is pressed","name":"Counter increases when the button is pressed","description":"","line":5,"tags":[{"line":4,"name":"@perf"}],"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":6,"match":{"location":".\\features\\sub-features\\counter_increases.feature:6"},"result":{"status":"passed","duration":44000000}},{"keyword":"When ","name":"I tap the \"increment\" button 20 times","line":7,"match":{"location":".\\features\\sub-features\\counter_increases.feature:7"},"result":{"status":"passed","duration":4945000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"20\"","line":8,"match":{"location":".\\features\\sub-features\\counter_increases.feature:8"},"result":{"status":"passed","duration":28000000}}]}]},{"description":"","id":"custom parameter example","keyword":"Feature","line":1,"name":"Custom Parameter Example","uri":".\\features\\custom_parameter_example.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"custom parameter example;custom colour parameter","name":"Custom colour parameter","description":"","line":4,"steps":[{"keyword":"Given ","name":"I pick the colour red","line":5,"match":{"location":".\\features\\custom_parameter_example.feature:5"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I pick the colour green","line":6,"match":{"location":".\\features\\custom_parameter_example.feature:6"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I pick the colour blue","line":7,"match":{"location":".\\features\\custom_parameter_example.feature:7"},"result":{"status":"passed","duration":0}}]}]},{"description":"","id":"drawer","keyword":"Feature","line":1,"name":"Drawer","uri":".\\features\\drawer.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"drawer;should open the drawer","name":"should open the drawer","description":"","line":3,"steps":[{"keyword":"Given ","name":"I open the drawer","line":4,"match":{"location":".\\features\\drawer.feature:4"},"result":{"status":"passed","duration":1461000000}},{"keyword":"Given ","name":"I close the drawer","line":5,"match":{"location":".\\features\\drawer.feature:5"},"result":{"status":"passed","duration":408000000}}]}]},{"description":"","id":"navigation","keyword":"Feature","line":1,"name":"Navigation","uri":".\\features\\back_navigation.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"navigation;user can navigate back from page two","name":"User can navigate back from page two","description":"","line":4,"tags":[{"line":3,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":5,"match":{"location":".\\features\\back_navigation.feature:5"},"result":{"status":"passed","duration":42000000}},{"keyword":"When ","name":"I tap the \"increment\" button","line":6,"match":{"location":".\\features\\back_navigation.feature:6"},"result":{"status":"passed","duration":338000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":7,"match":{"location":".\\features\\back_navigation.feature:7"},"result":{"status":"passed","duration":30000000}},{"keyword":"Given ","name":"I tap the label that contains the text \"Open page 2\"","line":9,"match":{"location":".\\features\\back_navigation.feature:9"},"result":{"status":"passed","duration":387000000}},{"keyword":"Then ","name":"I expect the text \"Contents of page 2\" to be present","line":10,"match":{"location":".\\features\\back_navigation.feature:10"},"result":{"status":"passed","duration":19000000}},{"keyword":"Given ","name":"I tap the back button","line":12,"match":{"location":".\\features\\back_navigation.feature:12"},"result":{"status":"passed","duration":375000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":13,"match":{"location":".\\features\\back_navigation.feature:13"},"result":{"status":"passed","duration":26000000}}]}]},{"description":"","id":"startup","keyword":"Feature","line":1,"name":"Startup","uri":".\\features\\counter.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"startup;should increment counter","name":"should increment counter","description":"","line":3,"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":4,"match":{"location":".\\features\\counter.feature:4"},"result":{"status":"passed","duration":49000000}},{"keyword":"When ","name":"I tap the \"increment\" button","line":5,"match":{"location":".\\features\\counter.feature:5"},"result":{"status":"passed","duration":325000000}},{"keyword":"And ","name":"I tap the \"increment\" button","line":6,"match":{"location":".\\features\\counter.feature:6"},"result":{"status":"passed","duration":263000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"2\"","line":7,"match":{"location":".\\features\\counter.feature:7"},"result":{"status":"passed","duration":28000000}}]},{"keyword":"Scenario","type":"scenario","id":"startup;counter should reset when app is restarted","name":"counter should reset when app is restarted","description":"","line":9,"steps":[{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":10,"match":{"location":".\\features\\counter.feature:10"},"result":{"status":"passed","duration":42000000}},{"keyword":"When ","name":"I tap the \"increment\" button","line":11,"match":{"location":".\\features\\counter.feature:11"},"result":{"status":"passed","duration":332000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":12,"match":{"location":".\\features\\counter.feature:12"},"result":{"status":"passed","duration":36000000}},{"keyword":"When ","name":"I restart the app","line":13,"match":{"location":".\\features\\counter.feature:13"},"result":{"status":"passed","duration":2568000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"0\"","line":14,"match":{"location":".\\features\\counter.feature:14"},"result":{"status":"passed","duration":47000000}}]}]},{"description":"","id":"counter","keyword":"Feature","line":1,"name":"Counter","uri":".\\features\\counter_increases_scenerio_outline_example.feature","elements":[{"keyword":"Scenario Outline","type":"scenario","id":"counter;counter increases when the button is pressed (example 1)","name":"Counter increases when the button is pressed (Example 1)","description":"","line":5,"tags":[{"line":4,"name":"@scenario_outline"}],"steps":[{"keyword":"Given ","name":"I pick the colour red","line":6,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:6"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":7,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:7"},"result":{"status":"passed","duration":44000000}},{"keyword":"When ","name":"I tap the \"increment\" button 1 times","line":8,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:8"},"result":{"status":"passed","duration":319000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"1\"","line":9,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:9"},"result":{"status":"passed","duration":28000000}}]},{"keyword":"Scenario Outline","type":"scenario","id":"counter;counter increases when the button is pressed (example 2)","name":"Counter increases when the button is pressed (Example 2)","description":"","line":5,"tags":[{"line":4,"name":"@scenario_outline"}],"steps":[{"keyword":"Given ","name":"I pick the colour red","line":6,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:6"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":7,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:7"},"result":{"status":"passed","duration":41000000}},{"keyword":"When ","name":"I tap the \"increment\" button 2 times","line":8,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:8"},"result":{"status":"passed","duration":602000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"2\"","line":9,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:9"},"result":{"status":"passed","duration":38000000}}]},{"keyword":"Scenario Outline","type":"scenario","id":"counter;counter increases when the button is pressed (example 3)","name":"Counter increases when the button is pressed (Example 3)","description":"","line":5,"tags":[{"line":4,"name":"@scenario_outline"}],"steps":[{"keyword":"Given ","name":"I pick the colour red","line":6,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:6"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":7,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:7"},"result":{"status":"passed","duration":44000000}},{"keyword":"When ","name":"I tap the \"increment\" button 5 times","line":8,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:8"},"result":{"status":"passed","duration":1302000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"5\"","line":9,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:9"},"result":{"status":"passed","duration":25000000}}]},{"keyword":"Scenario Outline","type":"scenario","id":"counter;counter increases when the button is pressed (example 4)","name":"Counter increases when the button is pressed (Example 4)","description":"","line":5,"tags":[{"line":4,"name":"@scenario_outline"}],"steps":[{"keyword":"Given ","name":"I pick the colour red","line":6,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:6"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"I expect the \"counter\" to be \"0\"","line":7,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:7"},"result":{"status":"passed","duration":40000000}},{"keyword":"When ","name":"I tap the \"increment\" button 10 times","line":8,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:8"},"result":{"status":"passed","duration":2523000000}},{"keyword":"Then ","name":"I expect the \"counter\" to be \"10\"","line":9,"match":{"location":".\\features\\counter_increases_scenerio_outline_example.feature:9"},"result":{"status":"passed","duration":26000000}}]}]}] \ No newline at end of file diff --git a/lib/src/flutter/build_mode.dart b/lib/src/flutter/build_mode.dart index f2b6216..2563335 100644 --- a/lib/src/flutter/build_mode.dart +++ b/lib/src/flutter/build_mode.dart @@ -1,4 +1 @@ -enum BuildMode { - Debug, - Profile -} \ No newline at end of file +enum BuildMode { Debug, Profile } diff --git a/lib/src/flutter/steps/then_expect_widget_to_be_present_step.dart b/lib/src/flutter/steps/then_expect_widget_to_be_present_step.dart index 42e74f0..f0c9557 100644 --- a/lib/src/flutter/steps/then_expect_widget_to_be_present_step.dart +++ b/lib/src/flutter/steps/then_expect_widget_to_be_present_step.dart @@ -14,17 +14,16 @@ import 'package:gherkin/gherkin.dart'; /// `Then I expect the button 'save' to be present within 1 second` StepDefinitionGeneric ThenExpectWidgetToBePresent() { return given2( - RegExp( - r'I expect the (?:button|element|label|icon|field|text|widget|dialog|popup) {string} to be present within {int} second(s)$'), - (key, seconds, context) async { - final isPresent = await FlutterDriverUtils.isPresent( - context.world.driver, - find.byValueKey(key), - timeout: Duration(seconds: seconds), - ); - context.expect(isPresent, true); - }, - configuration: StepDefinitionConfiguration() - ..timeout = Duration(days: 9999) - ); + RegExp( + r'I expect the (?:button|element|label|icon|field|text|widget|dialog|popup) {string} to be present within {int} second(s)$'), + (key, seconds, context) async { + final isPresent = await FlutterDriverUtils.isPresent( + context.world.driver, + find.byValueKey(key), + timeout: Duration(seconds: seconds), + ); + context.expect(isPresent, true); + }, + configuration: StepDefinitionConfiguration() + ..timeout = const Duration(days: 1)); } diff --git a/pubspec.lock b/pubspec.lock index e900aa6..cbbd747 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "6.0.0" + version: "7.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.39.16" + version: "0.39.17" archive: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.2.0" clock: dependency: transitive description: @@ -91,7 +91,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.0" + version: "0.14.1" crypto: dependency: transitive description: @@ -146,7 +146,7 @@ packages: name: gherkin url: "https://pub.dartlang.org" source: hosted - version: "1.1.8+3" + version: "1.1.8+4" glob: dependency: "direct main" description: @@ -237,7 +237,7 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.6+3" + version: "0.9.7" node_interop: dependency: transitive description: @@ -314,7 +314,7 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.7" + version: "0.7.9" shelf_packages_handler: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 39b5979..bcdd250 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_gherkin description: A Gherkin / Cucumber parser and test runner for Dart and Flutter -version: 1.1.8+8 +version: 1.1.8+9 homepage: https://github.com/jonsamwell/flutter_gherkin environment: @@ -16,7 +16,7 @@ dependencies: sdk: flutter glob: ^1.1.7 meta: ">=1.1.6 <2.0.0" - gherkin: ^1.1.8+3 + gherkin: ^1.1.8+4 # gherkin: # path: ../dart_gherkin