From eaf22a6c2fdf34dbdbc1f0fba6459bc170815944 Mon Sep 17 00:00:00 2001 From: MritunjayTiwari14 Date: Thu, 9 Oct 2025 10:23:44 +0530 Subject: [PATCH 1/2] inbox: Add test for tapping a conversation row Add a test that verifies tapping a conversation row opens the message list for that specific conversation. --- test/widgets/inbox_test.dart | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/widgets/inbox_test.dart b/test/widgets/inbox_test.dart index 63aad6292c..69fd853503 100644 --- a/test/widgets/inbox_test.dart +++ b/test/widgets/inbox_test.dart @@ -9,9 +9,11 @@ import 'package:zulip/widgets/color.dart'; import 'package:zulip/widgets/home.dart'; import 'package:zulip/widgets/icons.dart'; import 'package:zulip/widgets/channel_colors.dart'; +import 'package:zulip/widgets/message_list.dart'; import 'package:zulip/widgets/theme.dart'; import 'package:zulip/widgets/unread_count_badge.dart'; +import '../api/fake_api.dart'; import '../example_data.dart' as eg; import '../flutter_checks.dart'; import '../model/binding.dart'; @@ -231,6 +233,42 @@ void main() { // TODO test that tapping a conversation row opens the message list // for the conversation + group('navigation', () { + testWidgets('tapping a topic row opens the message list', (tester) async { + final stream = eg.stream(); + final subscription = eg.subscription(stream); + const topic = 'lunch'; + final message = eg.streamMessage(stream: stream, topic: topic); + + await setupPage(tester, + streams: [stream], + subscriptions: [subscription], + unreadMessages: [message]); + + final connection = store.connection as FakeApiConnection; + + connection.prepare( + json: eg.newestGetMessagesResult(messages: [ + eg.streamMessage(stream: stream, topic: topic, + flags: [MessageFlag.read]), + ], foundOldest: false).toJson(), + ); + + connection.prepare( + json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(), + ); + + await tester.tap(find.text(topic)); + await tester.pumpAndSettle(); + + check(find.byType(HomePage)).findsNothing(); + check(find.byType(MessageListPage)).findsOne(); + + check(find.text(topic)).findsAny(); + + }); + + }); // Tests for the topic action sheet are in test/widgets/action_sheet_test.dart. From f7a333e191a34ab61f2551125c9ff51d706a80c9 Mon Sep 17 00:00:00 2001 From: MritunjayTiwari14 Date: Thu, 9 Oct 2025 10:26:45 +0530 Subject: [PATCH 2/2] inbox: Add test to verify tapping a DM row Add a test that verifies tapping a DM row opens only the message list for that specific DM. --- test/widgets/inbox_test.dart | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/test/widgets/inbox_test.dart b/test/widgets/inbox_test.dart index 69fd853503..08e72edcf4 100644 --- a/test/widgets/inbox_test.dart +++ b/test/widgets/inbox_test.dart @@ -231,8 +231,6 @@ void main() { check(text).style.isNotNull().color.isNotNull().isSameColorAs(expectedTextColor); }); - // TODO test that tapping a conversation row opens the message list - // for the conversation group('navigation', () { testWidgets('tapping a topic row opens the message list', (tester) async { final stream = eg.stream(); @@ -268,6 +266,35 @@ void main() { }); + testWidgets('tapping a DM row opens the message list', (tester) async { + final otherUser = eg.otherUser; + final message = eg.dmMessage(from: otherUser, to: [eg.selfUser]); + + await setupPage(tester, + users: [eg.selfUser, otherUser], + unreadMessages: [message]); + + final connection = store.connection as FakeApiConnection; + + connection.prepare( + json: eg.newestGetMessagesResult(messages: [ + eg.dmMessage(from: otherUser, to: [eg.selfUser], flags: [MessageFlag.read]), + ], foundOldest: false).toJson(), + ); + + connection.prepare( + json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(), + ); + + await tester.tap(find.text(otherUser.fullName)); + await tester.pumpAndSettle(); + + check(find.byType(HomePage)).findsNothing(); + check(find.byType(MessageListPage)).findsOne(); + + check(find.text(otherUser.fullName)).findsAny(); + }); + }); // Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.