Loop Expect Wait
This commit is contained in:
parent
f8cba5f159
commit
30c10c51c4
|
@ -14,11 +14,11 @@ Feature: Settings pane opens and can save settings persistently
|
||||||
And I tap the widget that contains the text "Block Unknown Contacts"
|
And I tap the widget that contains the text "Block Unknown Contacts"
|
||||||
And I tap the widget that contains the text "Streamer/Presentation Mode"
|
And I tap the widget that contains the text "Streamer/Presentation Mode"
|
||||||
And I tap the widget that contains the text "Enable Experiments"
|
And I tap the widget that contains the text "Enable Experiments"
|
||||||
And I wait until the text 'Enable Group Chat' is present
|
Then I wait until the text 'Enable Group Chat' is present
|
||||||
And I tap the widget that contains the text "Enable Group Chat"
|
And I tap the widget that contains the text "Enable Group Chat"
|
||||||
And I tap the widget that contains the text "Hosting Servers"
|
And I tap the widget that contains the text "Hosting Servers"
|
||||||
And I tap the widget that contains the text "File Sharing"
|
And I tap the widget that contains the text "File Sharing"
|
||||||
And I wait until the text 'Image Previews and Profile Pictures' is present
|
Then I wait until the text 'Image Previews and Profile Pictures' is present
|
||||||
And I tap the widget that contains the text "Image Previews and Profile Pictures"
|
And I tap the widget that contains the text "Image Previews and Profile Pictures"
|
||||||
And I wait until the text 'Download Folder' is present
|
And I wait until the text 'Download Folder' is present
|
||||||
And I fill the "DownloadFolderPicker" field with "/this/is/a/test"
|
And I fill the "DownloadFolderPicker" field with "/this/is/a/test"
|
||||||
|
|
|
@ -92,9 +92,7 @@ void main() async {
|
||||||
TestRunSummaryReporter()
|
TestRunSummaryReporter()
|
||||||
..setWriteLineFn(print)
|
..setWriteLineFn(print)
|
||||||
..setWriteFn(print),
|
..setWriteFn(print),
|
||||||
JsonReporter(
|
JsonReporter(),
|
||||||
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
customStepParameterDefinitions: [
|
customStepParameterDefinitions: [
|
||||||
SwitchStateParameter(),
|
SwitchStateParameter(),
|
||||||
|
|
|
@ -139,16 +139,17 @@ 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 () async {
|
await () async {
|
||||||
await context.world.appDriver.waitForAppToSettle();
|
var result = false;
|
||||||
|
while (!result) {
|
||||||
|
await context.world.appDriver.waitForAppToSettle();
|
||||||
|
|
||||||
return context.world.appDriver.isPresent(
|
result = await context.world.appDriver.isPresent(
|
||||||
context.world.appDriver.findByDescendant(
|
context.world.appDriver.findByDescendant(context.world.appDriver.findBy(widgetTypeByName(widgetType), FindType.type), context.world.appDriver.findBy(text, FindType.text)),
|
||||||
context.world.appDriver.findBy(
|
);
|
||||||
widgetTypeByName(widgetType), FindType.type),
|
}
|
||||||
context.world.appDriver.findBy(text, FindType.text)),
|
}()
|
||||||
);
|
.timeout(Duration(seconds: 120));
|
||||||
}().timeout(Duration(seconds: 120));
|
|
||||||
},
|
},
|
||||||
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
||||||
);
|
);
|
||||||
|
@ -158,18 +159,21 @@ StepDefinitionGeneric WaitUntilTextExists() {
|
||||||
return then2<String, Existence, FlutterWorld>(
|
return then2<String, Existence, FlutterWorld>(
|
||||||
'I wait until the text {string} is {existence}',
|
'I wait until the text {string} is {existence}',
|
||||||
(text, existence, context) async {
|
(text, existence, context) async {
|
||||||
await context.world.appDriver.waitUntil(
|
await () async {
|
||||||
() async {
|
var result = false;
|
||||||
return existence == Existence.absent
|
while (!result) {
|
||||||
|
await context.world.appDriver.waitForAppToSettle();
|
||||||
|
|
||||||
|
result = await (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),
|
||||||
)
|
)
|
||||||
: context.world.appDriver.isPresent(
|
: context.world.appDriver.isPresent(
|
||||||
context.world.appDriver.findBy(text, FindType.text),
|
context.world.appDriver.findBy(text, FindType.text),
|
||||||
);
|
));
|
||||||
},
|
}
|
||||||
timeout: Duration(seconds: 120),
|
}()
|
||||||
);
|
.timeout(Duration(seconds: 120));
|
||||||
},
|
},
|
||||||
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
configuration: StepDefinitionConfiguration()..timeout = const Duration(days: 1),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue