[fenix] For https://github.com/mozilla-mobile/fenix/issues/24375 and https://github.com/mozilla-mobile/fenix/issues/24384 fix and re-enable jumpBackInOptionTest and recentBookmarksOptionTest UI tests

pull/600/head
AndiAJ 2 years ago committed by mergify[bot]
parent d0d2396d0a
commit 26087bf448

@ -7,13 +7,13 @@ package org.mozilla.fenix.ui
import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.MockWebServer
import org.junit.After import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.FeatureSettingsHelper
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
import org.mozilla.fenix.helpers.TestHelper.restartApp import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
@ -29,7 +29,11 @@ class SettingsHomepageTest {
private val featureSettingsHelper = FeatureSettingsHelper() private val featureSettingsHelper = FeatureSettingsHelper()
@get:Rule @get:Rule
val activityIntentTestRule = HomeActivityIntentTestRule() val activityIntentTestRule = HomeActivityIntentTestRule(skipOnboarding = true)
@Rule
@JvmField
val retryTestRule = RetryTestRule(3)
@Before @Before
fun setUp() { fun setUp() {
@ -48,7 +52,6 @@ class SettingsHomepageTest {
featureSettingsHelper.resetAllFeatureFlags() featureSettingsHelper.resetAllFeatureFlags()
} }
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24375")
@SmokeTest @SmokeTest
@Test @Test
fun jumpBackInOptionTest() { fun jumpBackInOptionTest() {
@ -66,7 +69,6 @@ class SettingsHomepageTest {
} }
} }
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24384")
@SmokeTest @SmokeTest
@Test @Test
fun recentBookmarksOptionTest() { fun recentBookmarksOptionTest() {

@ -12,14 +12,12 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
import androidx.test.espresso.matcher.RootMatchers import androidx.test.espresso.matcher.RootMatchers
import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withHint import androidx.test.espresso.matcher.ViewMatchers.withHint
@ -674,15 +672,15 @@ private fun assertTopSiteContextMenuItems() {
) )
} }
private fun assertJumpBackInSectionIsDisplayed() = jumpBackInSection().check(matches(isDisplayed())) private fun assertJumpBackInSectionIsDisplayed() = assertTrue(jumpBackInSection().waitForExists(waitingTime))
private fun assertJumpBackInSectionIsNotDisplayed() = jumpBackInSection().check(doesNotExist()) private fun assertJumpBackInSectionIsNotDisplayed() = assertFalse(jumpBackInSection().waitForExists(waitingTimeShort))
private fun assertRecentBookmarksSectionIsDisplayed() = private fun assertRecentBookmarksSectionIsDisplayed() =
recentBookmarksSection().check(matches(isDisplayed())) assertTrue(recentBookmarksSection().waitForExists(waitingTime))
private fun assertRecentBookmarksSectionIsNotDisplayed() = private fun assertRecentBookmarksSectionIsNotDisplayed() =
recentBookmarksSection().check(doesNotExist()) assertFalse(recentBookmarksSection().waitForExists(waitingTimeShort))
private fun privateBrowsingButton() = onView(withId(R.id.privateBrowsingButton)) private fun privateBrowsingButton() = onView(withId(R.id.privateBrowsingButton))
@ -691,20 +689,10 @@ private fun saveTabsToCollectionButton() = onView(withId(R.id.add_tabs_to_collec
private fun tabsCounter() = onView(withId(R.id.tab_button)) private fun tabsCounter() = onView(withId(R.id.tab_button))
private fun jumpBackInSection() = private fun jumpBackInSection() =
onView( mDevice.findObject(UiSelector().textContains(getStringResource(R.string.recent_tabs_header)))
allOf(
withText(R.string.recent_tabs_header),
hasSibling(withText(R.string.recent_tabs_show_all))
)
)
private fun recentBookmarksSection() = private fun recentBookmarksSection() =
onView( mDevice.findObject(UiSelector().textContains(getStringResource(R.string.recent_bookmarks_title)))
allOf(
withText(R.string.recent_bookmarks_title),
hasSibling(withText(R.string.recently_saved_show_all))
)
)
private fun startBrowsingButton(): UiObject { private fun startBrowsingButton(): UiObject {
val startBrowsingButton = mDevice.findObject(UiSelector().resourceId("$packageName:id/finish_button")) val startBrowsingButton = mDevice.findObject(UiSelector().resourceId("$packageName:id/finish_button"))

Loading…
Cancel
Save