Fix ExpectWidget with Text Override

This commit is contained in:
Sarah Jamie Lewis 2023-01-31 15:14:58 -08:00
parent 1fc4a0771c
commit 0e72619eb5
1 changed files with 9 additions and 11 deletions

View File

@ -139,16 +139,16 @@ StepDefinitionGeneric ExpectWidgetWithTextWithin() {
return given3<String, String, int, FlutterWorld>( return given3<String, String, int, FlutterWorld>(
RegExp(r'I expect a {string} widget with text {string} to be present within {int} second(s)$'), RegExp(r'I expect a {string} widget with text {string} to be present within {int} second(s)$'),
(widgetType, text, seconds, context) async { (widgetType, text, seconds, context) async {
await context.world.appDriver.waitUntil( await () async {
() async { await context.world.appDriver.waitForAppToSettle();
await context.world.appDriver.waitForAppToSettle();
return context.world.appDriver.isPresent( return context.world.appDriver.isPresent(
context.world.appDriver.findByDescendant(context.world.appDriver.findBy(widgetTypeByName(widgetType), FindType.type), context.world.appDriver.findBy(text, FindType.text)), context.world.appDriver.findByDescendant(
); context.world.appDriver.findBy(
}, widgetTypeByName(widgetType), FindType.type),
timeout: Duration(seconds: seconds), context.world.appDriver.findBy(text, FindType.text)),
); );
}().timeout(Duration(seconds: 120));
}, },
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1), configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
); );
@ -160,8 +160,6 @@ StepDefinitionGeneric WaitUntilTextExists() {
(text, existence, context) async { (text, existence, context) async {
await context.world.appDriver.waitUntil( await context.world.appDriver.waitUntil(
() async { () async {
await context.world.appDriver.waitForAppToSettle();
return existence == Existence.absent return existence == Existence.absent
? context.world.appDriver.isAbsent( ? context.world.appDriver.isAbsent(
context.world.appDriver.findBy(text, FindType.text), context.world.appDriver.findBy(text, FindType.text),