[google_maps_flutter] Convert XCUITests to Swift#12208
Conversation
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
|
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. |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| XCTAssertEqual(originalSouthwest.latitude, draggedSouthwest.latitude) | |
| XCTAssertEqual(originalSouthwest.longitude, draggedSouthwest.longitude) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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)There was a problem hiding this comment.
Definitely; done.
#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.
…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
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
staticTextswithbuttonsin a couple of places) made the tests pass.Fixes flutter/flutter#154641
Part of flutter/flutter#119108
Pre-Review Checklist
[shared_preferences]///).Footnotes
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