|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.ui.robots
|
|
|
|
package org.mozilla.fenix.ui.robots
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.util.Log
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
|
|
@ -18,6 +19,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
|
|
import org.hamcrest.CoreMatchers.containsString
|
|
|
|
import org.hamcrest.CoreMatchers.containsString
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants.TAG
|
|
|
|
import org.mozilla.fenix.helpers.assertIsChecked
|
|
|
|
import org.mozilla.fenix.helpers.assertIsChecked
|
|
|
|
import org.mozilla.fenix.helpers.atPosition
|
|
|
|
import org.mozilla.fenix.helpers.atPosition
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
@ -29,6 +31,7 @@ import org.mozilla.fenix.helpers.isChecked
|
|
|
|
class SettingsSubMenuDeleteBrowsingDataOnQuitRobot {
|
|
|
|
class SettingsSubMenuDeleteBrowsingDataOnQuitRobot {
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyNavigationToolBarHeader() {
|
|
|
|
fun verifyNavigationToolBarHeader() {
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyNavigationToolBarHeader: Trying to verify that the \"Delete browsing data on quit\" toolbar title is visible")
|
|
|
|
onView(
|
|
|
|
onView(
|
|
|
|
allOf(
|
|
|
|
allOf(
|
|
|
|
withId(R.id.navigationToolbar),
|
|
|
|
withId(R.id.navigationToolbar),
|
|
|
@ -36,43 +39,63 @@ class SettingsSubMenuDeleteBrowsingDataOnQuitRobot {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyNavigationToolBarHeader: Verified that the \"Delete browsing data on quit\" toolbar title is visible")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyDeleteBrowsingOnQuitEnabled(enabled: Boolean) =
|
|
|
|
fun verifyDeleteBrowsingOnQuitEnabled(enabled: Boolean) {
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyDeleteBrowsingOnQuitEnabled: Trying to verify that the \"Delete browsing data on quit\" toggle is checked: $enabled")
|
|
|
|
deleteBrowsingOnQuitButton().assertIsChecked(enabled)
|
|
|
|
deleteBrowsingOnQuitButton().assertIsChecked(enabled)
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyDeleteBrowsingOnQuitEnabled: Verified that the \"Delete browsing data on quit\" toggle is checked: $enabled")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyDeleteBrowsingOnQuitButtonSummary() =
|
|
|
|
fun verifyDeleteBrowsingOnQuitButtonSummary() {
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyDeleteBrowsingOnQuitButtonSummary: Trying to verify that the \"Delete browsing data on quit\" option summary is visible")
|
|
|
|
onView(
|
|
|
|
onView(
|
|
|
|
withText(R.string.preference_summary_delete_browsing_data_on_quit_2),
|
|
|
|
withText(R.string.preference_summary_delete_browsing_data_on_quit_2),
|
|
|
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyDeleteBrowsingOnQuitButtonSummary: Verified that the \"Delete browsing data on quit\" option summary is visible")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun clickDeleteBrowsingOnQuitButtonSwitch() = onView(withResourceName("switch_widget")).click()
|
|
|
|
fun clickDeleteBrowsingOnQuitButtonSwitch() {
|
|
|
|
|
|
|
|
Log.i(TAG, "clickDeleteBrowsingOnQuitButtonSwitch: Trying to click the \"Delete browsing data on quit\" toggle")
|
|
|
|
|
|
|
|
onView(withResourceName("switch_widget")).click()
|
|
|
|
|
|
|
|
Log.i(TAG, "clickDeleteBrowsingOnQuitButtonSwitch: Clicked the \"Delete browsing data on quit\" toggle")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyAllTheCheckBoxesText() {
|
|
|
|
fun verifyAllTheCheckBoxesText() {
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Open tabs\" option is visible")
|
|
|
|
openTabsCheckbox()
|
|
|
|
openTabsCheckbox()
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Open tabs\" option is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Browsing history\" option is visible")
|
|
|
|
browsingHistoryCheckbox()
|
|
|
|
browsingHistoryCheckbox()
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Browsing history\" option is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Cookies and site data\" option is visible")
|
|
|
|
cookiesAndSiteDataCheckbox()
|
|
|
|
cookiesAndSiteDataCheckbox()
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Cookies and site data\" option is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Cookies and site data\" option summary is visible")
|
|
|
|
onView(withText(R.string.preferences_delete_browsing_data_cookies_subtitle))
|
|
|
|
onView(withText(R.string.preferences_delete_browsing_data_cookies_subtitle))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Cookies and site data\" option summary is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Cached images and files\" option is visible")
|
|
|
|
cachedFilesCheckbox()
|
|
|
|
cachedFilesCheckbox()
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Cached images and files\" option is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Cached images and files\" option summary is visible")
|
|
|
|
onView(withText(R.string.preferences_delete_browsing_data_cached_files_subtitle))
|
|
|
|
onView(withText(R.string.preferences_delete_browsing_data_cached_files_subtitle))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Cached images and files\" option summary is visible")
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Trying to verify that the \"Site permissions\" option is visible")
|
|
|
|
sitePermissionsCheckbox()
|
|
|
|
sitePermissionsCheckbox()
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesText: Verified that the \"Site permissions\" option is visible")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyAllTheCheckBoxesChecked(checked: Boolean) {
|
|
|
|
fun verifyAllTheCheckBoxesChecked(checked: Boolean) {
|
|
|
|
for (index in 2..7) {
|
|
|
|
for (index in 2..7) {
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesChecked: Trying to verify that the the check box at position ${index - 1} is checked: $checked")
|
|
|
|
onView(withId(R.id.recycler_view))
|
|
|
|
onView(withId(R.id.recycler_view))
|
|
|
|
.check(
|
|
|
|
.check(
|
|
|
|
matches(
|
|
|
|
matches(
|
|
|
@ -87,12 +110,15 @@ class SettingsSubMenuDeleteBrowsingDataOnQuitRobot {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
Log.i(TAG, "verifyAllTheCheckBoxesChecked: Verified that the the check box at position ${index - 1} is checked: $checked")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class Transition {
|
|
|
|
class Transition {
|
|
|
|
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
|
|
|
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
|
|
|
|
|
|
|
Log.i(TAG, "goBack: Trying to click navigate up toolbar button")
|
|
|
|
goBackButton().click()
|
|
|
|
goBackButton().click()
|
|
|
|
|
|
|
|
Log.i(TAG, "goBack: Clicked navigate up toolbar button")
|
|
|
|
|
|
|
|
|
|
|
|
SettingsRobot().interact()
|
|
|
|
SettingsRobot().interact()
|
|
|
|
return SettingsRobot.Transition()
|
|
|
|
return SettingsRobot.Transition()
|
|
|
|