test(block2): stop market discover tests hanging on the searching spinner
The 'searching' state shows a CircularProgressIndicator, so pumpAndSettle never settled and the widget test hung ~10 min. Pump a couple of fixed frames instead (the buffered offers deliver on a microtask), and close the fake discover stream so it's finite. Reported by the user.
This commit is contained in:
parent
c513a6ce4b
commit
46b5537a11
1 changed files with 9 additions and 2 deletions
|
|
@ -39,6 +39,7 @@ class FakeOfferTransport implements OfferTransport {
|
|||
for (final o in offers) {
|
||||
if (o.approxGeohash.startsWith(query.geohashPrefix)) c.add(o);
|
||||
}
|
||||
unawaited(c.close()); // finite: deliver buffered matches, then done
|
||||
return c.stream;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +92,10 @@ void main() {
|
|||
]));
|
||||
await tester.pumpWidget(_wrapBody(cubit, selfPubkey: me));
|
||||
await cubit.discover('sp3');
|
||||
await tester.pumpAndSettle();
|
||||
// Pump a couple of frames (NOT pumpAndSettle — the brief "searching" spinner
|
||||
// never settles). The buffered offers deliver on a microtask.
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('You'), findsOneWidget);
|
||||
// My own listing offers no "Message yourself" button.
|
||||
|
|
@ -108,7 +112,10 @@ void main() {
|
|||
|
||||
await tester.pumpWidget(_wrapBody(cubit));
|
||||
await cubit.discover('sp3');
|
||||
await tester.pumpAndSettle();
|
||||
// Pump a couple of frames (NOT pumpAndSettle — the brief "searching" spinner
|
||||
// never settles). The buffered offers deliver on a microtask.
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Tomate rosa de Barbastro'), findsOneWidget);
|
||||
expect(find.text('Judía del ganxet'), findsOneWidget);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue