diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt index bb74fb038e..08178065c1 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt @@ -205,6 +205,26 @@ class SettingsBasicsTest { } } + @SmokeTest + @Test + fun recentBookmarksOptionTest() { + val genericURL = getGenericAsset(mockWebServer, 1) + + navigationToolbar { + }.enterURLAndEnterToBrowser(genericURL.url) { + mDevice.waitForIdle() + }.openThreeDotMenu { + }.bookmarkPage { + }.goToHomescreen { + verifyRecentBookmarksSectionIsDisplayed() + }.openThreeDotMenu { + }.openCustomizeHome { + clickRecentBookmarksButton() + }.goBack { + verifyRecentBookmarksSectionIsNotDisplayed() + } + } + @SmokeTest @Test fun startOnHomepageTest() { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index 1e3ad64253..e6666c4e6f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -120,6 +120,8 @@ class HomeScreenRobot { fun verifyJumpBackInSectionIsDisplayed() = assertJumpBackInSectionIsDisplayed() fun verifyJumpBackInSectionIsNotDisplayed() = assertJumpBackInSectionIsNotDisplayed() + fun verifyRecentBookmarksSectionIsDisplayed() = assertRecentBookmarksSectionIsDisplayed() + fun verifyRecentBookmarksSectionIsNotDisplayed() = assertRecentBookmarksSectionIsNotDisplayed() // Collections elements fun verifyCollectionIsDisplayed(title: String, collectionExists: Boolean = true) { @@ -593,6 +595,12 @@ private fun assertJumpBackInSectionIsDisplayed() = jumpBackInSection().check(mat private fun assertJumpBackInSectionIsNotDisplayed() = jumpBackInSection().check(doesNotExist()) +private fun assertRecentBookmarksSectionIsDisplayed() = + recentBookmarksSection().check(matches(isDisplayed())) + +private fun assertRecentBookmarksSectionIsNotDisplayed() = + recentBookmarksSection().check(doesNotExist()) + private fun privateBrowsingButton() = onView(withId(R.id.privateBrowsingButton)) private fun saveTabsToCollectionButton() = onView(withId(R.id.add_tabs_to_collections_button)) @@ -607,6 +615,14 @@ private fun jumpBackInSection() = ) ) +private fun recentBookmarksSection() = + onView( + allOf( + withText(R.string.recent_bookmarks_title), + hasSibling(withText(R.string.recently_saved_show_all)) + ) + ) + private fun startBrowsingButton(): UiObject { val startBrowsingButton = mDevice.findObject(UiSelector().resourceId("$packageName:id/finish_button")) homeScreenList() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt index bee10f802b..d8bf310e7f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt @@ -30,6 +30,7 @@ class SettingsSubMenuHomepageRobot { } fun clickJumpBackInButton() = jumpBackInButton().click() + fun clickRecentBookmarksButton() = recentBookmarksButton().click() fun clickStartOnHomepageButton() = homepageButton().click() class Transition {