@@ -173,6 +173,31 @@ void main() {
173
173
await tester.pump (const Duration (milliseconds: 250 ));
174
174
}
175
175
176
+ Future <void > showFromAppBar (WidgetTester tester, {
177
+ ZulipStream ? channel,
178
+ String topic = someTopic,
179
+ StreamMessage ? message,
180
+ }) async {
181
+ final effectiveChannel = channel ?? someChannel;
182
+ final effectiveMessage = message ?? someMessage;
183
+ assert (effectiveMessage.topic.apiName == topic);
184
+
185
+ connection.prepare (json: eg.newestGetMessagesResult (
186
+ foundOldest: true , messages: [effectiveMessage]).toJson ());
187
+ await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
188
+ child: MessageListPage (
189
+ initNarrow: eg.topicNarrow (effectiveChannel.streamId, topic))));
190
+ // global store, per-account store, and message list get loaded
191
+ await tester.pumpAndSettle ();
192
+
193
+ final topicRow = find.descendant (
194
+ of: find.byType (ZulipAppBar ),
195
+ matching: find.text (topic));
196
+ await tester.longPress (topicRow);
197
+ // sheet appears onscreen; default duration of bottom-sheet enter animation
198
+ await tester.pump (const Duration (milliseconds: 250 ));
199
+ }
200
+
176
201
group ('showTopicActionSheet' , () {
177
202
void checkButtons () {
178
203
final actionSheetFinder = find.byType (BottomSheet );
@@ -200,20 +225,7 @@ void main() {
200
225
201
226
testWidgets ('show from app bar' , (tester) async {
202
227
await prepare ();
203
- connection.prepare (json: eg.newestGetMessagesResult (
204
- foundOldest: true , messages: [someMessage]).toJson ());
205
- await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
206
- child: MessageListPage (
207
- initNarrow: eg.topicNarrow (someChannel.streamId, someTopic))));
208
- // global store, per-account store, and message list get loaded
209
- await tester.pumpAndSettle ();
210
-
211
- final topicRow = find.descendant (
212
- of: find.byType (ZulipAppBar ),
213
- matching: find.text (someTopic));
214
- await tester.longPress (topicRow);
215
- // sheet appears onscreen; default duration of bottom-sheet enter animation
216
- await tester.pump (const Duration (milliseconds: 250 ));
228
+ await showFromAppBar (tester);
217
229
checkButtons ();
218
230
});
219
231
0 commit comments