|
|
@ -46,6 +46,7 @@ import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.isPackageInstalled
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.isPackageInstalled
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.packageName
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.packageName
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.waitForObjects
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -110,31 +111,40 @@ class SearchRobot {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyFirefoxSuggestResults(rule: ComposeTestRule, searchSuggestion: String) {
|
|
|
|
fun verifyFirefoxSuggestResults(rule: ComposeTestRule, searchTerm: String, vararg searchSuggestions: String) {
|
|
|
|
rule.waitForIdle()
|
|
|
|
rule.waitForIdle()
|
|
|
|
for (i in 1..RETRY_COUNT) {
|
|
|
|
for (i in 1..RETRY_COUNT) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
rule.onNodeWithTag("mozac.awesomebar.suggestions")
|
|
|
|
for (searchSuggestion in searchSuggestions) {
|
|
|
|
.performScrollToNode(hasText(searchSuggestion))
|
|
|
|
mDevice.waitForObjects(mDevice.findObject(UiSelector().textContains(searchSuggestion)))
|
|
|
|
.assertExists()
|
|
|
|
rule.onNodeWithTag("mozac.awesomebar.suggestions")
|
|
|
|
|
|
|
|
.performScrollToNode(hasText(searchSuggestion))
|
|
|
|
|
|
|
|
.assertExists()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
} catch (e: AssertionError) {
|
|
|
|
} catch (e: AssertionError) {
|
|
|
|
if (i == RETRY_COUNT) {
|
|
|
|
if (i == RETRY_COUNT) {
|
|
|
|
throw e
|
|
|
|
throw e
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
expandSearchSuggestionsList()
|
|
|
|
mDevice.pressBack()
|
|
|
|
|
|
|
|
homeScreen {
|
|
|
|
|
|
|
|
}.openSearch {
|
|
|
|
|
|
|
|
typeSearch(searchTerm)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyNoSuggestionsAreDisplayed(rule: ComposeTestRule, searchSuggestion: String) {
|
|
|
|
fun verifyNoSuggestionsAreDisplayed(rule: ComposeTestRule, vararg searchSuggestions: String) {
|
|
|
|
rule.waitForIdle()
|
|
|
|
rule.waitForIdle()
|
|
|
|
|
|
|
|
for (searchSuggestion in searchSuggestions) {
|
|
|
|
assertFalse(
|
|
|
|
assertFalse(
|
|
|
|
mDevice.findObject(UiSelector().textContains(searchSuggestion))
|
|
|
|
mDevice.findObject(UiSelector().textContains(searchSuggestion))
|
|
|
|
.waitForExists(waitingTime),
|
|
|
|
.waitForExists(waitingTime),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyAllowSuggestionsInPrivateModeDialog() {
|
|
|
|
fun verifyAllowSuggestionsInPrivateModeDialog() {
|
|
|
@ -366,6 +376,16 @@ class SearchRobot {
|
|
|
|
SettingsSubMenuSearchRobot().interact()
|
|
|
|
SettingsSubMenuSearchRobot().interact()
|
|
|
|
return SettingsSubMenuSearchRobot.Transition()
|
|
|
|
return SettingsSubMenuSearchRobot.Transition()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun clickSearchSuggestion(searchSuggestion: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
|
|
|
mDevice.findObject(UiSelector().textContains(searchSuggestion)).also {
|
|
|
|
|
|
|
|
it.waitForExists(waitingTime)
|
|
|
|
|
|
|
|
it.clickAndWaitForNewWindow(waitingTimeShort)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|