From 9187f1fd7d2f9101065785c244bd0456e2da7c05 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Thu, 18 Jul 2024 11:51:51 +0800 Subject: [PATCH] Add wait for title_displayed Bug: 346420411 Flag: EXEMPT test only Test: atest BackgroundInstalledAppsPageProviderTest Change-Id: I8047cd0aa4e414df83bcc69ebf21f245f985b447 --- .../BackgroundInstalledAppsPageProviderTest.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt index 5c65da11a66..6a6b91b2922 100644 --- a/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt +++ b/tests/spa_unit/src/com/android/settings/spa/app/backgroundinstall/BackgroundInstalledAppsPageProviderTest.kt @@ -23,6 +23,7 @@ import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.content.pm.ParceledListSlice 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 androidx.compose.ui.test.performClick @@ -30,6 +31,7 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.settings.R import com.android.settingslib.spa.testutils.FakeNavControllerWrapper +import com.android.settingslib.spa.testutils.waitUntilExists import com.android.settingslib.spaprivileged.template.app.AppListItemModel import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.first @@ -146,8 +148,9 @@ class BackgroundInstalledAppsPageProviderTest { BackgroundInstalledAppList() } - composeTestRule.onNodeWithText( - context.getString(R.string.background_install_title)).assertIsDisplayed() + composeTestRule.waitUntilExists( + hasText(context.getString(R.string.background_install_title)) + ) } @Test