Use identifiers instead of hard coded strings
This commit is contained in:
parent
d3651eb0fc
commit
6149f9faf8
|
@ -157,7 +157,8 @@ class SettingsRobot {
|
|||
|
||||
fun openHomepageSubMenu(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition {
|
||||
|
||||
onView(withText("Homepage")).click()
|
||||
mDevice.findObject(UiSelector().textContains("Homepage")).waitForExists(waitingTime)
|
||||
onView(withText(R.string.preferences_home_2)).click()
|
||||
|
||||
SettingsSubMenuHomepageRobot().interact()
|
||||
return SettingsSubMenuHomepageRobot.Transition()
|
||||
|
@ -307,8 +308,8 @@ private fun assertSettingsToolbar() =
|
|||
onView(
|
||||
CoreMatchers.allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
hasDescendant(ViewMatchers.withContentDescription("Navigate up")),
|
||||
hasDescendant(withText("Settings"))
|
||||
hasDescendant(ViewMatchers.withContentDescription(R.string.action_bar_up_description)),
|
||||
hasDescendant(withText(R.string.settings))
|
||||
)
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
|
@ -320,18 +321,18 @@ private fun assertGeneralHeading() {
|
|||
|
||||
private fun assertSearchButton() {
|
||||
mDevice.wait(Until.findObject(By.text("Search")), waitingTime)
|
||||
onView(withText("Search"))
|
||||
onView(withText(R.string.preferences_search))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun assertHomepageButton() =
|
||||
onView(withText("Homepage")).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
onView(withText(R.string.preferences_home_2)).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertCreditCardsButton() =
|
||||
onView(withText("Credit cards")).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
onView(withText(R.string.preferences_credit_cards)).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertLanguageButton() =
|
||||
onView(withText("Language")).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
onView(withText(R.string.preferences_language)).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertCustomizeButton() = onView(withText("Customize"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
@ -365,7 +366,7 @@ private fun assertAndroidDefaultAppsMenuAppears() {
|
|||
|
||||
private fun assertTabsButton() {
|
||||
mDevice.wait(Until.findObject(By.text("Tabs")), waitingTime)
|
||||
onView(withText("Tabs"))
|
||||
onView(withText(R.string.preferences_tabs))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
@ -392,7 +393,7 @@ private fun assertEnhancedTrackingProtectionValue(state: String) {
|
|||
|
||||
private fun assertLoginsAndPasswordsButton() {
|
||||
scrollToElementByText("Logins and passwords")
|
||||
onView(withText("Logins and passwords"))
|
||||
onView(withText(R.string.preferences_passwords_logins_and_passwords))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
|
|
|
@ -18,18 +18,18 @@ class SettingsSubMenuHomepageRobot {
|
|||
class Transition
|
||||
}
|
||||
|
||||
private fun openingScreenHeading() = onView(withText("Opening screen"))
|
||||
private fun openingScreenHeading() = onView(withText(R.string.preferences_opening_screen))
|
||||
|
||||
private fun homepageButton() =
|
||||
onView(
|
||||
allOf(
|
||||
withId(R.id.title),
|
||||
withText("Homepage"),
|
||||
withText(R.string.opening_screen_homepage),
|
||||
hasSibling(withId(R.id.radio_button))
|
||||
)
|
||||
)
|
||||
|
||||
private fun lastTabButton() = onView(withText("Last tab"))
|
||||
private fun lastTabButton() = onView(withText(R.string.opening_screen_last_tab))
|
||||
|
||||
private fun homepageAfterFourHoursButton() =
|
||||
onView(withText("Homepage after four hours of inactivity"))
|
||||
onView(withText(R.string.opening_screen_after_four_hours_of_inactivity))
|
||||
|
|
|
@ -161,8 +161,8 @@ private fun assertSearchToolbar() =
|
|||
onView(
|
||||
allOf(
|
||||
withId(R.id.navigationToolbar),
|
||||
hasDescendant(withContentDescription("Navigate up")),
|
||||
hasDescendant(withText("Search"))
|
||||
hasDescendant(withContentDescription(R.string.action_bar_up_description)),
|
||||
hasDescendant(withText(R.string.preferences_search))
|
||||
)
|
||||
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue