waitForText
Future<
Wait for text to appear
Implementation
Future<TestNode> waitForText(
String text, {
bool exact = false,
Duration timeout = const Duration(seconds: 1),
}) async {
final deadline = DateTime.now().add(timeout);
while (DateTime.now().isBefore(deadline)) {
final results = findByText(text, exact: exact);
if (results.isNotEmpty) return results.first;
await Future<void>.delayed(const Duration(milliseconds: 50));
}
throw TestingException('Timeout waiting for text: $text');
}