* For #12752 & #12764: Fixes tabs tray behavior in UI tests * For #12637: fixes goBackTestmaster
parent
e809df0858
commit
6ab6f3efe9
|
@ -322,7 +322,6 @@ class BookmarksTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12752")
|
|
||||||
@Test
|
@Test
|
||||||
fun openSelectionInNewTabTest() {
|
fun openSelectionInNewTabTest() {
|
||||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||||
|
@ -331,7 +330,10 @@ class BookmarksTest {
|
||||||
createBookmark(defaultWebPage.url)
|
createBookmark(defaultWebPage.url)
|
||||||
}.openTabDrawer {
|
}.openTabDrawer {
|
||||||
closeTab()
|
closeTab()
|
||||||
}.openHomeScreen { }.openThreeDotMenu {
|
}
|
||||||
|
|
||||||
|
homeScreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
||||||
|
|
|
@ -11,7 +11,6 @@ import mozilla.components.browser.storage.sync.PlacesHistoryStorage
|
||||||
import okhttp3.mockwebserver.MockWebServer
|
import okhttp3.mockwebserver.MockWebServer
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Ignore
|
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||||
|
@ -204,7 +203,6 @@ class HistoryTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12752")
|
|
||||||
@Test
|
@Test
|
||||||
fun openHistoryInNewTabTest() {
|
fun openHistoryInNewTabTest() {
|
||||||
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||||
|
@ -214,7 +212,9 @@ class HistoryTest {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
}.openTabDrawer {
|
}.openTabDrawer {
|
||||||
closeTab()
|
closeTab()
|
||||||
}.openHomeScreen { }.openThreeDotMenu {
|
}
|
||||||
|
|
||||||
|
homeScreen { }.openThreeDotMenu {
|
||||||
}.openHistory {
|
}.openHistory {
|
||||||
longTapSelectItem(firstWebPage.url)
|
longTapSelectItem(firstWebPage.url)
|
||||||
openActionBarOverflowOrOptionsMenu(activityTestRule.activity)
|
openActionBarOverflowOrOptionsMenu(activityTestRule.activity)
|
||||||
|
|
|
@ -136,7 +136,7 @@ class MediaNotificationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12764")
|
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12645")
|
||||||
@Test
|
@Test
|
||||||
fun mediaSystemNotificationInPrivateModeTest() {
|
fun mediaSystemNotificationInPrivateModeTest() {
|
||||||
val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer)
|
val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer)
|
||||||
|
@ -160,7 +160,7 @@ class MediaNotificationTest {
|
||||||
verifyMediaIsPaused()
|
verifyMediaIsPaused()
|
||||||
}.openTabDrawer {
|
}.openTabDrawer {
|
||||||
closeTab()
|
closeTab()
|
||||||
}.openHomeScreen { }
|
}
|
||||||
|
|
||||||
mDevice.openNotification()
|
mDevice.openNotification()
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,10 @@ class NavigationToolbarTest {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
}.openNavigationToolbar {
|
}.openNavigationToolbar {
|
||||||
}.enterURLAndEnterToBrowser(nextWebPage.url) {
|
}.enterURLAndEnterToBrowser(nextWebPage.url) {
|
||||||
|
mDevice.waitForIdle()
|
||||||
verifyUrl(nextWebPage.url.toString())
|
verifyUrl(nextWebPage.url.toString())
|
||||||
mDevice.pressBack()
|
mDevice.pressBack()
|
||||||
|
mDevice.waitForIdle()
|
||||||
verifyUrl(defaultWebPage.url.toString())
|
verifyUrl(defaultWebPage.url.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.test.uiautomator.UiDevice
|
||||||
import okhttp3.mockwebserver.MockWebServer
|
import okhttp3.mockwebserver.MockWebServer
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
import org.junit.BeforeClass
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -53,6 +54,16 @@ class TabbedBrowsingTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click
|
||||||
|
companion object {
|
||||||
|
@BeforeClass
|
||||||
|
@JvmStatic
|
||||||
|
fun setDevicePreference() {
|
||||||
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||||
|
mDevice.executeShellCommand("settings put secure long_press_timeout 3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
mockWebServer.shutdown()
|
mockWebServer.shutdown()
|
||||||
|
@ -104,7 +115,6 @@ class TabbedBrowsingTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12752")
|
|
||||||
@Test
|
@Test
|
||||||
fun closeAllTabsTest() {
|
fun closeAllTabsTest() {
|
||||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||||
|
@ -119,7 +129,6 @@ class TabbedBrowsingTest {
|
||||||
verifySaveCollection()
|
verifySaveCollection()
|
||||||
}.closeAllTabs {
|
}.closeAllTabs {
|
||||||
verifyNoTabsOpened()
|
verifyNoTabsOpened()
|
||||||
}.openHomeScreen {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repeat for Private Tabs
|
// Repeat for Private Tabs
|
||||||
|
@ -135,8 +144,6 @@ class TabbedBrowsingTest {
|
||||||
verifyCloseAllTabsButton()
|
verifyCloseAllTabsButton()
|
||||||
}.closeAllTabs {
|
}.closeAllTabs {
|
||||||
verifyNoTabsOpened()
|
verifyNoTabsOpened()
|
||||||
}.openHomeScreen {
|
|
||||||
verifyPrivateSessionMessage()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ class HomeScreenRobot {
|
||||||
fun verifyHomeToolbar() = assertHomeToolbar()
|
fun verifyHomeToolbar() = assertHomeToolbar()
|
||||||
fun verifyHomeComponent() = assertHomeComponent()
|
fun verifyHomeComponent() = assertHomeComponent()
|
||||||
fun verifyDefaultSearchEngine(searchEngine: String) = verifySearchEngineIcon(searchEngine)
|
fun verifyDefaultSearchEngine(searchEngine: String) = verifySearchEngineIcon(searchEngine)
|
||||||
|
fun verifyNoTabsOpened() = assertNoTabsOpened()
|
||||||
|
|
||||||
// First Run elements
|
// First Run elements
|
||||||
fun verifyWelcomeHeader() = assertWelcomeHeader()
|
fun verifyWelcomeHeader() = assertWelcomeHeader()
|
||||||
|
@ -529,6 +530,8 @@ private fun assertHomeComponent() =
|
||||||
onView(ViewMatchers.withResourceName("sessionControlRecyclerView"))
|
onView(ViewMatchers.withResourceName("sessionControlRecyclerView"))
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
|
private fun assertNoTabsOpened() = onView(withId(R.id.counter_text)).check(matches(withText("0")))
|
||||||
|
|
||||||
private fun threeDotButton() = onView(allOf(withId(R.id.menuButton)))
|
private fun threeDotButton() = onView(allOf(withId(R.id.menuButton)))
|
||||||
|
|
||||||
private fun verifySearchEngineIcon(searchEngineIcon: Bitmap, searchEngineName: String) {
|
private fun verifySearchEngineIcon(searchEngineIcon: Bitmap, searchEngineName: String) {
|
||||||
|
|
|
@ -253,12 +253,11 @@ class ThreeDotMenuMainRobot {
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun closeAllTabs(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
|
fun closeAllTabs(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||||
// mDevice.waitNotNull(Until.findObject(By.text("Close all tabs")), waitingTime)
|
|
||||||
closeAllTabsButton().click()
|
closeAllTabsButton().click()
|
||||||
|
|
||||||
TabDrawerRobot().interact()
|
HomeScreenRobot().interact()
|
||||||
return TabDrawerRobot.Transition()
|
return HomeScreenRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openFindInPage(interact: FindInPageRobot.() -> Unit): FindInPageRobot.Transition {
|
fun openFindInPage(interact: FindInPageRobot.() -> Unit): FindInPageRobot.Transition {
|
||||||
|
|
Loading…
Reference in New Issue