2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

Bug 1877440 - Use only TestHelper snack bar verification function in UI tests

This commit is contained in:
AndiAJ 2024-01-30 16:07:11 +02:00 committed by mergify[bot]
parent ad3c92ab9d
commit df7f6cb4db
15 changed files with 13 additions and 32 deletions

View File

@ -34,6 +34,8 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
@ -103,14 +105,7 @@ object TestHelper {
).waitUntilGone(waitingTime)
}
fun verifySnackBarText(expectedText: String) {
assertTrue(
mDevice.findObject(
UiSelector()
.textContains(expectedText),
).waitForExists(waitingTime),
)
}
fun verifySnackBarText(expectedText: String) = assertUIObjectExists(itemContainingText(expectedText))
fun verifyUrl(urlSubstring: String, resourceName: String, resId: Int) {
waitUntilObjectIsFound(resourceName)

View File

@ -32,6 +32,7 @@ import org.mozilla.fenix.helpers.TestHelper.appContext
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem
import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.bookmarksMenu
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.homeScreen

View File

@ -18,6 +18,7 @@ import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.collectionRobot
import org.mozilla.fenix.ui.robots.homeScreen
@ -490,7 +491,7 @@ class CollectionTest {
selectTab(secondWebPage.title, numOfTabs = 2)
}.clickSaveCollection {
typeCollectionNameAndSave(collectionName)
verifySnackBarText("Tabs saved!")
verifySnackBarText("Collection saved!")
}
tabDrawer {

View File

@ -475,7 +475,7 @@ class ComposeCollectionTest {
verifyTabsMultiSelectionCounter(2)
}.clickSaveCollection {
typeCollectionNameAndSave(collectionName)
verifySnackBarText("Tabs saved!")
verifySnackBarText("Collection saved!")
}
composeTabDrawer(composeTestRule) {

View File

@ -23,6 +23,7 @@ import org.mozilla.fenix.helpers.MatcherHelper.itemWithText
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.clickContextMenuItem
import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.downloadRobot

View File

@ -22,6 +22,7 @@ import org.mozilla.fenix.helpers.MatcherHelper.itemWithText
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.clickContextMenuItem
import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.downloadRobot

View File

@ -20,6 +20,7 @@ import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.MatcherHelper.itemWithText
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.homeScreen

View File

@ -18,6 +18,7 @@ import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar

View File

@ -23,6 +23,7 @@ import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.closeApp
import org.mozilla.fenix.helpers.TestHelper.restartApp
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.homeScreen

View File

@ -20,6 +20,7 @@ import org.mozilla.fenix.helpers.DataGenerationHelper.getStringResource
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
import org.mozilla.fenix.helpers.TestHelper.clickSnackbarButton
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.helpers.TestHelper.waitUntilSnackbarGone
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.homeScreen

View File

@ -163,11 +163,6 @@ class BrowserRobot {
),
)
fun verifySnackBarText(expectedText: String) {
mDevice.waitForObjects(mDevice.findObject(UiSelector().textContains(expectedText)))
assertUIObjectExists(itemContainingText(expectedText))
}
fun verifyContextMenuForLocalHostLinks(containsURL: Uri) {
// If the link is directing to another local asset the "Download link" option is not available
// If the link is not re-directing to an external app the "Open link in external app" option is not available

View File

@ -169,9 +169,6 @@ class CollectionRobot {
Log.i(TAG, "swipeTabRight: Waited for rule to be idle")
}
fun verifySnackBarText(expectedText: String) =
itemContainingText(expectedText).waitForExists(waitingTime)
fun goBackInCollectionFlow() {
backButton().click()
Log.i(TAG, "goBackInCollectionFlow: Clicked collection creation flow back button")

View File

@ -290,10 +290,6 @@ class HomeScreenRobot {
fun swipeToTop() =
onView(withId(R.id.sessionControlRecyclerView)).perform(ViewActions.swipeDown())
fun verifySnackBarText(expectedText: String) {
mDevice.waitNotNull(findObject(By.text(expectedText)), waitingTime)
}
fun clickFirefoxLogo() = homepageWordmark().click()
fun verifyThoughtProvokingStories(enabled: Boolean) {

View File

@ -23,8 +23,6 @@ import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.Matchers
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.Constants
import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestHelper.mDevice
@ -101,11 +99,6 @@ class SettingsSubMenuHomepageRobot {
fun selectWallpaper(wallpaperName: String) =
mDevice.findObject(UiSelector().description(wallpaperName)).click()
fun verifySnackBarText(expectedText: String) =
assertUIObjectExists(
itemContainingText(expectedText),
)
fun verifySponsoredShortcutsCheckBox(checked: Boolean) = assertSponsoredShortcutsCheckBox(checked)
class Transition {

View File

@ -206,9 +206,6 @@ class TabDrawerRobot {
}
}
fun verifySnackBarText(expectedText: String) =
assertUIObjectExists(itemContainingText(expectedText))
fun snackBarButtonClick(expectedText: String) {
val snackBarButton =
mDevice.findObject(