|
|
|
@ -20,6 +20,7 @@ import org.mozilla.fenix.customannotations.SmokeTest
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants
|
|
|
|
|
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper
|
|
|
|
|
import org.mozilla.fenix.helpers.MockBrowserDataHelper.createBookmarkItem
|
|
|
|
|
import org.mozilla.fenix.helpers.MockBrowserDataHelper.createTabItem
|
|
|
|
|
import org.mozilla.fenix.helpers.MockBrowserDataHelper.setCustomSearchEngine
|
|
|
|
|
import org.mozilla.fenix.helpers.SearchDispatcher
|
|
|
|
@ -559,7 +560,13 @@ class ComposeSearchTest {
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.openHistory {
|
|
|
|
|
// Full URL no longer visible in the nav bar, so we'll check the history record
|
|
|
|
|
verifyHistoryItemExists(shouldExist = true, Constants.searchEngineCodes["Google"]!!)
|
|
|
|
|
// A search group is sometimes created when searching with Google (probably redirects)
|
|
|
|
|
try {
|
|
|
|
|
verifyHistoryItemExists(shouldExist = true, Constants.searchEngineCodes["Google"]!!)
|
|
|
|
|
} catch (e: AssertionError) {
|
|
|
|
|
openSearchGroup(queryString)
|
|
|
|
|
verifyHistoryItemExists(shouldExist = true, Constants.searchEngineCodes["Google"]!!)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -657,11 +664,14 @@ class ComposeSearchTest {
|
|
|
|
|
clickClearButton()
|
|
|
|
|
typeSearch(searchTerm = "generic")
|
|
|
|
|
verifyTypedToolbarText("generic")
|
|
|
|
|
verifyFirefoxSuggestResults(
|
|
|
|
|
verifySearchEngineSuggestionResults(
|
|
|
|
|
rule = activityTestRule,
|
|
|
|
|
searchSuggestions = arrayOf(
|
|
|
|
|
"Firefox Suggest",
|
|
|
|
|
firstPageUrl.url.toString(),
|
|
|
|
|
secondPageUrl.url.toString(),
|
|
|
|
|
),
|
|
|
|
|
searchTerm = "generic",
|
|
|
|
|
firstPageUrl.url.toString(),
|
|
|
|
|
secondPageUrl.url.toString(),
|
|
|
|
|
)
|
|
|
|
|
}.clickSearchSuggestion(firstPageUrl.url.toString()) {
|
|
|
|
|
verifyTabCounter("2")
|
|
|
|
@ -670,4 +680,53 @@ class ComposeSearchTest {
|
|
|
|
|
verifyOpenTabsOrder(position = 2, title = secondPageUrl.url.toString())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun verifySearchForBookmarksUITest() {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.clickSearchSelectorButton {
|
|
|
|
|
selectTemporarySearchMethod("Bookmarks")
|
|
|
|
|
verifySearchBarPlaceholder("Search bookmarks")
|
|
|
|
|
verifyKeyboardVisibility(isExpectedToBeVisible = true)
|
|
|
|
|
verifyScanButtonVisibility(visible = false)
|
|
|
|
|
verifyVoiceSearchButtonVisibility(enabled = true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun bookmarkSearchWithNoBookmarksTest() {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.clickSearchSelectorButton {
|
|
|
|
|
selectTemporarySearchMethod("Bookmarks")
|
|
|
|
|
typeSearch("test")
|
|
|
|
|
verifyNoSuggestionsAreDisplayed(activityTestRule, "test")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun bookmarkSearchWhenBookmarksExistTest() {
|
|
|
|
|
createBookmarkItem(url = "https://bookmarktest1.com", title = "Test1", position = 1u)
|
|
|
|
|
createBookmarkItem(url = "https://bookmarktest2.com", title = "Test2", position = 2u)
|
|
|
|
|
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.clickSearchSelectorButton {
|
|
|
|
|
selectTemporarySearchMethod("Bookmarks")
|
|
|
|
|
typeSearch("test")
|
|
|
|
|
verifySearchEngineSuggestionResults(
|
|
|
|
|
activityTestRule,
|
|
|
|
|
searchSuggestions = arrayOf(
|
|
|
|
|
"Firefox Suggest",
|
|
|
|
|
"Test1",
|
|
|
|
|
"https://bookmarktest1.com/",
|
|
|
|
|
"Test2",
|
|
|
|
|
"https://bookmarktest2.com/",
|
|
|
|
|
),
|
|
|
|
|
searchTerm = "test",
|
|
|
|
|
)
|
|
|
|
|
}.dismissSearchBar {
|
|
|
|
|
}.openSearch {
|
|
|
|
|
typeSearch("mozilla ")
|
|
|
|
|
verifyNoSuggestionsAreDisplayed(activityTestRule, "Test1", "Test2")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|