Skip to content

Commit d1c5f41

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 6f83215 commit d1c5f41

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
@@ -91,6 +91,15 @@ void main() {
9191
await tester.pumpAndSettle();
9292
}
9393

94+
void checkAppBarChannelTopic(String channelName, String topic) {
95+
final appBarFinder = find.byType(MessageListAppBarTitle);
96+
check(appBarFinder).findsOne();
97+
check(find.descendant(of: appBarFinder, matching: find.text(channelName)))
98+
.findsOne();
99+
check(find.descendant(of: appBarFinder, matching: find.text(topic)))
100+
.findsOne();
101+
}
102+
94103
ScrollController? findMessageListScrollController(WidgetTester tester) {
95104
final scrollView = tester.widget<CustomScrollView>(find.byType(CustomScrollView));
96105
return scrollView.controller;
@@ -783,10 +792,7 @@ void main() {
783792
of: find.byType(RecipientHeader),
784793
matching: find.text('new topic')).evaluate()
785794
).length.equals(1);
786-
check(find.descendant(
787-
of: find.byType(MessageListAppBarTitle),
788-
matching: find.text('new topic')).evaluate()
789-
).length.equals(1);
795+
checkAppBarChannelTopic(channel.name, 'new topic');
790796
});
791797
});
792798

0 commit comments

Comments
 (0)