Skip to content

Commit 176304a

Browse files
committed
msglist test: Add and use helper checkAppBarChannelTopic
We'll use this for some new tests, coming up. Also use it now for one test that's only been checking the topic in the app bar. That test now checks the channel name too, as it was before b1767b2, which dropped that specificity when we split the app bar's channel name and topic onto two rows.
1 parent 1e07da6 commit 176304a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/widgets/message_list_test.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ void main() {
9292
await tester.pumpAndSettle();
9393
}
9494

95+
void checkAppBarChannelTopic(String channelName, String topic) {
96+
final appBarFinder = find.byType(MessageListAppBarTitle);
97+
check(appBarFinder).findsOne();
98+
check(find.descendant(of: appBarFinder, matching: find.text(channelName)))
99+
.findsOne();
100+
check(find.descendant(of: appBarFinder, matching: find.text(topic)))
101+
.findsOne();
102+
}
103+
95104
ScrollController? findMessageListScrollController(WidgetTester tester) {
96105
final scrollView = tester.widget<CustomScrollView>(find.byType(CustomScrollView));
97106
return scrollView.controller;
@@ -790,10 +799,7 @@ void main() {
790799
of: find.byType(RecipientHeader),
791800
matching: find.text('new topic')).evaluate()
792801
).length.equals(1);
793-
check(find.descendant(
794-
of: find.byType(MessageListAppBarTitle),
795-
matching: find.text('new topic')).evaluate()
796-
).length.equals(1);
802+
checkAppBarChannelTopic(channel.name, 'new topic');
797803
});
798804
});
799805

0 commit comments

Comments
 (0)