Bug 1813788 - Part 2: Add UnusedResources specifiers to strings needing it + Remove unused testing functions

This is a follow-up to https://github.com/mozilla-mobile/firefox-android/pull/2688#discussion_r1302467116
fenix/118.0
iTrooz 10 months ago committed by mergify[bot]
parent f63bb624b9
commit e92ccdcbf9

@ -9,7 +9,6 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
import androidx.test.espresso.matcher.ViewMatchers.withChild
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId
@ -29,9 +28,6 @@ import org.mozilla.fenix.helpers.click
*/
class SettingsSubMenuDeleteBrowsingDataRobot {
fun verifyNavigationToolBarHeader() = assertNavigationToolBarHeader()
fun verifyDeleteBrowsingDataButton() = assertDeleteBrowsingDataButton()
fun verifyAllOptionsAndCheckBoxes() = assertAllOptionsAndCheckBoxes()
fun verifyAllCheckBoxesAreChecked() = assertAllCheckBoxesAreChecked()
fun verifyOpenTabsCheckBox(status: Boolean) = assertOpenTabsCheckBox(status)
fun verifyBrowsingHistoryDetails(status: Boolean) = assertBrowsingHistoryCheckBox(status)
@ -151,66 +147,30 @@ class SettingsSubMenuDeleteBrowsingDataRobot {
private fun goBackButton() =
onView(allOf(withContentDescription("Navigate up")))
private fun navigationToolBarHeader() =
onView(
allOf(
withId(R.id.navigationToolbar),
withChild(withText(R.string.preferences_delete_browsing_data)),
),
)
private fun deleteBrowsingDataButton() = onView(withId(R.id.delete_data))
private fun assertNavigationToolBarHeader() =
navigationToolBarHeader().check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun assertDeleteBrowsingDataButton() =
deleteBrowsingDataButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun dialogDeleteButton() = onView(withText("Delete")).inRoot(isDialog())
private fun dialogCancelButton() = onView(withText("Cancel")).inRoot(isDialog())
private fun openTabsSubsection() = onView(withText(R.string.preferences_delete_browsing_data_tabs_title_2))
private fun openTabsDescription(tabNumber: String) = onView(withText("$tabNumber tabs"))
private fun openTabsCheckBox() = onView(allOf(withId(R.id.checkbox), hasSibling(withText("Open tabs"))))
private fun browsingHistorySubsection() =
onView(withText(R.string.preferences_delete_browsing_data_browsing_data_title))
private fun browsingHistoryDescription(addresses: String) = mDevice.findObject(UiSelector().textContains("$addresses addresses"))
private fun browsingHistoryCheckBox() =
onView(allOf(withId(R.id.checkbox), hasSibling(withText("Browsing history"))))
private fun cookiesSubsection() =
onView(withText(R.string.preferences_delete_browsing_data_cookies))
private fun cookiesAndSiteDataDescription() = onView(withText(R.string.preferences_delete_browsing_data_cookies_subtitle))
private fun cookiesAndSiteDataCheckBox() =
onView(allOf(withId(R.id.checkbox), hasSibling(withText("Cookies and site data"))))
private fun cachedFilesSubsection() =
onView(withText(R.string.preferences_delete_browsing_data_cached_files))
private fun cachedFilesDescription() =
onView(withText(R.string.preferences_delete_browsing_data_cached_files_subtitle))
private fun cachedFilesCheckBox() =
onView(allOf(withId(R.id.checkbox), hasSibling(withText("Cached images and files"))))
private fun sitePermissionsSubsection() =
onView(withText(R.string.preferences_delete_browsing_data_site_permissions))
private fun sitePermissionsCheckBox() =
onView(allOf(withId(R.id.checkbox), hasSibling(withText("Site permissions"))))
private fun downloadsSubsection() =
onView(withText(R.string.preferences_delete_browsing_data_downloads))
private fun downloadsCheckBox() =
onView(allOf(withId(R.id.checkbox), hasSibling(withText("Downloads"))))
@ -218,25 +178,6 @@ private fun dialogMessage() =
onView(withText("$appName will delete the selected browsing data."))
.inRoot(isDialog())
private fun assertAllOptionsAndCheckBoxes() {
openTabsSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
openTabsDescription("0").check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
openTabsCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
browsingHistorySubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
assertTrue(browsingHistoryDescription("0").waitForExists(waitingTime))
browsingHistoryCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cookiesSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cookiesAndSiteDataDescription().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cookiesAndSiteDataCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cachedFilesSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cachedFilesDescription().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
cachedFilesCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
sitePermissionsSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
sitePermissionsCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
downloadsSubsection().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
downloadsCheckBox().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun assertAllCheckBoxesAreChecked() {
openTabsCheckBox().assertIsChecked(true)
browsingHistoryCheckBox().assertIsChecked(true)

@ -1309,14 +1309,14 @@
<!-- Subtitle for the tabs item in Delete browsing data, parameter will be replaced with the number of open tabs -->
<string name="preferences_delete_browsing_data_tabs_subtitle">%d tabs</string>
<!-- Title for the data and history items in Delete browsing data -->
<string name="preferences_delete_browsing_data_browsing_data_title" moz:removedIn="118">Browsing history and site data</string>
<string name="preferences_delete_browsing_data_browsing_data_title" moz:removedIn="118" tools:ignore="UnusedResources">Browsing history and site data</string>
<!-- Title for the history item in Delete browsing data -->
<string name="preferences_delete_browsing_data_browsing_history_title">Browsing history</string>
<!-- Subtitle for the data and history items in delete browsing data, parameter will be replaced with the
number of history items the user has -->
<string name="preferences_delete_browsing_data_browsing_data_subtitle">%d addresses</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies" moz:removedIn="118">Cookies</string>
<string name="preferences_delete_browsing_data_cookies" moz:removedIn="118" tools:ignore="UnusedResources">Cookies</string>
<!-- Title for the cookies and site data items in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies_and_site_data">Cookies and site data</string>
<!-- Subtitle for the cookies item in Delete browsing data -->

Loading…
Cancel
Save