From 5e745d0bc3f38e9575ea6177aa723a5b5f5bc90a Mon Sep 17 00:00:00 2001 From: Oana Horvath Date: Fri, 6 Nov 2020 13:43:40 +0200 Subject: [PATCH] For #15847: use Espresso's RecyclerView scrollTo action --- .../java/org/mozilla/fenix/ui/SettingsAboutTest.kt | 2 -- .../java/org/mozilla/fenix/ui/robots/SettingsRobot.kt | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt index 254fed432..ba101f0c9 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt @@ -10,7 +10,6 @@ import okhttp3.mockwebserver.MockWebServer import org.junit.Rule import org.junit.Before import org.junit.After -import org.junit.Ignore import org.junit.Test import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.HomeActivityIntentTestRule @@ -70,7 +69,6 @@ class SettingsAboutTest { } - @Ignore("Intermittent failure, see: https://github.com/mozilla-mobile/fenix/issues/15847") @Test fun verifyAboutFirefoxPreview() { homeScreen { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt index 9e95e31e3..e83a759f5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt @@ -20,6 +20,7 @@ import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.hasDescendant import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed +import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText @@ -425,15 +426,17 @@ private fun assertAboutHeading(): ViewInteraction { } private fun assertRateOnGooglePlay(): ViewInteraction { - scrollToElementByText("About Firefox Preview") + onView(withId(R.id.recycler_view)) + .perform(RecyclerViewActions.scrollTo(hasDescendant(withText("Rate on Google Play")))) return onView(withText("Rate on Google Play")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } private fun assertAboutFirefoxPreview(): ViewInteraction { - scrollToElementByText("About Firefox Preview") + onView(withId(R.id.recycler_view)) + .perform(RecyclerViewActions.scrollTo(hasDescendant(withText("About Firefox Preview")))) return onView(withText("About Firefox Preview")) - .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + .check(matches(isDisplayed())) } fun swipeToBottom() = onView(withId(R.id.recycler_view)).perform(ViewActions.swipeUp())