Merge "Reduce flaky of whenIsInstantApp_hasSummaryForInstant" into main
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt
index 2524308..d1c318a 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppInstallerInfoPreferenceTest.kt
@@ -26,6 +26,7 @@
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.hasText
+import androidx.compose.ui.test.isEnabled
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onRoot
@@ -46,9 +47,10 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.MockitoSession
-import org.mockito.Spy
import org.mockito.kotlin.any
+import org.mockito.kotlin.doNothing
import org.mockito.kotlin.eq
+import org.mockito.kotlin.spy
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import org.mockito.quality.Strictness
@@ -60,8 +62,9 @@
private lateinit var mockSession: MockitoSession
- @Spy
- private val context: Context = ApplicationProvider.getApplicationContext()
+ private val context: Context = spy(ApplicationProvider.getApplicationContext()) {
+ doNothing().whenever(mock).startActivityAsUser(any(), any())
+ }
@Before
fun setUp() {
@@ -78,8 +81,7 @@
.thenReturn(STORE_LINK)
whenever(Utils.getApplicationLabel(context, INSTALLER_PACKAGE_NAME))
.thenReturn(INSTALLER_PACKAGE_LABEL)
- whenever(AppUtils.isMainlineModule(any(), eq(PACKAGE_NAME)))
- .thenReturn(false)
+ whenever(AppUtils.isMainlineModule(any(), eq(PACKAGE_NAME))).thenReturn(false)
}
@After
@@ -134,11 +136,8 @@
}
setContent(instantApp)
- waitUntilDisplayed()
- composeTestRule.onNodeWithText("More info on installer label")
- .assertIsDisplayed()
- .assertIsEnabled()
+ composeTestRule.waitUntilExists(hasText("More info on installer label").and(isEnabled()))
}
@Test