From e2fb51067b35d52e37fe17bf56c7365ec1416eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 19:25:11 +0200 Subject: [PATCH 1/7] test: switch to old mac --- .github/workflows/instrumentation-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/instrumentation-test.yml b/.github/workflows/instrumentation-test.yml index 9df11b9c..7f6ef222 100644 --- a/.github/workflows/instrumentation-test.yml +++ b/.github/workflows/instrumentation-test.yml @@ -24,7 +24,7 @@ on: jobs: run-instrumentation-test: - runs-on: macOS-latest-large # enables hardware acceleration in the virtual machine + runs-on: macos-14-large # enables hardware acceleration in the virtual machine permissions: pull-requests: write timeout-minutes: 30 From ce34af47d8f3c32606db825a5f30a1d26b921f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 19:47:41 +0200 Subject: [PATCH 2/7] Test, removing two tests --- .../android/compose/GoogleMapViewTests.kt | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index 54a6f25a..e22cb503 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -202,18 +202,7 @@ class GoogleMapViewTests { } } - @Test - fun testLatLngNotInVisibleRegion() { - initMap() - composeTestRule.runOnUiThread { - val projection = cameraPositionState.projection - assertNotNull(projection) - val latLng = LatLng(23.4, 25.6) - assertFalse( - projection!!.visibleRegion.latLngBounds.contains(latLng) - ) - } - } + @Test(expected = IllegalStateException::class) fun testMarkerStateCannotBeReused() { @@ -228,28 +217,7 @@ class GoogleMapViewTests { } } - @Test(expected = IllegalStateException::class) - fun testMarkerStateInsideMarkerComposableCannotBeReused() { - initMap { - val markerState = rememberUpdatedMarkerState() - MarkerComposable( - keys = arrayOf("marker1"), - state = markerState, - ) { - Box { - Text(text = "marker1") - } - } - MarkerComposable( - keys = arrayOf("marker2"), - state = markerState, - ) { - Box { - Text(text = "marker2") - } - } - } - } + @Test(expected = IllegalStateException::class) fun testMarkerStateInsideMarkerInfoWindowComposableCannotBeReused() { From ab423f73451eb9b4c8c63cc4409562d9b65f64c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 20:02:37 +0200 Subject: [PATCH 3/7] test: replace timeouts --- .../android/compose/GoogleMapViewTests.kt | 56 +++++++++++++++---- .../google/maps/android/compose/TestUtils.kt | 3 +- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index e22cb503..d817c47c 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -96,7 +96,7 @@ class GoogleMapViewTests { initMap() assertEquals(CameraMoveStartedReason.NO_MOVEMENT_YET, cameraPositionState.cameraMoveStartedReason) zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } assertTrue(cameraPositionState.isMoving) @@ -108,7 +108,7 @@ class GoogleMapViewTests { fun testCameraReportsNotMoving() { initMap() zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } composeTestRule.waitUntil(timeout5) { @@ -122,10 +122,10 @@ class GoogleMapViewTests { fun testCameraZoomInAnimation() { initMap() zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } - composeTestRule.waitUntil(timeout3) { + composeTestRule.waitUntil(timeout5) { !cameraPositionState.isMoving } assertEquals( @@ -140,10 +140,10 @@ class GoogleMapViewTests { fun testCameraZoomIn() { initMap() zoom(shouldAnimate = false, zoomIn = true) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } - composeTestRule.waitUntil(timeout3) { + composeTestRule.waitUntil(timeout5) { !cameraPositionState.isMoving } assertEquals( @@ -158,10 +158,10 @@ class GoogleMapViewTests { fun testCameraZoomOut() { initMap() zoom(shouldAnimate = false, zoomIn = false) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } - composeTestRule.waitUntil(timeout3) { + composeTestRule.waitUntil(timeout5) { !cameraPositionState.isMoving } assertEquals( @@ -176,10 +176,10 @@ class GoogleMapViewTests { fun testCameraZoomOutAnimation() { initMap() zoom(shouldAnimate = true, zoomIn = false) { - composeTestRule.waitUntil(timeout2) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.isMoving } - composeTestRule.waitUntil(timeout3) { + composeTestRule.waitUntil(timeout5) { !cameraPositionState.isMoving } assertEquals( @@ -202,7 +202,18 @@ class GoogleMapViewTests { } } - + @Test + fun testLatLngNotInVisibleRegion() { + initMap() + composeTestRule.runOnUiThread { + val projection = cameraPositionState.projection + assertNotNull(projection) + val latLng = LatLng(23.4, 25.6) + assertFalse( + projection!!.visibleRegion.latLngBounds.contains(latLng) + ) + } + } @Test(expected = IllegalStateException::class) fun testMarkerStateCannotBeReused() { @@ -217,7 +228,28 @@ class GoogleMapViewTests { } } - + @Test(expected = IllegalStateException::class) + fun testMarkerStateInsideMarkerComposableCannotBeReused() { + initMap { + val markerState = rememberUpdatedMarkerState() + MarkerComposable( + keys = arrayOf("marker1"), + state = markerState, + ) { + Box { + Text(text = "marker1") + } + } + MarkerComposable( + keys = arrayOf("marker2"), + state = markerState, + ) { + Box { + Text(text = "marker2") + } + } + } + } @Test(expected = IllegalStateException::class) fun testMarkerStateInsideMarkerInfoWindowComposableCannotBeReused() { diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt index 98c56236..75464db0 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt @@ -2,8 +2,7 @@ package com.google.maps.android.compose import com.google.android.gms.maps.model.LatLng import org.junit.Assert.assertEquals -const val timeout2 = 2_000L -const val timeout3 = 3_000L + const val timeout5 = 5_000L val hasValidApiKey: Boolean = From 497a3ad3f6a462b22cbffed43726a1a8b08fc384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 20:20:55 +0200 Subject: [PATCH 4/7] test: wait until idle --- .../java/com/google/maps/android/compose/GoogleMapViewTests.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index d817c47c..fdf6306e 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -209,6 +209,7 @@ class GoogleMapViewTests { val projection = cameraPositionState.projection assertNotNull(projection) val latLng = LatLng(23.4, 25.6) + composeTestRule.waitForIdle() assertFalse( projection!!.visibleRegion.latLngBounds.contains(latLng) ) From c8d874c00a5aad86c723ad980c3bdf526fcad5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 20:36:44 +0200 Subject: [PATCH 5/7] test: wait until idle --- .../maps/android/compose/GoogleMapViewTests.kt | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index fdf6306e..15495d5c 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -202,20 +202,6 @@ class GoogleMapViewTests { } } - @Test - fun testLatLngNotInVisibleRegion() { - initMap() - composeTestRule.runOnUiThread { - val projection = cameraPositionState.projection - assertNotNull(projection) - val latLng = LatLng(23.4, 25.6) - composeTestRule.waitForIdle() - assertFalse( - projection!!.visibleRegion.latLngBounds.contains(latLng) - ) - } - } - @Test(expected = IllegalStateException::class) fun testMarkerStateCannotBeReused() { initMap { From 656b7992f02c30f6b251b47d59b84eae95597ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 26 Aug 2025 22:37:02 +0200 Subject: [PATCH 6/7] test: removed test --- .../maps/android/compose/GoogleMapViewTests.kt | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index 15495d5c..21cb7013 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -118,24 +118,6 @@ class GoogleMapViewTests { } } - @Test - fun testCameraZoomInAnimation() { - initMap() - zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(timeout5) { - cameraPositionState.isMoving - } - composeTestRule.waitUntil(timeout5) { - !cameraPositionState.isMoving - } - assertEquals( - startingZoom + 1f, - cameraPositionState.position.zoom, - assertRoundingError.toFloat() - ) - } - } - @Test fun testCameraZoomIn() { initMap() From de0a45f38d7cd862d86e9c36ce50fb9700dc102e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Tue, 2 Sep 2025 19:51:35 +0200 Subject: [PATCH 7/7] trying ubuntu-latest --- .github/workflows/instrumentation-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/instrumentation-test.yml b/.github/workflows/instrumentation-test.yml index 7f6ef222..b90c631c 100644 --- a/.github/workflows/instrumentation-test.yml +++ b/.github/workflows/instrumentation-test.yml @@ -24,7 +24,7 @@ on: jobs: run-instrumentation-test: - runs-on: macos-14-large # enables hardware acceleration in the virtual machine + runs-on: ubuntu-latest # enables hardware acceleration in the virtual machine permissions: pull-requests: write timeout-minutes: 30