Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Fix some web-platform_tests. #3285

Merged
merged 5 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .cirrus.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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