@@ -195,6 +195,25 @@ void main() {
195
195
await tester.pump (const Duration (milliseconds: 250 ));
196
196
}
197
197
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
+
198
217
group ('showTopicActionSheet' , () {
199
218
void checkButtons () {
200
219
final actionSheetFinder = find.byType (BottomSheet );
@@ -228,17 +247,7 @@ void main() {
228
247
229
248
testWidgets ('show from recipient header' , (tester) async {
230
249
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);
242
251
checkButtons ();
243
252
});
244
253
});
0 commit comments