diff --git a/CHANGELOG.md b/CHANGELOG.md index d48cddd..8a33123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Added retry logic to the Futter driver connect call to handle the seemingly random connection failures * Ensured `AttachScreenshotOnFailedStepHook` cannot throw an unhandled exception causing the test run to stop * Added new well known step `When I tap the back button` which finds and taps the default page back button +* Updated Gherkin library version ## [1.1.7+2] - 07/01/2019 * Increased the Flutter driver reconnection delay to try and overcome some driver to app connection issues on slower machines diff --git a/example/test_driver/features/drawer.feature b/example/test_driver/features/drawer.feature index dff575f..e2f38ae 100644 --- a/example/test_driver/features/drawer.feature +++ b/example/test_driver/features/drawer.feature @@ -1,5 +1,5 @@ Feature: Drawer - + @debug Scenario: should open the drawer Given I open the drawer Given I close the drawer diff --git a/lib/src/flutter/flutter_world.dart b/lib/src/flutter/flutter_world.dart index 10a5232..1bf0da1 100644 --- a/lib/src/flutter/flutter_world.dart +++ b/lib/src/flutter/flutter_world.dart @@ -52,6 +52,7 @@ class FlutterWorld extends World { print( 'Error waiting for no transient callbacks from Flutter driver:\n\n`$e`\n\n$st'); }); + await _driver.close().catchError((e, st) { // Avoid an unhandled error. print('Error closing Flutter driver:\n\n`$e`\n\n$st'); diff --git a/lib/src/flutter/steps/given_i_open_the_drawer_step.dart b/lib/src/flutter/steps/given_i_open_the_drawer_step.dart index 22cb4d4..19216c0 100644 --- a/lib/src/flutter/steps/given_i_open_the_drawer_step.dart +++ b/lib/src/flutter/steps/given_i_open_the_drawer_step.dart @@ -24,8 +24,10 @@ class GivenOpenDrawer extends Given1WithWorld { .scroll(drawerFinder, -300.0, 0.0, const Duration(milliseconds: 300)); } else if (!isOpen && action == "open") { await FlutterDriverUtils.tap( - world.driver, find.byTooltip("Open navigation menu"), - timeout: timeout); + world.driver, + find.byTooltip("Open navigation menu"), + timeout: timeout, + ); } } } diff --git a/lib/src/flutter/utils/driver_utils.dart b/lib/src/flutter/utils/driver_utils.dart index eeecae0..af32846 100644 --- a/lib/src/flutter/utils/driver_utils.dart +++ b/lib/src/flutter/utils/driver_utils.dart @@ -3,8 +3,11 @@ import 'dart:async'; import 'package:flutter_driver/flutter_driver.dart'; class FlutterDriverUtils { - static Future isPresent(SerializableFinder finder, FlutterDriver driver, - {Duration timeout = const Duration(seconds: 1)}) async { + static Future isPresent( + SerializableFinder finder, + FlutterDriver driver, { + Duration timeout = const Duration(seconds: 1), + }) async { try { await driver.waitFor(finder, timeout: timeout); return true; @@ -13,8 +16,11 @@ class FlutterDriverUtils { } } - static Future isAbsent(FlutterDriver driver, SerializableFinder finder, - {Duration timeout = const Duration(seconds: 30)}) async { + static Future isAbsent( + FlutterDriver driver, + SerializableFinder finder, { + Duration timeout = const Duration(seconds: 30), + }) async { try { await driver.waitForAbsent(finder, timeout: timeout); return true; @@ -23,8 +29,10 @@ class FlutterDriverUtils { } } - static Future waitForFlutter(FlutterDriver driver, - {Duration timeout = const Duration(seconds: 30)}) async { + static Future waitForFlutter( + FlutterDriver driver, { + Duration timeout = const Duration(seconds: 30), + }) async { try { await driver.waitUntilNoTransientCallbacks(timeout: timeout); return true; @@ -34,21 +42,30 @@ class FlutterDriverUtils { } static Future enterText( - FlutterDriver driver, SerializableFinder finder, String text, - {Duration timeout = const Duration(seconds: 30)}) async { + FlutterDriver driver, + SerializableFinder finder, + String text, { + Duration timeout = const Duration(seconds: 30), + }) async { await FlutterDriverUtils.tap(driver, finder, timeout: timeout); await driver.enterText(text, timeout: timeout); } - static Future getText(FlutterDriver driver, SerializableFinder finder, - {Duration timeout = const Duration(seconds: 30)}) async { + static Future getText( + FlutterDriver driver, + SerializableFinder finder, { + Duration timeout = const Duration(seconds: 30), + }) async { await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout); final text = await driver.getText(finder, timeout: timeout); return text; } - static Future tap(FlutterDriver driver, SerializableFinder finder, - {Duration timeout = const Duration(seconds: 30)}) async { + static Future tap( + FlutterDriver driver, + SerializableFinder finder, { + Duration timeout = const Duration(seconds: 30), + }) async { await driver.tap(finder, timeout: timeout); await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout); } diff --git a/pubspec.lock b/pubspec.lock index a053bca..9e82a9d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -118,7 +118,7 @@ packages: name: gherkin url: "https://pub.dartlang.org" source: hosted - version: "1.1.5+2" + version: "1.1.6+1" glob: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 421b55f..45e8d92 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.7+2 +version: 1.1.7+3 author: Jon Samwell homepage: https://github.com/jonsamwell/flutter_gherkin @@ -16,7 +16,9 @@ dependencies: sdk: flutter glob: ^1.1.7 meta: ">=1.1.6 <2.0.0" - gherkin: ^1.1.5+2 + gherkin: ^1.1.6+1 + # gherkin: + # path: ../dart_gherkin dev_dependencies: test: