🐛 Bug Report
According to the documentation, an http call during widgets test will fail with a 400 status code.
So why the code below never displays the errorWidget ? However it displays the progressWidget and gets stuck there.
testWidgets('Cached networked image 400', (tester) async {
final widget = CachedNetworkImage(
imageBuilder: (
context,
url,
) =>
Container(
key: Key('image'),
),
progressIndicatorBuilder: (context, url, progress) => Container(
key: Key('progress'),
),
errorWidget: (context, url, error) => Container(
key: Key('failed'),
),
imageUrl: 'https://example.com/image.png',
);
await tester.pumpWidget(
MediaQuery(
data: MediaQueryData(),
child: MaterialApp(
home: widget,
),
),
);
await tester.pumpAndSettle();
expect(find.byKey(Key('progress')), findsOneWidget); // this should be findsNothing but why does it pass here?
expect(find.byKey(Key('failed')), findsOneWidget);
expect(find.byKey(Key('image')), findsNothing);
I am getting:
Expected: exactly one matching node in the widget tree
Actual: _KeyFinder:<zero widgets with key [<'failed'>] (ignoring offstage widgets)>
The plugin: https://pub.dev/packages/cached_network_image
Expected behavior
Progress Widget should not display anymore
Image Widget should not display
Failed Widget should display
Reproduction steps
Just run the above code in test.
Configuration
Version: 2.2.0+1
Platform:
🐛 Bug Report
According to the documentation, an http call during widgets test will fail with a 400 status code.
So why the code below never displays the errorWidget ? However it displays the progressWidget and gets stuck there.
I am getting:
The plugin: https://pub.dev/packages/cached_network_image
Expected behavior
Progress Widget should not display anymore
Image Widget should not display
Failed Widget should display
Reproduction steps
Just run the above code in test.
Configuration
Version: 2.2.0+1
Platform: