Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #24375 and #24384 fix and re-enable jumpBackInOptionTest and rece…
Browse files Browse the repository at this point in the history
…ntBookmarksOptionTest UI tests
  • Loading branch information
AndiAJ authored and mergify[bot] committed Apr 5, 2022
1 parent 526b9a1 commit 06bef25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -48,7 +52,6 @@ class SettingsHomepageTest {
featureSettingsHelper.resetAllFeatureFlags()
}

@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24375")
@SmokeTest
@Test
fun jumpBackInOptionTest() {
Expand All @@ -66,7 +69,6 @@ class SettingsHomepageTest {
}
}

@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24384")
@SmokeTest
@Test
fun recentBookmarksOptionTest() {
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand All @@ -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"))
Expand Down

0 comments on commit 06bef25

Please sign in to comment.