From 3af7f3dfd46e2154441d3fcc0bee62032bef8b75 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Fri, 27 Aug 2021 14:12:50 +0300 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/21002 update and add missing tabs setting validations --- .../mozilla/fenix/ui/SettingsBasicsTest.kt | 11 ------- .../java/org/mozilla/fenix/ui/SmokeTest.kt | 4 ++- .../ui/robots/SettingsSubMenuTabsRobot.kt | 31 ++++++++++++++++--- 3 files changed, 29 insertions(+), 17 deletions(-) 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 3681f64872..d8d0749047 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt @@ -150,17 +150,6 @@ class SettingsBasicsTest { } } - @Test - fun changeCloseTabsSetting() { - // Goes through the settings and verified the close tabs setting options. - homeScreen { - }.openThreeDotMenu { - }.openSettings { - }.openTabsSubMenu { - verifyOptions() - } - } - @Test fun changeAccessibiltySettings() { // Goes through the settings and changes the default text on a webpage, then verifies if the text has changed. diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index 827c63b869..5f85ee9266 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -1499,11 +1499,13 @@ class SmokeTest { } @Test - fun startOnHomeSettingsMenuItemsTest() { + fun tabsSettingsMenuItemsTest() { homeScreen { }.openThreeDotMenu { }.openSettings { }.openTabsSubMenu { + verifyTabViewOptions() + verifyCloseTabsOptions() verifyStartOnHomeOptions() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuTabsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuTabsRobot.kt index 3cf81bf25b..405af4bcf8 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuTabsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuTabsRobot.kt @@ -23,7 +23,9 @@ import org.mozilla.fenix.helpers.click */ class SettingsSubMenuTabsRobot { - fun verifyOptions() = assertOptions() + fun verifyTabViewOptions() = assertTabViewOptions() + + fun verifyCloseTabsOptions() = assertCloseTabsOptions() fun verifyStartOnHomeOptions() = assertStartOnHomeOptions() @@ -42,10 +44,21 @@ class SettingsSubMenuTabsRobot { } } -private fun assertOptions() { - afterOneDayToggle() +private fun assertTabViewOptions() { + tabViewHeading() + .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + listToggle() + .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + gridToggle() + .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) +} + +private fun assertCloseTabsOptions() { + closeTabsHeading() + .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + manuallyToggle() .check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) - manualToggle() + afterOneDayToggle() .check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) afterOneWeekToggle() .check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -64,7 +77,15 @@ private fun assertStartOnHomeOptions() { .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } -private fun manualToggle() = onView(withText("Manually")) +private fun tabViewHeading() = onView(withText("Tab view")) + +private fun listToggle() = onView(withText("List")) + +private fun gridToggle() = onView(withText("Grid")) + +private fun closeTabsHeading() = onView(withText("Close tabs")) + +private fun manuallyToggle() = onView(withText("Manually")) private fun afterOneDayToggle() = onView(withText("After one day"))