mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/27522 new toggleSearchEnginesShortcutListTest UI test
This commit is contained in:
parent
ee0996a26a
commit
e4cb712d11
@ -152,8 +152,8 @@ class SearchTest {
|
|||||||
}.goBack {
|
}.goBack {
|
||||||
}.openSearch {
|
}.openSearch {
|
||||||
scrollToSearchEngineSettings(activityTestRule)
|
scrollToSearchEngineSettings(activityTestRule)
|
||||||
clickSearchEngineSettings(activityTestRule)
|
}.clickSearchEngineSettings(activityTestRule) {
|
||||||
verifySearchSettings()
|
verifySearchToolbar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,4 +428,60 @@ class SettingsSearchTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expected for en-us defaults
|
||||||
|
@Test
|
||||||
|
fun toggleSearchEnginesShortcutListTest() {
|
||||||
|
homeScreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openSettings {
|
||||||
|
}.openSearchSubMenu {
|
||||||
|
verifyShowSearchEnginesToggleState(false)
|
||||||
|
toggleShowSearchShortcuts()
|
||||||
|
verifyShowSearchEnginesToggleState(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
exitMenu()
|
||||||
|
|
||||||
|
homeScreen {
|
||||||
|
}.openSearch {
|
||||||
|
verifySearchEngineShortcuts(
|
||||||
|
activityTestRule,
|
||||||
|
"Google",
|
||||||
|
"Bing",
|
||||||
|
"Amazon.com",
|
||||||
|
"DuckDuckGo",
|
||||||
|
"eBay",
|
||||||
|
"Wikipedia",
|
||||||
|
)
|
||||||
|
}.clickSearchEngineSettings(activityTestRule) {
|
||||||
|
toggleShowSearchShortcuts()
|
||||||
|
verifyShowSearchEnginesToggleState(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
exitMenu()
|
||||||
|
|
||||||
|
homeScreen {
|
||||||
|
}.openSearch {
|
||||||
|
verifySearchEngineShortcutsAreNotDisplayed(
|
||||||
|
activityTestRule,
|
||||||
|
"Google",
|
||||||
|
"Bing",
|
||||||
|
"Amazon.com",
|
||||||
|
"DuckDuckGo",
|
||||||
|
"eBay",
|
||||||
|
"Wikipedia",
|
||||||
|
)
|
||||||
|
clickSearchEngineShortcutButton()
|
||||||
|
verifySearchEngineShortcuts(
|
||||||
|
activityTestRule,
|
||||||
|
"Google",
|
||||||
|
"Bing",
|
||||||
|
"Amazon.com",
|
||||||
|
"DuckDuckGo",
|
||||||
|
"eBay",
|
||||||
|
"Wikipedia",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,13 +286,6 @@ class SearchRobot {
|
|||||||
.performScrollToIndex(5)
|
.performScrollToIndex(5)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clickSearchEngineSettings(rule: ComposeTestRule) {
|
|
||||||
rule.onNodeWithText("Search engine settings")
|
|
||||||
.assertIsDisplayed()
|
|
||||||
.assertHasClickAction()
|
|
||||||
.performClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clickClearButton() {
|
fun clickClearButton() {
|
||||||
clearButton().click()
|
clearButton().click()
|
||||||
}
|
}
|
||||||
@ -337,6 +330,17 @@ class SearchRobot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun verifySearchEngineShortcutsAreNotDisplayed(rule: ComposeTestRule, vararg searchEngines: String) {
|
||||||
|
mDevice.findObject(
|
||||||
|
UiSelector().resourceId("$packageName:id/pill_wrapper_divider"),
|
||||||
|
).waitForExists(waitingTime)
|
||||||
|
|
||||||
|
for (searchEngine in searchEngines) {
|
||||||
|
rule.waitForIdle()
|
||||||
|
rule.onNodeWithText(searchEngine).assertDoesNotExist()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun verifyTypedToolbarText(expectedText: String) {
|
fun verifyTypedToolbarText(expectedText: String) {
|
||||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))
|
mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))
|
||||||
.waitForExists(waitingTime)
|
.waitForExists(waitingTime)
|
||||||
@ -399,6 +403,19 @@ class SearchRobot {
|
|||||||
NavigationToolbarRobot().interact()
|
NavigationToolbarRobot().interact()
|
||||||
return NavigationToolbarRobot.Transition()
|
return NavigationToolbarRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun clickSearchEngineSettings(
|
||||||
|
rule: ComposeTestRule,
|
||||||
|
interact: SettingsSubMenuSearchRobot.() -> Unit,
|
||||||
|
): SettingsSubMenuSearchRobot.Transition {
|
||||||
|
rule.onNodeWithText("Search engine settings")
|
||||||
|
.assertIsDisplayed()
|
||||||
|
.assertHasClickAction()
|
||||||
|
.performClick()
|
||||||
|
|
||||||
|
SettingsSubMenuSearchRobot().interact()
|
||||||
|
return SettingsSubMenuSearchRobot.Transition()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +289,8 @@ class SettingsSubMenuSearchRobot {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun verifyShowSearchEnginesToggleState(enabled: Boolean) = assertShowSearchEnginesToggle(enabled)
|
||||||
|
|
||||||
class Transition {
|
class Transition {
|
||||||
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
@ -385,6 +387,33 @@ private fun assertEngineListDoesNotContain(searchEngineName: String) {
|
|||||||
private fun assertThreeDotButtonIsNotDisplayed(searchEngineName: String) =
|
private fun assertThreeDotButtonIsNotDisplayed(searchEngineName: String) =
|
||||||
threeDotMenu(searchEngineName).check(matches(not(isDisplayed())))
|
threeDotMenu(searchEngineName).check(matches(not(isDisplayed())))
|
||||||
|
|
||||||
|
private fun assertShowSearchEnginesToggle(enabled: Boolean) =
|
||||||
|
if (enabled) {
|
||||||
|
onView(withText(R.string.preferences_show_search_engines))
|
||||||
|
.check(
|
||||||
|
matches(
|
||||||
|
hasCousin(
|
||||||
|
allOf(
|
||||||
|
withClassName(endsWith("Switch")),
|
||||||
|
ViewMatchers.isChecked(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
onView(withText(R.string.preferences_show_search_engines))
|
||||||
|
.check(
|
||||||
|
matches(
|
||||||
|
hasCousin(
|
||||||
|
allOf(
|
||||||
|
withClassName(endsWith("Switch")),
|
||||||
|
ViewMatchers.isNotChecked(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun threeDotMenu(searchEngineName: String) =
|
private fun threeDotMenu(searchEngineName: String) =
|
||||||
onView(
|
onView(
|
||||||
allOf(
|
allOf(
|
||||||
|
Loading…
Reference in New Issue
Block a user