testUISleepUntilRoutes function
Calls testUISleepUntil checking if routes
has the current route (UINavigator.currentRoute).
Implementation
Future<bool> testUISleepUntilRoutes(List<String> routes,
{int? timeoutMs, int? intervalMs, int? minMs, bool expected = false}) {
if (routes.isEmpty) {
throw ArgumentError("Empty `routes`");
}
var stackTrace = StackTrace.current;
return testUISleepUntil(
() => routes.contains(UINavigator.currentRoute ?? ''),
readyTitle: 'one of routes $routes',
timeoutMs: timeoutMs ?? 2000,
intervalMs: intervalMs ?? 100,
minMs: minMs,
).thenChain((ok) {
if (expected && !ok) {
Error.throwWithStackTrace(
TestFailure(
"Expected routes: `$routes` ; current: `${UINavigator.currentRoute}`"),
stackTrace);
}
return ok;
});
}