chore(lib): updated gherkin lib

This commit is contained in:
Jon Samwell 2020-01-10 10:40:11 +11:00
parent 77d3728507
commit a8f294b034
7 changed files with 41 additions and 18 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
Feature: Drawer
@debug
Scenario: should open the drawer
Given I open the drawer
Given I close the drawer

View File

@ -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');

View File

@ -24,8 +24,10 @@ class GivenOpenDrawer extends Given1WithWorld<String, FlutterWorld> {
.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,
);
}
}
}

View File

@ -3,8 +3,11 @@ import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
class FlutterDriverUtils {
static Future<bool> isPresent(SerializableFinder finder, FlutterDriver driver,
{Duration timeout = const Duration(seconds: 1)}) async {
static Future<bool> 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<bool> isAbsent(FlutterDriver driver, SerializableFinder finder,
{Duration timeout = const Duration(seconds: 30)}) async {
static Future<bool> 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<bool> waitForFlutter(FlutterDriver driver,
{Duration timeout = const Duration(seconds: 30)}) async {
static Future<bool> 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<void> 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<String> getText(FlutterDriver driver, SerializableFinder finder,
{Duration timeout = const Duration(seconds: 30)}) async {
static Future<String> 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<void> tap(FlutterDriver driver, SerializableFinder finder,
{Duration timeout = const Duration(seconds: 30)}) async {
static Future<void> tap(
FlutterDriver driver,
SerializableFinder finder, {
Duration timeout = const Duration(seconds: 30),
}) async {
await driver.tap(finder, timeout: timeout);
await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout);
}

View File

@ -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:

View File

@ -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 <jonsamwell@gmail.com>
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: