Fixing RemoteAuth Tests breakage

Fixing RemoteAuthEnrollFinishTest, RemoteAuthEnrollEnrollingTest, and
RemoteAuthSettingsTest by changing `isDisplayed()` check to the intended
`withEffectiveVisibility()`.

Bug: b/296191086
Test: make RunSettingsRoboTests -j40
Change-Id: I3405fd2709c83a966b83106c804880d00fc4bbf4
This commit is contained in:
Justin McClain
2023-08-16 18:37:30 +00:00
parent 54d8bbcaf5
commit d971817112
3 changed files with 20 additions and 15 deletions

View File

@@ -22,7 +22,6 @@ import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.* import androidx.test.espresso.matcher.ViewMatchers.*
import com.android.settings.R import com.android.settings.R
import org.hamcrest.core.IsNot.not
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@@ -36,10 +35,10 @@ class RemoteAuthEnrollEnrollingTest {
} }
@Test @Test
fun testRemoteAuthenticatorEnrollEnrolling_hasHeader() { fun testRemoteAuthenticatorEnrollEnrolling_headerVisible() {
onView(withText(R.string.security_settings_remoteauth_enroll_enrolling_title)).check( onView(withText(R.string.security_settings_remoteauth_enroll_enrolling_title)).check(
matches( matches(
isDisplayed() withEffectiveVisibility(Visibility.VISIBLE)
) )
) )
} }
@@ -54,12 +53,18 @@ class RemoteAuthEnrollEnrollingTest {
} }
@Test @Test
fun testRemoteAuthenticatorEnrollEnrolling_progressBarNotDisplayed() { fun testRemoteAuthenticatorEnrollEnrolling_progressBarNotVisible() {
onView(withId(R.id.enrolling_list_progress_bar)).check(matches(not(isDisplayed()))) onView(withId(R.id.enrolling_list_progress_bar)).check(
matches(
withEffectiveVisibility(
Visibility.INVISIBLE
)
)
)
} }
@Test @Test
fun testRemoteAuthenticatorEnrollEnrolling_errorTextNotDisplayed() { fun testRemoteAuthenticatorEnrollEnrolling_errorTextNotVisible() {
onView(withId(R.id.error_text)).check(matches(not(isDisplayed()))) onView(withId(R.id.error_text)).check(matches(withEffectiveVisibility(Visibility.INVISIBLE)))
} }
} }

View File

@@ -36,19 +36,19 @@ class RemoteAuthEnrollFinishTest {
} }
@Test @Test
fun testRemoteAuthenticatorEnrollFinish_hasHeader() { fun testRemoteAuthenticatorEnrollFinish_headerVisible() {
onView(withText(R.string.security_settings_remoteauth_enroll_finish_title)).check( onView(withText(R.string.security_settings_remoteauth_enroll_finish_title)).check(
matches( matches(
isDisplayed() withEffectiveVisibility(Visibility.VISIBLE)
) )
) )
} }
@Test @Test
fun testRemoteAuthenticatorEnrollFinish_hasDescription() { fun testRemoteAuthenticatorEnrollFinish_descriptionVisible() {
onView(withText(R.string.security_settings_remoteauth_enroll_finish_description)).check( onView(withText(R.string.security_settings_remoteauth_enroll_finish_description)).check(
matches( matches(
isDisplayed() withEffectiveVisibility(Visibility.VISIBLE)
) )
) )
} }

View File

@@ -35,19 +35,19 @@ class RemoteAuthSettingsTest {
} }
@Test @Test
fun testRemoteAuthenticatorSettings_hasHeader() { fun testRemoteAuthenticatorSettings_headerVisible() {
onView(withText(R.string.security_settings_remoteauth_settings_title)).check( onView(withText(R.string.security_settings_remoteauth_settings_title)).check(
matches( matches(
isDisplayed() withEffectiveVisibility(Visibility.VISIBLE)
) )
) )
} }
@Test @Test
fun testRemoteAuthenticatorSettings_hasDescription() { fun testRemoteAuthenticatorSettings_descriptionVisible() {
onView(withText(R.string.security_settings_remoteauth_settings_description)).check( onView(withText(R.string.security_settings_remoteauth_settings_description)).check(
matches( matches(
isDisplayed() withEffectiveVisibility(Visibility.VISIBLE)
) )
) )
} }