@@ -39,8 +39,7 @@ void main() {
39
39
40
40
await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
41
41
child: const Scaffold (body: Placeholder ())));
42
- // global store, per-account store get loaded
43
- await tester.pumpAndSettle ();
42
+ await tester.pump ();
44
43
context = tester.element (find.byType (Placeholder ));
45
44
}
46
45
@@ -52,8 +51,9 @@ void main() {
52
51
processedCount: 11 , updatedCount: 3 ,
53
52
firstProcessedId: null , lastProcessedId: null ,
54
53
foundOldest: true , foundNewest: true ).toJson ());
55
- markNarrowAsRead (context, narrow);
54
+ final future = markNarrowAsRead (context, narrow);
56
55
await tester.pump (Duration .zero);
56
+ await future;
57
57
final apiNarrow = narrow.apiEncode ()..add (ApiNarrowIs (IsOperand .unread));
58
58
check (connection.lastRequest).isA< http.Request > ()
59
59
..method.equals ('POST' )
@@ -76,8 +76,9 @@ void main() {
76
76
processedCount: 11 , updatedCount: 3 ,
77
77
firstProcessedId: null , lastProcessedId: null ,
78
78
foundOldest: true , foundNewest: true ).toJson ());
79
- markNarrowAsRead (context, narrow);
79
+ final future = markNarrowAsRead (context, narrow);
80
80
await tester.pump (Duration .zero);
81
+ await future;
81
82
check (connection.lastRequest).isA< http.Request > ()
82
83
..method.equals ('POST' )
83
84
..url.path.equals ('/api/v1/messages/flags/narrow' )
@@ -101,9 +102,9 @@ void main() {
101
102
processedCount: 11 , updatedCount: 3 ,
102
103
firstProcessedId: null , lastProcessedId: null ,
103
104
foundOldest: true , foundNewest: true ).toJson ());
104
- markNarrowAsRead (context, narrow);
105
+ final future = markNarrowAsRead (context, narrow);
105
106
await tester.pump (Duration .zero);
106
- await tester. pumpAndSettle () ;
107
+ await future ;
107
108
check (store.unreads.oldUnreadsMissing).isFalse ();
108
109
});
109
110
@@ -115,8 +116,9 @@ void main() {
115
116
116
117
connection.zulipFeatureLevel = 154 ;
117
118
connection.prepare (json: {});
118
- markNarrowAsRead (context, narrow);
119
+ final future = markNarrowAsRead (context, narrow);
119
120
await tester.pump (Duration .zero);
121
+ await future;
120
122
check (connection.lastRequest).isA< http.Request > ()
121
123
..method.equals ('POST' )
122
124
..url.path.equals ('/api/v1/mark_all_as_read' )
@@ -133,8 +135,9 @@ void main() {
133
135
await prepare (tester);
134
136
connection.zulipFeatureLevel = 154 ;
135
137
connection.prepare (json: {});
136
- markNarrowAsRead (context, narrow);
138
+ final future = markNarrowAsRead (context, narrow);
137
139
await tester.pump (Duration .zero);
140
+ await future;
138
141
check (connection.lastRequest).isA< http.Request > ()
139
142
..method.equals ('POST' )
140
143
..url.path.equals ('/api/v1/mark_stream_as_read' )
@@ -148,8 +151,9 @@ void main() {
148
151
await prepare (tester);
149
152
connection.zulipFeatureLevel = 154 ;
150
153
connection.prepare (json: {});
151
- markNarrowAsRead (context, narrow);
154
+ final future = markNarrowAsRead (context, narrow);
152
155
await tester.pump (Duration .zero);
156
+ await future;
153
157
check (connection.lastRequest).isA< http.Request > ()
154
158
..method.equals ('POST' )
155
159
..url.path.equals ('/api/v1/mark_topic_as_read' )
@@ -170,8 +174,9 @@ void main() {
170
174
connection.zulipFeatureLevel = 154 ;
171
175
connection.prepare (json:
172
176
UpdateMessageFlagsResult (messages: [message.id]).toJson ());
173
- markNarrowAsRead (context, narrow);
177
+ final future = markNarrowAsRead (context, narrow);
174
178
await tester.pump (Duration .zero);
179
+ await future;
175
180
check (connection.lastRequest).isA< http.Request > ()
176
181
..method.equals ('POST' )
177
182
..url.path.equals ('/api/v1/messages/flags' )
@@ -190,8 +195,9 @@ void main() {
190
195
connection.zulipFeatureLevel = 154 ;
191
196
connection.prepare (json:
192
197
UpdateMessageFlagsResult (messages: [message.id]).toJson ());
193
- markNarrowAsRead (context, narrow);
198
+ final future = markNarrowAsRead (context, narrow);
194
199
await tester.pump (Duration .zero);
200
+ await future;
195
201
check (connection.lastRequest).isA< http.Request > ()
196
202
..method.equals ('POST' )
197
203
..url.path.equals ('/api/v1/messages/flags' )
@@ -272,7 +278,7 @@ void main() {
272
278
processedCount: 20 , updatedCount: 10 ,
273
279
firstProcessedId: 2000 , lastProcessedId: 2023 ,
274
280
foundOldest: false , foundNewest: true ).toJson ());
275
- await tester.pumpAndSettle ( );
281
+ await tester.pump ( Duration .zero );
276
282
check (find.bySubtype <SnackBar >().evaluate ()).length.equals (1 );
277
283
check (connection.lastRequest).isA< http.Request > ()
278
284
..method.equals ('POST' )
@@ -310,8 +316,6 @@ void main() {
310
316
'op' : 'add' ,
311
317
'flag' : 'read' ,
312
318
});
313
-
314
- await tester.pumpAndSettle ();
315
319
checkErrorDialog (tester,
316
320
expectedTitle: onFailedTitle,
317
321
expectedMessage: zulipLocalizations.errorInvalidResponse);
@@ -323,7 +327,6 @@ void main() {
323
327
connection.prepare (exception: http.ClientException ('Oops' ));
324
328
final didPass = invokeUpdateMessageFlagsStartingFromAnchor ();
325
329
await tester.pump (Duration .zero);
326
- await tester.pumpAndSettle ();
327
330
checkErrorDialog (tester,
328
331
expectedTitle: onFailedTitle,
329
332
expectedMessage: 'NetworkException: Oops (ClientException: Oops)' );
0 commit comments