Skip to content

[google_maps_flutter] Convert XCUITests to Swift#12208

Merged
auto-submit[bot] merged 4 commits into
flutter:mainfrom
stuartmorgan-g:maps-ios-ui-test-swift
Jul 16, 2026
Merged

[google_maps_flutter] Convert XCUITests to Swift#12208
auto-submit[bot] merged 4 commits into
flutter:mainfrom
stuartmorgan-g:maps-ios-ui-test-swift

Conversation

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Converts the XCUITest tests from Objective-C to Swift.

The conversion was done by Gemini, but I did a side-by-side skim to check that everything was in fact translated over.

I then discovered that the tests were all disabled, so to validate them I fixed and re-enabled the tests, which was trivial; it appears that at some point the semantics types of a few things we were looking for changed, presumably due to a Flutter SDK change, so they were no longer found. Changing the expected types (e.g., replacing staticTexts with buttons in a couple of places) made the tests pass.

Fixes flutter/flutter#154641
Part of flutter/flutter#119108

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

Converts the XCUITest tests from Objective-C to Swift.

The conversion was done by Gemini, but I did a side-by-side skim to
check that everything was in fact translated over.

I then discovered that the tests were all disabled, so to validate them
I fixed and re-enabled the tests, which was trivial; it appears that at
some point the semantics types of a few things we were looking for changed,
presumably due to a Flutter SDK change, so they were no longer found.
Changing the expected types (e.g., replacing `staticTexts` with
`buttons` in a couple of places) made the tests pass.

Fixes flutter/flutter#154641
Part of flutter/flutter#119108
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator Author

Since this is UI test code I mostly just focused my review of the Gemini translation on making sure it was doing the same testing, so the Swift itself could likely use some improvement.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request converts the iOS UI tests (GoogleMapsUITests) from Objective-C (.m) to Swift (.swift) across multiple Google Maps iOS packages, updating the corresponding Xcode project configurations. Feedback on the changes identifies a duplicated assertion on line 129 in the newly added Swift test files, where the southwest latitude is compared twice instead of validating the longitude.

XCTAssertEqual(originalNortheast.latitude, draggedNortheast.latitude)
XCTAssertEqual(originalNortheast.longitude, draggedNortheast.longitude)
XCTAssertEqual(originalSouthwest.latitude, draggedSouthwest.latitude)
XCTAssertEqual(originalSouthwest.latitude, draggedSouthwest.latitude)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The assertion on this line compares the latitude of the southwest coordinate again, duplicating the check on the previous line. It should compare the longitude instead to ensure the full coordinate is validated.

Suggested change
XCTAssertEqual(originalSouthwest.latitude, draggedSouthwest.latitude)
XCTAssertEqual(originalSouthwest.longitude, draggedSouthwest.longitude)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fun fact, that was in the original Obj-C too. Gemini clearly believed me when I said I wanted a direct translation :)

Fixed.

XCTAssertEqual(originalSouthwest.longitude, draggedSouthwest.longitude)
}

func validateVisibleRegion(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

uber nit: the objc translation feels a little bit too literal here (mostly because of the inout), I feel it would be a bit more idiomatic if it does the following:

func validateVisibleRegion(_ label: String) -> (northeast: CLLocationCoordinate2D, southwest: CLLocationCoordinate2D) 

and then

let (draggedNortheast, draggedSouthwest) = validateVisibleRegion(visibleRegionText.label)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Definitely; done.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 16, 2026
@auto-submit
auto-submit Bot merged commit 728fbd8 into flutter:main Jul 16, 2026
13 checks passed
auto-submit Bot pushed a commit that referenced this pull request Jul 16, 2026
#12208 re-enabled these tests using new semantics types, but it turns out that the semantics type had not only changed several years ago when the test was first disabled, but again since the last stable, so the PR failed in post-submit where we run platform tests against stable as well as master.

This adjusts the test to look for the problematic element as any type, so that the test works on both stable and master. Validated locally with stable, since presubmit won't test it.

Part of flutter/flutter#154641

## Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
pull Bot pushed a commit to safarmer/flutter that referenced this pull request Jul 17, 2026
…er#189659)

flutter/packages@9f95026...4fdc766

2026-07-17 [email protected] [pigeon] allow empty class
(flutter/packages#12181)
2026-07-16 [email protected] [material_ui,
cupertino_ui] Rename l10n macros (flutter/packages#12211)
2026-07-16 [email protected] [ci] Remove manual SwiftPM enabling
step (flutter/packages#12204)
2026-07-16 [email protected] [google_maps_flutter] Fix XCUITest on
stable (flutter/packages#12214)
2026-07-16 [email protected] [google_maps_flutter] Convert
XCUITests to Swift (flutter/packages#12208)
2026-07-16 [email protected] [material_ui] Rename the
remaining templates (flutter/packages#12210)
2026-07-15 [email protected] [material_ui,
cupertino_ui] Rename macro names to package names
(flutter/packages#12198)
2026-07-15 [email protected] [material_ui] Fix upstream localization
test (flutter/packages#12207)
2026-07-15 [email protected] [material_ui, cupertino_ui]
Localizations (flutter/packages#12119)
2026-07-15 [email protected] fix(ci): harden some workflows in packages
(flutter/packages#12178)
2026-07-15 [email protected] Roll Flutter from
846664b to fc1ad95 (18 revisions) (flutter/packages#12203)

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 [email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: google_maps_flutter platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_maps_flutter_ios] Failing native tests

2 participants