@@ -13,6 +13,7 @@ import 'package:zulip/widgets/message_list.dart';
1313import 'package:zulip/widgets/theme.dart' ;
1414import 'package:zulip/widgets/unread_count_badge.dart' ;
1515
16+ import '../api/fake_api.dart' ;
1617import '../example_data.dart' as eg;
1718import '../flutter_checks.dart' ;
1819import '../model/binding.dart' ;
@@ -267,6 +268,35 @@ void main() {
267268
268269 });
269270
271+ testWidgets ('tapping a DM row opens the message list' , (tester) async {
272+ final otherUser = eg.otherUser;
273+ final message = eg.dmMessage (from: otherUser, to: [eg.selfUser]);
274+
275+ await setupPage (tester,
276+ users: [eg.selfUser, otherUser],
277+ unreadMessages: [message]);
278+
279+ final connection = store.connection as FakeApiConnection ;
280+
281+ connection.prepare (
282+ json: eg.newestGetMessagesResult (messages: [
283+ eg.dmMessage (from: otherUser, to: [eg.selfUser], flags: [MessageFlag .read]),
284+ ], foundOldest: false ).toJson (),
285+ );
286+
287+ connection.prepare (
288+ json: eg.newestGetMessagesResult (messages: [], foundOldest: true ).toJson (),
289+ );
290+
291+ await tester.tap (find.text (otherUser.fullName));
292+ await tester.pumpAndSettle ();
293+
294+ check (find.byType (HomePage )).findsNothing ();
295+ check (find.byType (MessageListPage )).findsOne ();
296+
297+ check (find.text (otherUser.fullName)).findsAny ();
298+ });
299+
270300 });
271301
272302 // Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
0 commit comments