@@ -195,6 +195,25 @@ void main() {
195195 await tester.pump (const Duration (milliseconds: 250 ));
196196 }
197197
198+ Future <void > showFromRecipientHeader (WidgetTester tester, {
199+ StreamMessage ? message,
200+ }) async {
201+ final effectiveMessage = message ?? someMessage;
202+
203+ connection.prepare (json: eg.newestGetMessagesResult (
204+ foundOldest: true , messages: [effectiveMessage]).toJson ());
205+ await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
206+ child: const MessageListPage (initNarrow: CombinedFeedNarrow ())));
207+ // global store, per-account store, and message list get loaded
208+ await tester.pumpAndSettle ();
209+
210+ await tester.longPress (find.descendant (
211+ of: find.byType (RecipientHeader ),
212+ matching: find.text (effectiveMessage.topic.displayName)));
213+ // sheet appears onscreen; default duration of bottom-sheet enter animation
214+ await tester.pump (const Duration (milliseconds: 250 ));
215+ }
216+
198217 group ('showTopicActionSheet' , () {
199218 void checkButtons () {
200219 final actionSheetFinder = find.byType (BottomSheet );
@@ -228,17 +247,7 @@ void main() {
228247
229248 testWidgets ('show from recipient header' , (tester) async {
230249 await prepare ();
231- connection.prepare (json: eg.newestGetMessagesResult (
232- foundOldest: true , messages: [someMessage]).toJson ());
233- await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
234- child: const MessageListPage (initNarrow: CombinedFeedNarrow ())));
235- // global store, per-account store, and message list get loaded
236- await tester.pumpAndSettle ();
237-
238- await tester.longPress (find.descendant (
239- of: find.byType (RecipientHeader ), matching: find.text (someTopic)));
240- // sheet appears onscreen; default duration of bottom-sheet enter animation
241- await tester.pump (const Duration (milliseconds: 250 ));
250+ await showFromRecipientHeader (tester);
242251 checkButtons ();
243252 });
244253 });
0 commit comments