diff --git a/e2etests/web/regular_integration_tests/lib/image_loading_main.dart b/e2etests/web/regular_integration_tests/lib/image_loading_main.dart index 78991d9652e..be6dcca40f6 100644 --- a/e2etests/web/regular_integration_tests/lib/image_loading_main.dart +++ b/e2etests/web/regular_integration_tests/lib/image_loading_main.dart @@ -6,8 +6,9 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() async { + WidgetsFlutterBinding.ensureInitialized(); const MethodChannel channel = - OptionalMethodChannel('flutter/web_test_e2e', JSONMethodCodec()); + OptionalMethodChannel('flutter/web_test_e2e', JSONMethodCodec()); await channel.invokeMethod( 'setDevicePixelRatio', '1.5', @@ -26,7 +27,10 @@ class MyAppState extends State { return MaterialApp( key: const Key('mainapp'), title: 'Integration Test App', - home: Image.asset('assets/images/sample_image1.png') + home: Column(children: [ + Image.asset('assets/images/sample_image1.png'), + Image.network('assets/images/sample_image1.png'), + ]) ); } } diff --git a/e2etests/web/regular_integration_tests/test_driver/image_loading_integration.dart b/e2etests/web/regular_integration_tests/test_driver/image_loading_integration.dart index 2d87590b953..011976a8332 100644 --- a/e2etests/web/regular_integration_tests/test_driver/image_loading_integration.dart +++ b/e2etests/web/regular_integration_tests/test_driver/image_loading_integration.dart @@ -15,10 +15,12 @@ void main() { (WidgetTester tester) async { app.main(); await tester.pumpAndSettle(); - final html.ImageElement imageElement = html.querySelector('img') as html.ImageElement; - expect(imageElement.naturalWidth, 1.5 * 100); - expect(imageElement.naturalHeight, 1.5 * 100); - expect(imageElement.width, 100); - expect(imageElement.height, 100); + final List imageElements = html.querySelectorAll('img'); + expect(imageElements.length, 2); + expect(imageElements[0].naturalWidth, 1.5 * 100); + expect(imageElements[0].naturalHeight, 1.5 * 100); + expect(imageElements[0].width, 100); + expect(imageElements[0].height, 100); + expect(imageElements[1].width, isNot(0)); }); }