Skip to content

Commit c29a8f8

Browse files
committed
actions test: Add helper function to check and confirm ActionDialog
1 parent 6409735 commit c29a8f8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/widgets/actions_test.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ void main() {
5656
}
5757

5858
group('markNarrowAsRead', () {
59+
Future<void> confirmToMarkNarrowAsRead({required WidgetTester tester,
60+
required BuildContext context, required Narrow narrow
61+
}) async {
62+
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
63+
64+
final future = tester.runAsync(() => ZulipAction.markNarrowAsRead(context, narrow));
65+
66+
await tester.pump();
67+
final (confirmButton, _) = checkSuggestedActionDialog(tester,
68+
expectedTitle: zulipLocalizations.markAllAsReadConfirmationDialogTitle,
69+
expectedMessage: zulipLocalizations.markAllAsReadConfirmationDialogMessage,
70+
expectedActionButtonText: zulipLocalizations.markAllAsReadConfirmationDialogAction,
71+
);
72+
73+
await tester.tap(find.byWidget(confirmButton));
74+
await tester.pump();
75+
76+
await future;
77+
}
78+
5979
testWidgets('smoke test on modern server', (tester) async {
6080
final narrow = TopicNarrow.ofMessage(eg.streamMessage());
6181
await prepare(tester);

0 commit comments

Comments
 (0)