@@ -198,6 +198,26 @@ void main() {
198
198
await tester.pump (const Duration (milliseconds: 250 ));
199
199
}
200
200
201
+ Future <void > showFromRecipientHeader (WidgetTester tester, {
202
+ String topic = someTopic,
203
+ StreamMessage ? message,
204
+ }) async {
205
+ final effectiveMessage = message ?? someMessage;
206
+ assert (effectiveMessage.topic.apiName == topic);
207
+
208
+ connection.prepare (json: eg.newestGetMessagesResult (
209
+ foundOldest: true , messages: [effectiveMessage]).toJson ());
210
+ await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
211
+ child: const MessageListPage (initNarrow: CombinedFeedNarrow ())));
212
+ // global store, per-account store, and message list get loaded
213
+ await tester.pumpAndSettle ();
214
+
215
+ await tester.longPress (find.descendant (
216
+ of: find.byType (RecipientHeader ), matching: find.text (topic)));
217
+ // sheet appears onscreen; default duration of bottom-sheet enter animation
218
+ await tester.pump (const Duration (milliseconds: 250 ));
219
+ }
220
+
201
221
group ('showTopicActionSheet' , () {
202
222
void checkButtons () {
203
223
final actionSheetFinder = find.byType (BottomSheet );
@@ -231,17 +251,7 @@ void main() {
231
251
232
252
testWidgets ('show from recipient header' , (tester) async {
233
253
await prepare ();
234
- connection.prepare (json: eg.newestGetMessagesResult (
235
- foundOldest: true , messages: [someMessage]).toJson ());
236
- await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
237
- child: const MessageListPage (initNarrow: CombinedFeedNarrow ())));
238
- // global store, per-account store, and message list get loaded
239
- await tester.pumpAndSettle ();
240
-
241
- await tester.longPress (find.descendant (
242
- of: find.byType (RecipientHeader ), matching: find.text (someTopic)));
243
- // sheet appears onscreen; default duration of bottom-sheet enter animation
244
- await tester.pump (const Duration (milliseconds: 250 ));
254
+ await showFromRecipientHeader (tester);
245
255
checkButtons ();
246
256
});
247
257
});
0 commit comments