Skip to content

Commit eaf22a6

Browse files
author
MritunjayTiwari14
committed
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.
1 parent 673ff5b commit eaf22a6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/widgets/inbox_test.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ 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

16+
import '../api/fake_api.dart';
1517
import '../example_data.dart' as eg;
1618
import '../flutter_checks.dart';
1719
import '../model/binding.dart';
@@ -231,6 +233,42 @@ void main() {
231233

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

235273
// Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
236274

0 commit comments

Comments
 (0)