Skip to content

Commit 3f59a7a

Browse files
author
MritunjayTiwari14
committed
inbox: Add test for tapping a conversation row
Added test that verify that tapping a conversation row open the message list of that conversation. # Conflicts: # test/widgets/inbox_test.dart
1 parent 673ff5b commit 3f59a7a

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/widgets/inbox_test.dart

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:zulip/widgets/color.dart';
99
import 'package:zulip/widgets/home.dart';
1010
import 'package:zulip/widgets/icons.dart';
1111
import 'package:zulip/widgets/channel_colors.dart';
12+
import 'package:zulip/widgets/message_list.dart';
1213
import 'package:zulip/widgets/theme.dart';
1314
import 'package:zulip/widgets/unread_count_badge.dart';
1415

@@ -231,6 +232,42 @@ void main() {
231232

232233
// TODO test that tapping a conversation row opens the message list
233234
// for the conversation
235+
group('navigation', () {
236+
testWidgets('tapping a topic row opens the message list', (tester) async {
237+
final stream = eg.stream();
238+
final subscription = eg.subscription(stream);
239+
const topic = 'lunch';
240+
final message = eg.streamMessage(stream: stream, topic: topic);
241+
242+
await setupPage(tester,
243+
streams: [stream],
244+
subscriptions: [subscription],
245+
unreadMessages: [message]);
246+
247+
final connection = store.connection as FakeApiConnection;
248+
249+
connection.prepare(
250+
json: eg.newestGetMessagesResult(messages: [
251+
eg.streamMessage(stream: stream, topic: topic,
252+
flags: [MessageFlag.read]),
253+
], foundOldest: false).toJson(),
254+
);
255+
256+
connection.prepare(
257+
json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(),
258+
);
259+
260+
await tester.tap(find.text(topic));
261+
await tester.pumpAndSettle();
262+
263+
check(find.byType(HomePage)).findsNothing();
264+
check(find.byType(MessageListPage)).findsOne();
265+
266+
check(find.text(topic)).findsAny();
267+
268+
});
269+
270+
});
234271

235272
// Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
236273

0 commit comments

Comments
 (0)