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

@ -12,14 +12,12 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions
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.contrib.RecyclerViewActions.actionOnItem
import androidx.test.espresso.matcher.RootMatchers
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.hasSibling
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
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() =
recentBookmarksSection().check(matches(isDisplayed()))
assertTrue(recentBookmarksSection().waitForExists(waitingTime))
private fun assertRecentBookmarksSectionIsNotDisplayed() =
recentBookmarksSection().check(doesNotExist())
assertFalse(recentBookmarksSection().waitForExists(waitingTimeShort))
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 jumpBackInSection() =
onView(
allOf(
withText(R.string.recent_tabs_header),
hasSibling(withText(R.string.recent_tabs_show_all))
)
)
mDevice.findObject(UiSelector().textContains(getStringResource(R.string.recent_tabs_header)))
private fun recentBookmarksSection() =
onView(
allOf(
withText(R.string.recent_bookmarks_title),
hasSibling(withText(R.string.recently_saved_show_all))
)
)
mDevice.findObject(UiSelector().textContains(getStringResource(R.string.recent_bookmarks_title)))
private fun startBrowsingButton(): UiObject {
val startBrowsingButton = mDevice.findObject(UiSelector().resourceId("$packageName:id/finish_button"))

Loading…
Cancel
Save