Skip to content

[google_maps] Prepares packages to endorse web. #4064

New issue

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

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

Already on GitHub? # to your account

Merged
merged 23 commits into from
May 31, 2023

Conversation

ditman
Copy link
Member

@ditman ditman commented May 23, 2023

Prepares the google_maps packages to endorse the Web platform:

  • [google_maps_flutter] Changes example/integration_test to run in the web.
    • Splits the only file there in 3 for them to be slightly more manageable.
    • (Does not require publishing)
  • [google_maps_flutter_platform_interface] Adds a test coming from the core plugin to the unit tests of this package.
    • (Does not require publishing)
  • [google_maps_flutter_web] Changes to add an "inspector" object, and to conform with the tests in the core package.
    • Implements a GoogleMapsInspectorPlatform to allow integration tests to inspect parts of the internal state of a gmap.
    • Fires a MapStyleException when an invalid JSON is used in setMapStyle (was FormatException previously), to conform with the expected behavior in the core plugin tests.
    • (Requires publishing)

Issues

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ditman
Copy link
Member Author

ditman commented May 23, 2023

I thought of renaming the files midway through, and the commits ended up being a little bit sloppy.

This is what an average "fix" of the core test looks like: 31d51ca

Maps on the web need a little bit more scaffolding to render than on mobile, apparently.

@ditman
Copy link
Member Author

ditman commented May 23, 2023

Testing example/integration_test/tiles_inspector_test.dart...
Running command: "/tmp/cirrus-ci-build/packages/google_maps_flutter/google_maps_flutter/example/android/gradlew app:assembleDebug -Pverbose=true -Ptarget=/tmp/cirrus-ci-build/packages/google_maps_flutter/google_maps_flutter/example/integration_test/tiles_inspector_test.dart" in /tmp/cirrus-ci-build/packages/google_maps_flutter/google_maps_flutter/example/android

This mean that for each file that we have in integration_test, we create a new FTL run, so I might need to re-unify the test file (ggghghghhhaaagh)

@ditman

This comment was marked as resolved.

@ditman ditman changed the title [google_maps] Prepare packages to endorse web. [google_maps] Prepares packages to endorse web. May 24, 2023
@ditman
Copy link
Member Author

ditman commented May 24, 2023

All that would be needed to endorse the web package after landing this PR is something like this:

23f2c5e...ditman:flutter-packages:maps_endorse_web

@stuartmorgan-g
Copy link
Contributor

All that would be needed to endorse the web package after landing this PR is something like this:

23f2c5e...ditman:flutter-packages:maps_endorse_web

We'll want to remember to update the web package's README to say it's endorsed when we do that. IIRC the tooling will let us do it in the same PR since it's not changing Dart code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming there are no changes as part of the move, so these "new" files don't need review?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only changes there were added to make the map render in the web. The scaffolding around the map widgets in this test wasn't enough for the web implementation of the map to actually render.

@ditman ditman requested a review from stuartmorgan-g May 25, 2023 02:56
@ditman
Copy link
Member Author

ditman commented May 25, 2023

Thanks for the review @stuartmorgan!

  • I've used the "ConfigurationProvider" trick you suggested so I don't have to punch so many holes into the currently existing objects. This has greatly simplified the actual implementation bits!
  • I've also versioned the _web change as major because of the change in the Exception thrown by the setConfiguration method.

I'm assuming there are no changes as part of the move, so these "new" files don't need review?

Actually, I did some changes so the tests could run on the web. Highlights:

  • Stop using dart:io Platform and use defaultTargetPlatform, like so.
  • Change the scaffolding of the Map widget for it to render on the web, like in this commit.
    • (The minimal code currently in the integration tests doesn't work on the web)
  • Used isWeb to opt-in to some of the tests like here, or opt-out when a feature is not supported, like here.

No expect calls/checks were tweaked in this PR, however.

I also moved this test from the core plugin to the platform interface package (it didn't make much sense in the core plugin.)

@ditman
Copy link
Member Author

ditman commented May 25, 2023

QQ @stuartmorgan. Each integration_test/*_test.dart file in the core package triggers an FTL run when running for android. Given how FTL some times flakes on our CI, should I un-split the test files so there's only one FTL run when testing this package to minimize the number of consecutive FTL runs?

@ditman ditman force-pushed the maps_web_inspection_channel branch from b2f84b5 to 128f46d Compare May 26, 2023 21:47
@stuartmorgan-g
Copy link
Contributor

QQ @stuartmorgan. Each integration_test/*_test.dart file in the core package triggers an FTL run when running for android. Given how FTL some times flakes on our CI, should I un-split the test files so there's only one FTL run when testing this package to minimize the number of consecutive FTL runs?

Oh right, I forgot about that. I'm not worried about increasing flake since the tooling currently reruns a failing FTL run, so this would potentially help in that regard, but it does look like this just makes the test way slower overall, so we should recombine them for now. Maybe we can revisit once we have emulator tests, where I don't think we'll have to do that.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo recombining the tests.

// Caching this allows us to re-create the map faithfully when needed.
MapConfiguration _lastMapConfiguration = const MapConfiguration();
List<gmaps.MapTypeStyle> _lastStyles = const <gmaps.MapTypeStyle>[];

/// Configuration accessor for integration tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, nit: missing period.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I push this? dart-archive/linter#3820 :P

@ditman
Copy link
Member Author

ditman commented May 30, 2023

Will recombine the tests and land this after CI is happy. Thanks!

@ditman ditman force-pushed the maps_web_inspection_channel branch from 128f46d to 9cde458 Compare May 31, 2023 00:14
@ditman ditman added the override: no changelog needed Override the check requiring CHANGELOG updates for most changes label May 31, 2023
@ditman
Copy link
Member Author

ditman commented May 31, 2023

I think the repo_checks is tripping by the lack of CHANGELOG in the gogle_maps_flutter package, but all the changes happened in google_maps/example/integration_test.

(Added override: no changelog needed label (FYI @stuartmorgan))

@ditman ditman added the autosubmit Merge PR when tree becomes green via auto submit App label May 31, 2023
@auto-submit auto-submit bot merged commit 95bb793 into flutter:main May 31, 2023
@ditman ditman deleted the maps_web_inspection_channel branch May 31, 2023 01:34
@stuartmorgan-g
Copy link
Contributor

It's the run_test.sh script; that's not a standard thing so the tooling doesn't know to exclude it.

Having a generically named script in the main package that's actually web-only isn't ideal; I didn't notice that before. We should rename and comment-document it in the second PR.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 31, 2023
flutter/packages@c85111c...95bb793

2023-05-31 ditman@gmail.com [google_maps] Prepares packages to endorse web. (flutter/packages#4064)
2023-05-30 ditman@gmail.com [google_sign_in] Clarifies canAccessScopes docs. (flutter/packages#4092)
2023-05-30 35989475+MeandNi@users.noreply.github.com [flutter_markdown] Unable to use MarkdownElementBuilder to act those tags without children. (flutter/packages#3952)
2023-05-30 49699333+dependabot[bot]@users.noreply.github.com [local_auth]: Bump androidx.fragment:fragment from 1.5.5 to 1.5.6 in /packages/local_auth/local_auth_android/android (flutter/packages#3553)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@ditman
Copy link
Member Author

ditman commented Jun 1, 2023

We should rename and comment-document it in the second PR.

I have a bunch of those scripts in several other packages, I'll rename them all, so they're all called run_web_integration_test.sh or similar.

(Maybe it's time to use the standard script runner though)

@ditman
Copy link
Member Author

ditman commented Jun 1, 2023

It's the run_test.sh script; that's not a standard thing so the tooling doesn't know to exclude it.

I ended up removing the bespoke scripts, here: #4129 (now they live in my ~/bin)

(If anybody ever other than me needs them, we can figure out a way to bring them back more properly).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App override: no changelog needed Override the check requiring CHANGELOG updates for most changes p: google_maps_flutter platform-web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants