2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1841587 - Fix suggestions timing in verifySearchForBookmarkedItemsTest & verifySearchForHistoryItemsTest

This commit is contained in:
oana.horvath 2023-07-31 15:15:00 +03:00 committed by mergify[bot]
parent 1b1ce07590
commit 35962ab6b1
3 changed files with 33 additions and 23 deletions

View File

@ -19,18 +19,23 @@ import org.junit.Test
import org.mozilla.fenix.R
import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.ext.bookmarkStorage
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.MockBrowserDataHelper.createBookmarkItem
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestHelper.appContext
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.exitMenu
import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem
import org.mozilla.fenix.helpers.TestHelper.registerAndCleanupIdlingResources
import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.ui.robots.bookmarksMenu
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.clearTextFieldItem
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.multipleSelectionToolbar
import org.mozilla.fenix.ui.robots.navigationToolbar
@ -790,28 +795,27 @@ class BookmarksTest {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
createBookmarkItem(firstWebPage.url.toString(), firstWebPage.title, 1u)
createBookmarkItem(secondWebPage.url.toString(), secondWebPage.title, 2u)
homeScreen {
}.openThreeDotMenu {
}.openBookmarks {
createFolder(bookmarksFolderName)
}
exitMenu()
browserScreen {
createBookmark(firstWebPage.url, bookmarksFolderName)
createBookmark(secondWebPage.url)
}.openThreeDotMenu {
}.openBookmarks {
}.clickSearchButton {
// Search for a valid term
typeSearch(firstWebPage.title)
verifySearchEngineSuggestionResults(activityTestRule, firstWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(activityTestRule, secondWebPage.url.toString())
}.dismissSearchBar {}
bookmarksMenu {
}.clickSearchButton {
// Search for invalid term
typeSearch("Android")
verifyNoSuggestionsAreDisplayed(activityTestRule, firstWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(activityTestRule, secondWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(
activityTestRule,
firstWebPage.url.toString(),
secondWebPage.url.toString()
)
}
}

View File

@ -23,6 +23,7 @@ import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.MockBrowserDataHelper
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.exitMenu
@ -396,23 +397,27 @@ class HistoryTest {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
}
navigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
MockBrowserDataHelper.createHistoryItem(firstWebPage.url.toString())
MockBrowserDataHelper.createHistoryItem(secondWebPage.url.toString())
homeScreen {
}.openThreeDotMenu {
}.openHistory {
}.clickSearchButton {
// Search for a valid term
typeSearch(firstWebPage.title)
typeSearch("generic")
verifySearchEngineSuggestionResults(activityTestRule, firstWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(activityTestRule, secondWebPage.url.toString())
clickClearButton()
}.dismissSearchBar {}
historyMenu {
}.clickSearchButton {
// Search for invalid term
typeSearch("Android")
verifyNoSuggestionsAreDisplayed(activityTestRule, firstWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(activityTestRule, secondWebPage.url.toString())
verifyNoSuggestionsAreDisplayed(
activityTestRule,
firstWebPage.url.toString(),
secondWebPage.url.toString(),
)
}
}

View File

@ -35,6 +35,7 @@ import org.mozilla.fenix.helpers.MatcherHelper.itemWithDescription
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
import org.mozilla.fenix.helpers.SessionLoadedIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
import org.mozilla.fenix.helpers.TestHelper.getStringResource
import org.mozilla.fenix.helpers.TestHelper.grantSystemPermission
@ -96,7 +97,7 @@ class SearchRobot {
try {
assertTrue(
mDevice.findObject(UiSelector().textContains(searchSuggestion))
.waitForExists(waitingTime),
.waitForExists(waitingTimeLong),
)
break
} catch (e: AssertionError) {
@ -140,7 +141,7 @@ class SearchRobot {
for (searchSuggestion in searchSuggestions) {
assertTrue(
mDevice.findObject(UiSelector().textContains(searchSuggestion))
.waitUntilGone(waitingTimeShort),
.waitUntilGone(waitingTimeLong),
)
}
}