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

Remove openNewTabAndEnterToBrowser() and replace it with enterURLAndEnterToBrowser() in the UI tests

This commit is contained in:
AndiAJ 2021-10-08 11:59:50 +03:00 committed by mergify[bot]
parent 19c4186f0a
commit 2eae152beb
3 changed files with 12 additions and 30 deletions

View File

@ -1,22 +1,21 @@
package org.mozilla.fenix.ui
import android.view.View
import androidx.test.espresso.IdlingRegistry
import org.mozilla.fenix.helpers.TestAssetHelper
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import android.view.View
import androidx.test.espresso.IdlingRegistry
import okhttp3.mockwebserver.MockWebServer
import org.junit.Rule
import org.junit.Before
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.ViewVisibilityIdlingResource
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar
@ -80,7 +79,7 @@ class SettingsAddonsTest {
val addonName = "uBlock Origin"
navigationToolbar {}
.openNewTabAndEnterToBrowser(defaultWebPage.url) {}
.enterURLAndEnterToBrowser(defaultWebPage.url) {}
.openThreeDotMenu {}
.openAddonsManagerMenu {
addonsListIdlingResource =

View File

@ -65,7 +65,7 @@ class TabbedBrowsingTest {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
navigationToolbar {
}.openNewTabAndEnterToBrowser(defaultWebPage.url) {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
mDevice.waitForIdle()
verifyTabCounter("1")
}.openTabDrawer {
@ -91,7 +91,7 @@ class TabbedBrowsingTest {
homeScreen {}.togglePrivateBrowsingMode()
navigationToolbar {
}.openNewTabAndEnterToBrowser(defaultWebPage.url) {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
mDevice.waitForIdle()
verifyTabCounter("1")
}.openTabDrawer {
@ -141,7 +141,8 @@ class TabbedBrowsingTest {
val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1)
navigationToolbar {
}.openNewTabAndEnterToBrowser(genericURL.url) {
}.enterURLAndEnterToBrowser(genericURL.url) {
mDevice.waitForIdle()
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
closeTab()
@ -183,7 +184,8 @@ class TabbedBrowsingTest {
homeScreen { }.togglePrivateBrowsingMode()
navigationToolbar {
}.openNewTabAndEnterToBrowser(genericURL.url) {
}.enterURLAndEnterToBrowser(genericURL.url) {
mDevice.waitForIdle()
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
verifyCloseTabsButton("Test_Page_1")

View File

@ -150,25 +150,6 @@ class NavigationToolbarRobot {
return TabDrawerRobot.Transition()
}
fun openNewTabAndEnterToBrowser(
url: Uri,
interact: BrowserRobot.() -> Unit
): BrowserRobot.Transition {
sessionLoadedIdlingResource = SessionLoadedIdlingResource()
mDevice.waitNotNull(Until.findObject(By.res("$packageName:id/toolbar")), waitingTime)
urlBar().click()
awesomeBar().setText(url.toString())
mDevice.pressEnter()
runWithIdleRes(sessionLoadedIdlingResource) {
onView(ViewMatchers.withResourceName("browserLayout"))
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_clear_view")),