reverse arguments and expect on the presence step
This commit is contained in:
parent
ba28cc8f30
commit
44ca44ce2e
|
@ -1,3 +1,7 @@
|
|||
## Unreleased
|
||||
* **BREAKING CHANGE** reverse order of `driver` and `finder` in `FlutterDriverUtils#isPresent`. This makes this method's arguments more consistent with all other instance methods in the class by including `driver` first.
|
||||
* `expect` the presence of `ThenExpectWidgetToBePresent`. If the widget was not present, the method would simply timeout and not report an error for the step.
|
||||
|
||||
## [1.1.7+7] - 25/03/2019
|
||||
* Added the ability to test against an already running app; enabling you to debug a running application while it has tests executed against it. Setting the configuration property `runningAppProtocolEndpointUri` to the service protocol endpoint (found in stdout when an app has `--verbose` logging turrned on) will ensure that the existing app is connected to rather than starting a new instance of the app. NOTE: ensure the app you are trying to connect to calls `enableFlutterDriverExtension()` when it starts up otherwise the Flutter Driver will not be able to connect to it.
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class GivenOpenDrawer extends Given1WithWorld<String, FlutterWorld> {
|
|||
Future<void> executeStep(String action) async {
|
||||
final drawerFinder = find.byType("Drawer");
|
||||
final isOpen =
|
||||
await FlutterDriverUtils.isPresent(drawerFinder, world.driver);
|
||||
await FlutterDriverUtils.isPresent(world.driver, drawerFinder);
|
||||
// https://github.com/flutter/flutter/issues/9002#issuecomment-293660833
|
||||
if (isOpen && action == "close") {
|
||||
// Swipe to the left across the whole app to close the drawer
|
||||
|
|
|
@ -20,10 +20,11 @@ class ThenExpectWidgetToBePresent
|
|||
|
||||
@override
|
||||
Future<void> executeStep(String key, int seconds) async {
|
||||
await FlutterDriverUtils.isPresent(
|
||||
find.byValueKey(key),
|
||||
final isPresent = await FlutterDriverUtils.isPresent(
|
||||
world.driver,
|
||||
find.byValueKey(key),
|
||||
timeout: Duration(seconds: seconds),
|
||||
);
|
||||
expect(isPresent, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import 'package:flutter_driver/flutter_driver.dart';
|
|||
|
||||
class FlutterDriverUtils {
|
||||
static Future<bool> isPresent(
|
||||
SerializableFinder finder,
|
||||
FlutterDriver driver, {
|
||||
FlutterDriver driver,
|
||||
SerializableFinder finder, {
|
||||
Duration timeout = const Duration(seconds: 1),
|
||||
}) async {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue