Skip to content

Commit

Permalink
[ci] Fix some web-platform_tests. (flutter#3285)
Browse files Browse the repository at this point in the history
[ci] Fix some web-platform_tests.
  • Loading branch information
ditman authored and navaronbracke committed Mar 3, 2023
1 parent 50afcc1 commit 02bd776
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 25 deletions.
8 changes: 1 addition & 7 deletions .cirrus.yml
Expand Up @@ -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:
Expand Down
Expand Up @@ -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(<Type>[], customMocks: <MockSpec<dynamic>>[
MockSpec<CirclesController>(onMissingStub: OnMissingStub.returnDefault),
MockSpec<PolygonsController>(onMissingStub: OnMissingStub.returnDefault),
Expand Down Expand Up @@ -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', () {
Expand Down
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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();
});
});
}
Expand Down

0 comments on commit 02bd776

Please sign in to comment.