From 42966299e79bda533dd19728060ca7be6c61e277 Mon Sep 17 00:00:00 2001 From: KaylaBrady <31781298+KaylaBrady@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:28:35 -0500 Subject: [PATCH] test(NearbyTransitView): wait in test for route to be found --- .../mbta_app/android/nearbyTransit/NearbyTransitViewTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/nearbyTransit/NearbyTransitViewTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/nearbyTransit/NearbyTransitViewTest.kt index 797f953aa..e8444534b 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/nearbyTransit/NearbyTransitViewTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/nearbyTransit/NearbyTransitViewTest.kt @@ -1,6 +1,8 @@ package com.mbta.tid.mbta_app.android.nearbyTransit +import androidx.compose.ui.test.ExperimentalTestApi import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.hasText import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText import com.mbta.tid.mbta_app.model.Coordinate @@ -229,6 +231,7 @@ class NearbyTransitViewTest : KoinTest { @get:Rule val composeTestRule = createComposeRule() + @OptIn(ExperimentalTestApi::class) @Test fun testNearbyTransitViewDisplaysCorrectly() { composeTestRule.setContent { @@ -245,6 +248,7 @@ class NearbyTransitViewTest : KoinTest { } composeTestRule.onNodeWithText("Nearby Transit").assertIsDisplayed() + composeTestRule.waitUntilExactlyOneExists(hasText("Sample Route")) composeTestRule.onNodeWithText("Sample Route").assertIsDisplayed() composeTestRule.onNodeWithText("Sample Headsign").assertIsDisplayed() composeTestRule.onNodeWithText("1 min").assertIsDisplayed()