Add wait for text to be absent
This commit is contained in:
parent
f20a14f3d8
commit
bc846ee4df
|
@ -29,6 +29,7 @@ class FlutterTestConfiguration extends TestConfiguration {
|
||||||
whenPauseStep(),
|
whenPauseStep(),
|
||||||
whenFillFieldStep(),
|
whenFillFieldStep(),
|
||||||
thenExpectWidgetToBePresent(),
|
thenExpectWidgetToBePresent(),
|
||||||
|
thenExpectWidgetToBeAbsent(),
|
||||||
restartAppStep(),
|
restartAppStep(),
|
||||||
siblingContainsTextStep(),
|
siblingContainsTextStep(),
|
||||||
tapTextWithinWidgetStep(),
|
tapTextWithinWidgetStep(),
|
||||||
|
|
|
@ -29,3 +29,22 @@ StepDefinitionGeneric thenExpectWidgetToBePresent() {
|
||||||
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StepDefinitionGeneric thenExpectWidgetToBeAbsent() {
|
||||||
|
return given2<String, int, FlutterWorld>(
|
||||||
|
RegExp(r'I expect the (?:button|element|label|icon|field|text|widget|dialog|popup) {string} to be absent within {int} second(s)$'),
|
||||||
|
(key, seconds, context) async {
|
||||||
|
await context.world.appDriver.waitUntil(
|
||||||
|
() async {
|
||||||
|
await context.world.appDriver.waitForAppToSettle();
|
||||||
|
|
||||||
|
return context.world.appDriver.isAbsent(
|
||||||
|
context.world.appDriver.findBy(key, FindType.key),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
timeout: Duration(seconds: seconds),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue