feat(steps): Added new well known step `When I tap the back button` which finds and taps the default page back button
This commit is contained in:
parent
12d76c13f5
commit
7a69dcaedd
|
@ -1,6 +1,7 @@
|
|||
## [1.1.7+3] - 08/01/2019
|
||||
* 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
|
||||
|
||||
## [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
|
||||
|
|
|
@ -924,6 +924,7 @@ For convenience the library defines a number of pre-defined steps so you can get
|
|||
| I (open\|close) the drawer | Opens or closes the application default drawer | `When I open the drawer`, `And I close the drawer`|
|
||||
| I pause for {int} seconds | Pauses the test execution for the given seconds. Only use in debug scenarios or to inspect the state of the app | `Then I pause for 20 seconds` |
|
||||
| I restart the app | Restarts the app under test | `Then I restart the app` |
|
||||
| I tap the back button | Taps the page default back button widget | `Then I tap the back button` |
|
||||
|
||||
#### Flutter Driver Utilities
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:flutter_gherkin/src/flutter/flutter_world.dart';
|
||||
import 'package:flutter_gherkin/src/flutter/utils/driver_utils.dart';
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:gherkin/gherkin.dart';
|
||||
|
||||
/// Taps the back button widget
|
||||
///
|
||||
/// Examples:
|
||||
///
|
||||
/// `When I tap the back button"`
|
||||
/// `When I tap the back element"`
|
||||
/// `When I tap the back widget"`
|
||||
class WhenTapWidget extends When1WithWorld<String, FlutterWorld> {
|
||||
@override
|
||||
RegExp get pattern =>
|
||||
RegExp(r"I tap the back button [button|element|widget]");
|
||||
|
||||
@override
|
||||
Future<void> executeStep(String key) async {
|
||||
await FlutterDriverUtils.tap(
|
||||
world.driver,
|
||||
find.pageBack(),
|
||||
timeout: timeout * .9,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,10 @@ class WhenTapWidget extends When1WithWorld<String, FlutterWorld> {
|
|||
|
||||
@override
|
||||
Future<void> executeStep(String key) async {
|
||||
await FlutterDriverUtils.tap(world.driver, find.byValueKey(key),
|
||||
timeout: timeout * .9);
|
||||
await FlutterDriverUtils.tap(
|
||||
world.driver,
|
||||
find.byValueKey(key),
|
||||
timeout: timeout * .9,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue