Skip to content

test: use the v2 Compose test rules in the maps-app instrumentation tests - #1069

Open
kikoso wants to merge 1 commit into
mainfrom
test/compose-test-v2-api
Open

kikoso wants to merge 1 commit into
mainfrom
test/compose-test-v2-api

Conversation

@kikoso

@kikoso kikoso commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

createComposeRule and createAndroidComposeRule from androidx.compose.ui.test.junit4 are deprecated in favour of the androidx.compose.ui.test.junit4.v2 versions. The v2 rules run coroutines on StandardTestDispatcher instead of UnconfinedTestDispatcher, so work is queued instead of running immediately, the same as a real dispatcher. This switches the nine instrumentation test files that still used the old rules; ScaleBarRenderingTests (Robolectric) and ScaleBarDeviceRenderingTests already used v2.

Only imports change: GoogleMapFocusTraversalTests, GoogleMapViewClusteringTests, GoogleMapViewTests, MapInColumnTests, MapsInLazyColumnTest, RecompositionActivityTests, ScaleBarTests, StreetViewTests and smoke/DemoMenuNavigationTest. No test needed extra synchronization.

Testing

  • maps-app instrumentation tests compile with no deprecation warnings left for the test rules.
  • Full :maps-app:connectedDebugAndroidTest with requireMapLoaded=true on a Pixel 4 (Android 13): every migrated class passes, including the 28 GoogleMapViewTests. The only failure was DemoAppSmokeTest for MapsInLazyColumnActivity, which does not use the Compose test rule and is not touched here.
  • The same run on an API 36 emulator is not conclusive: the emulator lost network halfway (Unable to resolve host "maps.googleapis.com"), so most map tests failed waiting for the map. CI runs both emulator suites on this PR.

…ests

createComposeRule and createAndroidComposeRule from androidx.compose.ui.test.junit4 are deprecated in favour of the v2 versions, which run coroutines on StandardTestDispatcher. The Robolectric and device ScaleBar rendering tests already use v2.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 174f0fd on main (#1060).

Module Line % Change Branch % Change
maps-compose 15.28% no change 3.76% no change
maps-compose-utils 6.09% no change 4.47% no change
maps-compose-widgets 10.88% no change 11.11% no change
TOTAL 12.99% no change 4.12% no change

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 43.68% 🍏

There is no coverage information present for the Files changed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants