diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/more/MoreViewModelTests.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/more/MoreViewModelTests.kt index 91874dc9a..dfc452d0e 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/more/MoreViewModelTests.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/more/MoreViewModelTests.kt @@ -33,6 +33,7 @@ class MoreViewModelTests { composeTestRule.awaitIdle() vm!!.toggleSetting(Settings.HideMaps) composeTestRule.awaitIdle() + composeTestRule.waitUntil { toggledHideMaps } assertTrue { toggledHideMaps } } diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/pages/MorePageTests.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/pages/MorePageTests.kt index 80e962ab3..0bce4f300 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/pages/MorePageTests.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/pages/MorePageTests.kt @@ -1,5 +1,6 @@ package com.mbta.tid.mbta_app.android.pages +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 @@ -56,10 +57,12 @@ class MorePageTests : KoinTest { composeTestRule.onNodeWithText("Hide Maps").performClick() composeTestRule.awaitIdle() + composeTestRule.waitUntil { hideMapToggleCalled } assertTrue { hideMapToggleCalled } } + @OptIn(ExperimentalTestApi::class) @Test fun testLinksExist() { val koinApplication = koinApplication { @@ -73,11 +76,15 @@ class MorePageTests : KoinTest { KoinContext(koinApplication.koin) { MorePage(bottomBar = {}) } } + composeTestRule.waitUntilExactlyOneExists(hasText("Send app feedback")) composeTestRule.onNodeWithText("Send app feedback").assertIsDisplayed() composeTestRule.onNodeWithText("Trip Planner").assertIsDisplayed() composeTestRule.onNodeWithText("Fare Information").assertIsDisplayed() + composeTestRule.onNodeWithText("Commuter Rail and Ferry tickets").performScrollTo() composeTestRule.onNodeWithText("Commuter Rail and Ferry tickets").assertIsDisplayed() + composeTestRule.onNodeWithText("Terms of Use").performScrollTo() composeTestRule.onNodeWithText("Terms of Use").assertIsDisplayed() + composeTestRule.onNodeWithText("Privacy Policy").performScrollTo() composeTestRule.onNodeWithText("Privacy Policy").assertIsDisplayed() composeTestRule.onNode(hasText("View source on GitHub")).performScrollTo() composeTestRule.onNodeWithText("View source on GitHub").assertIsDisplayed() diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetGlobalDataTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetGlobalDataTest.kt index a9c035c80..5b2a49661 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetGlobalDataTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetGlobalDataTest.kt @@ -46,6 +46,7 @@ class GetGlobalDataTest { requestSync.send(Unit) composeTestRule.awaitIdle() + composeTestRule.waitUntil { globalData == actualData } assertEquals(globalData, actualData) } } diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetRailRouteShapesTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetRailRouteShapesTest.kt index df2f196e7..03859c943 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetRailRouteShapesTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetRailRouteShapesTest.kt @@ -57,6 +57,7 @@ class GetRailRouteShapesTest { } composeTestRule.awaitIdle() + composeTestRule.waitUntil { mapFriendlyRouteResponse == actualRailRouteShapes } assertEquals(mapFriendlyRouteResponse, actualRailRouteShapes) } } diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetStopMapDataTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetStopMapDataTest.kt index 60a8e0821..a1f179335 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetStopMapDataTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/GetStopMapDataTest.kt @@ -32,6 +32,7 @@ class GetStopMapDataTest { } composeTestRule.awaitIdle() + composeTestRule.waitUntil { stopMapResponse == actualStopMapResponse } assertEquals(stopMapResponse, actualStopMapResponse) } } diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToAlertsTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToAlertsTest.kt index 8775bd437..21ef403ae 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToAlertsTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToAlertsTest.kt @@ -35,6 +35,7 @@ class SubscribeToAlertsTest { var actualData: AlertsStreamDataResponse? = null composeRule.setContent { actualData = subscribeToAlerts(alertsRepo) } composeRule.waitUntil { connectCount == 1 } + composeRule.waitUntil { alertsStreamDataResponse == actualData } assertEquals(alertsStreamDataResponse, actualData) } diff --git a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToVehiclesTest.kt b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToVehiclesTest.kt index a3c236e1b..c963e9125 100644 --- a/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToVehiclesTest.kt +++ b/androidApp/src/androidTest/java/com/mbta/tid/mbta_app/android/state/SubscribeToVehiclesTest.kt @@ -95,6 +95,7 @@ class SubscribeToVehiclesTest { runOnIdle { lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_RESUME) } waitUntil { disconnectCount == 3 } + waitUntil { connectCount == 2 } assertEquals(2, connectCount) } }