mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/15259 UI test: waits for home screen to be visible
This commit is contained in:
parent
5e626c49c1
commit
488e18bfa6
@ -12,11 +12,6 @@ import android.os.Build
|
||||
import android.os.Environment
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.ViewAction
|
||||
import androidx.test.espresso.action.CoordinatesProvider
|
||||
import androidx.test.espresso.action.GeneralClickAction
|
||||
import androidx.test.espresso.action.Press
|
||||
import androidx.test.espresso.action.Tap
|
||||
import androidx.test.espresso.action.ViewActions.longClick
|
||||
import androidx.test.espresso.assertion.ViewAssertions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
@ -108,22 +103,6 @@ object TestHelper {
|
||||
}
|
||||
}
|
||||
|
||||
fun sendSingleTapToScreen(x: Int, y: Int): ViewAction? {
|
||||
return GeneralClickAction(
|
||||
Tap.SINGLE,
|
||||
CoordinatesProvider { view ->
|
||||
val screenPos = IntArray(2)
|
||||
view.getLocationOnScreen(screenPos)
|
||||
val screenX = screenPos[0] + x.toFloat()
|
||||
val screenY = screenPos[1] + y.toFloat()
|
||||
floatArrayOf(screenX, screenY)
|
||||
},
|
||||
Press.FINGER,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
// Remove test file from the device Downloads folder
|
||||
@Suppress("Deprecation")
|
||||
fun deleteDownloadFromStorage(fileName: String) {
|
||||
|
@ -16,7 +16,6 @@ import org.junit.Test
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||
import org.mozilla.fenix.helpers.TestHelper.sendSingleTapToScreen
|
||||
import org.mozilla.fenix.ui.robots.browserScreen
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
import org.mozilla.fenix.ui.robots.navigationToolbar
|
||||
@ -254,8 +253,6 @@ class TabbedBrowsingTest {
|
||||
notificationShade {
|
||||
verifyPrivateTabsNotification()
|
||||
}.clickClosePrivateTabsNotification {
|
||||
// Tap an empty spot on the app homescreen to make sure it's into focus
|
||||
sendSingleTapToScreen(20, 20)
|
||||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
|
@ -486,8 +486,11 @@ private fun assertFocusedNavigationToolbar() =
|
||||
onView(allOf(withHint("Search or enter address")))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
private fun assertHomeScreen() = onView(ViewMatchers.withResourceName("homeLayout"))
|
||||
private fun assertHomeScreen() {
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/homeLayout")).waitForExists(waitingTime)
|
||||
onView(ViewMatchers.withResourceName("homeLayout"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun assertHomeMenu() = onView(ViewMatchers.withResourceName("menuButton"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
@ -67,7 +67,7 @@ class NotificationRobot {
|
||||
|
||||
fun clickClosePrivateTabsNotification(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||
NotificationRobot().verifySystemNotificationExists("Close private tabs")
|
||||
closePrivateTabsNotification().clickAndWaitForNewWindow()
|
||||
closePrivateTabsNotification().click()
|
||||
|
||||
HomeScreenRobot().interact()
|
||||
return HomeScreenRobot.Transition()
|
||||
|
Loading…
Reference in New Issue
Block a user