From 2e04050cacc102d368e4efba1bd7eacaa0ad2645 Mon Sep 17 00:00:00 2001 From: David Iglesias Date: Fri, 24 Feb 2023 16:58:06 -0800 Subject: [PATCH] [ci] Fix some web-platform_tests. (#3285) [ci] Fix some web-platform_tests. --- .cirrus.yml | 8 +---- .../google_maps_controller_test.dart | 19 +----------- .../integration_test/projection_test.dart | 29 +++++++++++++++++++ .../integration_test/link_widget_test.dart | 16 ++++++++++ 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ad467b719060..e446ee160323 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -318,13 +318,7 @@ task: build_script: - ./script/tool_runner.sh build-examples --web drive_script: - # TODO(stuartmorgan): Figure out why url_launcher_web is failing on stable and re-enable it: - # https://github.com/flutter/flutter/issues/121161 - - if [[ "$CHANNEL" == "master" ]]; then - - ./script/tool_runner.sh drive-examples --web --exclude=script/configs/exclude_integration_web.yaml - - else - - ./script/tool_runner.sh drive-examples --web --exclude=script/configs/exclude_integration_web.yaml,url_launcher_web - - fi + - ./script/tool_runner.sh drive-examples --web --exclude=script/configs/exclude_integration_web.yaml - name: web_benchmarks_test env: matrix: diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart index 0226234ea97a..8889e4ba9577 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart @@ -16,10 +16,6 @@ import 'package:mockito/mockito.dart'; import 'google_maps_controller_test.mocks.dart'; -// This value is used when comparing long~num, like -// LatLng values. -const double _acceptableDelta = 0.0000000001; - @GenerateMocks([], customMocks: >[ MockSpec(onMissingStub: OnMissingStub.returnDefault), MockSpec(onMissingStub: OnMissingStub.returnDefault), @@ -548,20 +544,7 @@ void main() { }); group('moveCamera', () { - testWidgets('newLatLngZoom', (WidgetTester tester) async { - await controller.moveCamera( - CameraUpdate.newLatLngZoom( - const LatLng(19, 26), - 12, - ), - ); - - final gmaps.LatLng gmCenter = map.center!; - - expect(map.zoom, 12); - expect(gmCenter.lat, closeTo(19, _acceptableDelta)); - expect(gmCenter.lng, closeTo(26, _acceptableDelta)); - }); + // Tested in projection_test.dart }); group('map.projection methods', () { diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart index a595a94655de..481caa72ccdd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/integration_test/projection_test.dart @@ -45,6 +45,35 @@ void main() { }; }); + group('moveCamera', () { + testWidgets('center can be moved with newLatLngZoom', + (WidgetTester tester) async { + await pumpCenteredMap( + tester, + initialCamera: initialCamera, + size: size, + onMapCreated: onMapCreated, + ); + + final GoogleMapController controller = await controllerCompleter.future; + + await controller.moveCamera( + CameraUpdate.newLatLngZoom( + const LatLng(19, 26), + 12, + ), + ); + + final LatLng coords = await controller.getLatLng( + ScreenCoordinate(x: size.width ~/ 2, y: size.height ~/ 2), + ); + + expect(await controller.getZoomLevel(), 12); + expect(coords.latitude, closeTo(19, _acceptableLatLngDelta)); + expect(coords.longitude, closeTo(26, _acceptableLatLngDelta)); + }); + }); + group('getScreenCoordinate', () { testWidgets('target of map is in center of widget', (WidgetTester tester) async { diff --git a/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart b/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart index 5f4239ab0ba9..6ad19a445eaf 100644 --- a/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart +++ b/packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart @@ -71,6 +71,10 @@ void main() { expect(anchor.getAttribute('href'), urlStrategy?.prepareExternalUrl(uri3.toString())); expect(anchor.getAttribute('target'), '_self'); + + // Needed when testing on on Chrome98 headless in CI. + // See https://github.com/flutter/flutter/issues/121161 + await tester.pumpAndSettle(); }); testWidgets('sizes itself correctly', (WidgetTester tester) async { @@ -103,6 +107,10 @@ void main() { // `ConstrainedBox` widget. expect(containerSize.width, 100.0); expect(containerSize.height, 100.0); + + // Needed when testing on on Chrome98 headless in CI. + // See https://github.com/flutter/flutter/issues/121161 + await tester.pumpAndSettle(); }); // See: https://github.com/flutter/plugins/pull/3522#discussion_r574703724 @@ -122,6 +130,10 @@ void main() { final html.Element anchor = _findSingleAnchor(); expect(anchor.hasAttribute('href'), false); + + // Needed when testing on on Chrome98 headless in CI. + // See https://github.com/flutter/flutter/issues/121161 + await tester.pumpAndSettle(); }); testWidgets('can be created and disposed', (WidgetTester tester) async { @@ -152,6 +164,10 @@ void main() { 800, maxScrolls: 1000, ); + + // Needed when testing on on Chrome98 headless in CI. + // See https://github.com/flutter/flutter/issues/121161 + await tester.pumpAndSettle(); }); }); }