From 8881419c29f4795363bc96317a99d958653435bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20L=C3=B3pez-Manas?= Date: Wed, 11 Oct 2023 08:56:28 +0200 Subject: [PATCH] chore: increased timeout times --- .../android/compose/GoogleMapViewTests.kt | 22 +++++++++---------- .../maps/android/compose/StreetViewTests.kt | 2 +- .../google/maps/android/compose/TestUtils.kt | 3 +++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index 117d991a..707db2ae 100644 --- a/app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -80,7 +80,7 @@ class GoogleMapViewTests { initMap() assertEquals(CameraMoveStartedReason.NO_MOVEMENT_YET, cameraPositionState.cameraMoveStartedReason) zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } assertTrue(cameraPositionState.isMoving) @@ -92,10 +92,10 @@ class GoogleMapViewTests { fun testCameraReportsNotMoving() { initMap() zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } - composeTestRule.waitUntil(5000) { + composeTestRule.waitUntil(timeout5) { !cameraPositionState.isMoving } assertFalse(cameraPositionState.isMoving) @@ -106,10 +106,10 @@ class GoogleMapViewTests { fun testCameraZoomInAnimation() { initMap() zoom(shouldAnimate = true, zoomIn = true) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } - composeTestRule.waitUntil(3000) { + composeTestRule.waitUntil(timeout3) { !cameraPositionState.isMoving } assertEquals( @@ -124,10 +124,10 @@ class GoogleMapViewTests { fun testCameraZoomIn() { initMap() zoom(shouldAnimate = false, zoomIn = true) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } - composeTestRule.waitUntil(3000) { + composeTestRule.waitUntil(timeout3) { !cameraPositionState.isMoving } assertEquals( @@ -142,10 +142,10 @@ class GoogleMapViewTests { fun testCameraZoomOut() { initMap() zoom(shouldAnimate = false, zoomIn = false) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } - composeTestRule.waitUntil(3000) { + composeTestRule.waitUntil(timeout3) { !cameraPositionState.isMoving } assertEquals( @@ -160,10 +160,10 @@ class GoogleMapViewTests { fun testCameraZoomOutAnimation() { initMap() zoom(shouldAnimate = true, zoomIn = false) { - composeTestRule.waitUntil(1000) { + composeTestRule.waitUntil(timeout2) { cameraPositionState.isMoving } - composeTestRule.waitUntil(3000) { + composeTestRule.waitUntil(timeout3) { !cameraPositionState.isMoving } assertEquals( diff --git a/app/src/androidTest/java/com/google/maps/android/compose/StreetViewTests.kt b/app/src/androidTest/java/com/google/maps/android/compose/StreetViewTests.kt index 9c575c69..2f73f800 100644 --- a/app/src/androidTest/java/com/google/maps/android/compose/StreetViewTests.kt +++ b/app/src/androidTest/java/com/google/maps/android/compose/StreetViewTests.kt @@ -38,7 +38,7 @@ class StreetViewTests { onClick = onClick ) } - composeTestRule.waitUntil(10000) { + composeTestRule.waitUntil(timeout5) { cameraPositionState.location.position.latitude != 0.0 && cameraPositionState.location.position.longitude != 0.0 } diff --git a/app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt b/app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt index c8eb5cad..fcb969ee 100644 --- a/app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt +++ b/app/src/androidTest/java/com/google/maps/android/compose/TestUtils.kt @@ -3,6 +3,9 @@ package com.google.maps.android.compose import com.google.android.gms.maps.model.LatLng import org.junit.Assert.assertEquals import org.junit.Assert.assertNotEquals +const val timeout2 = 2_000L +const val timeout3 = 3_000L +const val timeout5 = 5_000L val hasValidApiKey: Boolean = BuildConfig.MAPS_API_KEY.isNotBlank() && BuildConfig.MAPS_API_KEY != "YOUR_API_KEY"