Skip to content

Commit 530cbf4

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.
1 parent 6adc9c3 commit 530cbf4

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

test/widgets/inbox_test.dart

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ 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/unread_count_badge.dart';
1314

15+
import '../api/fake_api.dart';
1416
import '../example_data.dart' as eg;
1517
import '../flutter_checks.dart';
1618
import '../model/binding.dart';
@@ -206,8 +208,42 @@ void main() {
206208
await setupVarious(tester);
207209
});
208210

209-
// TODO test that tapping a conversation row opens the message list
210-
// for the conversation
211+
group('navigation', () {
212+
testWidgets('tapping a topic row opens the message list', (tester) async {
213+
final stream = eg.stream();
214+
final subscription = eg.subscription(stream);
215+
const topic = 'lunch';
216+
final message = eg.streamMessage(stream: stream, topic: topic);
217+
218+
await setupPage(tester,
219+
streams: [stream],
220+
subscriptions: [subscription],
221+
unreadMessages: [message]);
222+
223+
final connection = store.connection as FakeApiConnection;
224+
225+
connection.prepare(
226+
json: eg.newestGetMessagesResult(messages: [
227+
eg.streamMessage(stream: stream, topic: topic,
228+
flags: [MessageFlag.read]),
229+
], foundOldest: false).toJson(),
230+
);
231+
232+
connection.prepare(
233+
json: eg.newestGetMessagesResult(messages: [], foundOldest: true).toJson(),
234+
);
235+
236+
await tester.tap(find.text(topic));
237+
await tester.pumpAndSettle();
238+
239+
check(find.byType(HomePage)).findsNothing();
240+
check(find.byType(MessageListPage)).findsOne();
241+
242+
check(find.text(topic)).findsAny();
243+
244+
});
245+
246+
});
211247

212248
// Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
213249

0 commit comments

Comments
 (0)