ensureHasChats method

Future<void> ensureHasChats({
  1. int? counter,
  2. List<String>? ids,
})

Implementation

Future<void> ensureHasChats({int? counter, List<String>? ids}) async {
  await find.byKey(Keys.mainNav).should(findsOneWidget);
  final homeKey = find.byKey(MainNavKeys.chats);
  await homeKey.should(findsOneWidget);
  await homeKey.tap();

  final select = find.byKey(RoomsListWidget.roomListMenuKey);
  await tester.ensureVisible(select);

  if (counter != null) {
    final select = find.byType(ConvoCard);
    await select.should(findsNWidgets(counter));
  }

  if (ids?.isNotEmpty == true) {
    for (final id in ids!) {
      final select = find.byKey(Key('convo-card-$id'));
      await tester.ensureVisible(select);
    }
  }
}