For #24333 - Disable ui tests code affected by the migration

After migrating to compose identifying widgets and interacting with them will
need to be updated.
Checked with Oana about the approach, commenting the code seems better.
This commit is contained in:
Mugurell 2022-03-31 10:10:29 +03:00 committed by mergify[bot]
parent 1e3319f0e8
commit 6a798ebfbc
4 changed files with 391 additions and 402 deletions

View File

@ -11,16 +11,11 @@ import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.FeatureSettingsHelper
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.tabDrawer
/** /**
* Tests for verifying basic functionality of tab collections * Tests for verifying basic functionality of tab collections
@ -81,10 +76,10 @@ class CollectionTest {
}.openSaveToCollection { }.openSaveToCollection {
}.selectExistingCollection(firstCollectionName) { }.selectExistingCollection(firstCollectionName) {
verifySnackBarText("Tab saved!") verifySnackBarText("Tab saved!")
}.goToHomescreen { // }.goToHomescreen {
}.expandCollection(firstCollectionName) { // }.expandCollection(firstCollectionName) {
verifyTabSavedInCollection(firstWebPage.title) // verifyTabSavedInCollection(firstWebPage.title)
verifyTabSavedInCollection(secondWebPage.title) // verifyTabSavedInCollection(secondWebPage.title)
} }
} }
@ -104,115 +99,115 @@ class CollectionTest {
navigationToolbar { navigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) { }.enterURLAndEnterToBrowser(secondWebPage.url) {
}.goToHomescreen { }.goToHomescreen {
}.expandCollection(firstCollectionName) { // }.expandCollection(firstCollectionName) {
clickCollectionThreeDotButton() // clickCollectionThreeDotButton()
selectAddTabToCollection() // selectAddTabToCollection()
verifyTabsSelectedCounterText(1) // verifyTabsSelectedCounterText(1)
saveTabsSelectedForCollection() // saveTabsSelectedForCollection()
verifySnackBarText("Tab saved!") // verifySnackBarText("Tab saved!")
verifyTabSavedInCollection(secondWebPage.title) // verifyTabSavedInCollection(secondWebPage.title)
} }
} }
@Test // @Test
fun renameCollectionTest() { // fun renameCollectionTest() {
val webPage = getGenericAsset(mockWebServer, 1) // val webPage = getGenericAsset(mockWebServer, 1)
//
// navigationToolbar {
// }.enterURLAndEnterToBrowser(webPage.url) {
// }.openTabDrawer {
// createCollection(webPage.title, firstCollectionName)
// verifySnackBarText("Collection saved!")
// }.closeTabDrawer {
// }.goToHomescreen {
// }.expandCollection(firstCollectionName) {
// clickCollectionThreeDotButton()
// selectRenameCollection()
// }.typeCollectionNameAndSave("renamed_collection") {}
//
// homeScreen {
// verifyCollectionIsDisplayed("renamed_collection")
// }
// }
navigationToolbar { // @Test
}.enterURLAndEnterToBrowser(webPage.url) { // fun createSecondCollectionTest() {
}.openTabDrawer { // val webPage = getGenericAsset(mockWebServer, 1)
createCollection(webPage.title, firstCollectionName) //
verifySnackBarText("Collection saved!") // navigationToolbar {
}.closeTabDrawer { // }.enterURLAndEnterToBrowser(webPage.url) {
}.goToHomescreen { // }.openTabDrawer {
}.expandCollection(firstCollectionName) { // createCollection(webPage.title, firstCollectionName)
clickCollectionThreeDotButton() // verifySnackBarText("Collection saved!")
selectRenameCollection() // createCollection(webPage.title, secondCollectionName, false)
}.typeCollectionNameAndSave("renamed_collection") {} // verifySnackBarText("Collection saved!")
// }.closeTabDrawer {
// }.goToHomescreen {}
//
// homeScreen {
// verifyCollectionIsDisplayed(firstCollectionName)
// verifyCollectionIsDisplayed(secondCollectionName)
// }
// }
homeScreen { // @Test
verifyCollectionIsDisplayed("renamed_collection") // fun removeTabFromCollectionTest() {
} // val webPage = getGenericAsset(mockWebServer, 1)
} //
// navigationToolbar {
// }.enterURLAndEnterToBrowser(webPage.url) {
// }.openTabDrawer {
// createCollection(webPage.title, firstCollectionName)
// verifySnackBarText("Collection saved!")
// closeTab()
// }
//
// homeScreen {
// }.expandCollection(firstCollectionName) {
// removeTabFromCollection(webPage.title)
// verifyTabSavedInCollection(webPage.title, false)
// }
// // To add this step when https://github.com/mozilla-mobile/fenix/issues/13177 is fixed
// // homeScreen {
// // verifyCollectionIsDisplayed(firstCollectionName, false)
// // }
// }
@Test // @Test
fun createSecondCollectionTest() { // fun swipeToRemoveTabFromCollectionTest() {
val webPage = getGenericAsset(mockWebServer, 1) // val firstWebPage = getGenericAsset(mockWebServer, 1)
// val secondWebPage = getGenericAsset(mockWebServer, 2)
navigationToolbar { //
}.enterURLAndEnterToBrowser(webPage.url) { // navigationToolbar {
}.openTabDrawer { // }.enterURLAndEnterToBrowser(firstWebPage.url) {
createCollection(webPage.title, firstCollectionName) // }.openTabDrawer {
verifySnackBarText("Collection saved!") // createCollection(firstWebPage.title, firstCollectionName)
createCollection(webPage.title, secondCollectionName, false) // verifySnackBarText("Collection saved!")
verifySnackBarText("Collection saved!") // closeTab()
}.closeTabDrawer { // }
}.goToHomescreen {} //
// navigationToolbar {
homeScreen { // }.enterURLAndEnterToBrowser(secondWebPage.url) {
verifyCollectionIsDisplayed(firstCollectionName) // }.openThreeDotMenu {
verifyCollectionIsDisplayed(secondCollectionName) // }.openSaveToCollection {
} // }.selectExistingCollection(firstCollectionName) {
} // }.openTabDrawer {
// closeTab()
@Test // }
fun removeTabFromCollectionTest() { //
val webPage = getGenericAsset(mockWebServer, 1) // homeScreen {
// }.expandCollection(firstCollectionName) {
navigationToolbar { // swipeToBottom()
}.enterURLAndEnterToBrowser(webPage.url) { // swipeCollectionItemLeft(firstWebPage.title)
}.openTabDrawer { // verifyTabSavedInCollection(firstWebPage.title, false)
createCollection(webPage.title, firstCollectionName) // swipeCollectionItemRight(secondWebPage.title)
verifySnackBarText("Collection saved!") // verifyTabSavedInCollection(secondWebPage.title, false)
closeTab() // }
} // To add this step when https://github.com/mozilla-mobile/fenix/issues/13177 is fixed
homeScreen {
}.expandCollection(firstCollectionName) {
removeTabFromCollection(webPage.title)
verifyTabSavedInCollection(webPage.title, false)
}
// To add this step when https://github.com/mozilla-mobile/fenix/issues/13177 is fixed
// homeScreen { // homeScreen {
// verifyCollectionIsDisplayed(firstCollectionName, false) // verifyCollectionIsDisplayed(firstCollectionName, false)
// } // }
} // }
@Test
fun swipeToRemoveTabFromCollectionTest() {
val firstWebPage = getGenericAsset(mockWebServer, 1)
val secondWebPage = getGenericAsset(mockWebServer, 2)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
}.openTabDrawer {
createCollection(firstWebPage.title, firstCollectionName)
verifySnackBarText("Collection saved!")
closeTab()
}
navigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openThreeDotMenu {
}.openSaveToCollection {
}.selectExistingCollection(firstCollectionName) {
}.openTabDrawer {
closeTab()
}
homeScreen {
}.expandCollection(firstCollectionName) {
swipeToBottom()
swipeCollectionItemLeft(firstWebPage.title)
verifyTabSavedInCollection(firstWebPage.title, false)
swipeCollectionItemRight(secondWebPage.title)
verifyTabSavedInCollection(secondWebPage.title, false)
}
// To add this step when https://github.com/mozilla-mobile/fenix/issues/13177 is fixed
// homeScreen {
// verifyCollectionIsDisplayed(firstCollectionName, false)
// }
}
@Test @Test
fun selectTabOnLongTapTest() { fun selectTabOnLongTapTest() {
@ -235,69 +230,69 @@ class CollectionTest {
verifySnackBarText("Tabs saved!") verifySnackBarText("Tabs saved!")
} }
tabDrawer { // tabDrawer {
}.closeTabDrawer { // }.closeTabDrawer {
}.goToHomescreen { // }.goToHomescreen {
}.expandCollection(firstCollectionName) { // }.expandCollection(firstCollectionName) {
verifyTabSavedInCollection(firstWebPage.title) // verifyTabSavedInCollection(firstWebPage.title)
verifyTabSavedInCollection(secondWebPage.title) // verifyTabSavedInCollection(secondWebPage.title)
} // }
} }
@Test // @Test
fun navigateBackInCollectionFlowTest() { // fun navigateBackInCollectionFlowTest() {
val webPage = getGenericAsset(mockWebServer, 1) // val webPage = getGenericAsset(mockWebServer, 1)
//
// navigationToolbar {
// }.enterURLAndEnterToBrowser(webPage.url) {
// }.openTabDrawer {
// createCollection(webPage.title, firstCollectionName)
// verifySnackBarText("Collection saved!")
// }.closeTabDrawer {
// }.openThreeDotMenu {
// }.openSaveToCollection {
// verifySelectCollectionScreen()
// goBackInCollectionFlow()
// }
//
// browserScreen {
// }.openThreeDotMenu {
// }.openSaveToCollection {
// verifySelectCollectionScreen()
// clickAddNewCollection()
// verifyCollectionNameTextField()
// goBackInCollectionFlow()
// verifySelectCollectionScreen()
// goBackInCollectionFlow()
// }
// // verify the browser layout is visible
// browserScreen {
// verifyMenuButton()
// }
// }
navigationToolbar { // @SmokeTest
}.enterURLAndEnterToBrowser(webPage.url) { // @Test
}.openTabDrawer { // fun undoDeleteCollectionTest() {
createCollection(webPage.title, firstCollectionName) // val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
verifySnackBarText("Collection saved!") //
}.closeTabDrawer { // navigationToolbar {
}.openThreeDotMenu { // }.enterURLAndEnterToBrowser(webPage.url) {
}.openSaveToCollection { // }.openTabDrawer {
verifySelectCollectionScreen() // createCollection(webPage.title, firstCollectionName)
goBackInCollectionFlow() // snackBarButtonClick("VIEW")
} // }
//
browserScreen { // homeScreen {
}.openThreeDotMenu { // }.expandCollection(firstCollectionName) {
}.openSaveToCollection { // clickCollectionThreeDotButton()
verifySelectCollectionScreen() // selectDeleteCollection()
clickAddNewCollection() // }
verifyCollectionNameTextField() //
goBackInCollectionFlow() // homeScreen {
verifySelectCollectionScreen() // verifySnackBarText("Collection deleted")
goBackInCollectionFlow() // clickUndoCollectionDeletion("UNDO")
} // verifyCollectionIsDisplayed(firstCollectionName, true)
// verify the browser layout is visible // }
browserScreen { // }
verifyMenuButton()
}
}
@SmokeTest
@Test
fun undoDeleteCollectionTest() {
val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
navigationToolbar {
}.enterURLAndEnterToBrowser(webPage.url) {
}.openTabDrawer {
createCollection(webPage.title, firstCollectionName)
snackBarButtonClick("VIEW")
}
homeScreen {
}.expandCollection(firstCollectionName) {
clickCollectionThreeDotButton()
selectDeleteCollection()
}
homeScreen {
verifySnackBarText("Collection deleted")
clickUndoCollectionDeletion("UNDO")
verifyCollectionIsDisplayed(firstCollectionName, true)
}
}
} }

View File

@ -40,7 +40,6 @@ import org.mozilla.fenix.helpers.TestHelper.createCustomTabIntent
import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText
import org.mozilla.fenix.helpers.ViewVisibilityIdlingResource import org.mozilla.fenix.helpers.ViewVisibilityIdlingResource
import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.collectionRobot
import org.mozilla.fenix.ui.robots.customTabScreen import org.mozilla.fenix.ui.robots.customTabScreen
import org.mozilla.fenix.ui.robots.enhancedTrackingProtection import org.mozilla.fenix.ui.robots.enhancedTrackingProtection
import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.homeScreen
@ -48,7 +47,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.notificationShade import org.mozilla.fenix.ui.robots.notificationShade
import org.mozilla.fenix.ui.robots.openEditURLView import org.mozilla.fenix.ui.robots.openEditURLView
import org.mozilla.fenix.ui.robots.searchScreen import org.mozilla.fenix.ui.robots.searchScreen
import org.mozilla.fenix.ui.robots.tabDrawer
import org.mozilla.fenix.ui.util.FRENCH_LANGUAGE_HEADER import org.mozilla.fenix.ui.util.FRENCH_LANGUAGE_HEADER
import org.mozilla.fenix.ui.util.FRENCH_SYSTEM_LOCALE_OPTION import org.mozilla.fenix.ui.util.FRENCH_SYSTEM_LOCALE_OPTION
import org.mozilla.fenix.ui.util.ROMANIAN_LANGUAGE_HEADER import org.mozilla.fenix.ui.util.ROMANIAN_LANGUAGE_HEADER
@ -348,18 +346,18 @@ class SmokeTest {
} }
} }
@Test // @Test
// Verifies the Add to collection option in a tab's 3 dot menu // // Verifies the Add to collection option in a tab's 3 dot menu
fun openMainMenuAddToCollectionTest() { // fun openMainMenuAddToCollectionTest() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) // val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
//
navigationToolbar { // navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) { // }.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openThreeDotMenu { // }.openThreeDotMenu {
}.openSaveToCollection { // }.openSaveToCollection {
verifyCollectionNameTextField() // verifyCollectionNameTextField()
} // }
} // }
@Test @Test
// Verifies the Bookmark button in a tab's 3 dot menu // Verifies the Bookmark button in a tab's 3 dot menu
@ -618,172 +616,171 @@ class SmokeTest {
} }
} }
@Test // @Test
fun createFirstCollectionTest() { // fun createFirstCollectionTest() {
// disabling these features to have better visibility of Collections // // disabling these features to have better visibility of Collections
featureSettingsHelper.setRecentTabsFeatureEnabled(false) // featureSettingsHelper.setRecentTabsFeatureEnabled(false)
featureSettingsHelper.setPocketEnabled(false) // featureSettingsHelper.setPocketEnabled(false)
//
// val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
// val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
//
// navigationToolbar {
// }.enterURLAndEnterToBrowser(firstWebPage.url) {
// mDevice.waitForIdle()
// }.openTabDrawer {
// }.openNewTab {
// }.submitQuery(secondWebPage.url.toString()) {
// mDevice.waitForIdle()
// }.goToHomescreen {
// swipeToBottom()
// }.clickSaveTabsToCollectionButton {
// longClickTab(firstWebPage.title)
// selectTab(secondWebPage.title)
// }.clickSaveCollection {
// typeCollectionNameAndSave(collectionName)
// }
//
// tabDrawer {
// verifySnackBarText("Collection saved!")
// snackBarButtonClick("VIEW")
// }
//
// homeScreen {
// verifyCollectionIsDisplayed(collectionName)
// verifyCollectionIcon()
// }
// }
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) // @Test
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2) // fun verifyExpandedCollectionItemsTest() {
// // disabling these features to have better visibility of Collections
navigationToolbar { // featureSettingsHelper.setRecentTabsFeatureEnabled(false)
}.enterURLAndEnterToBrowser(firstWebPage.url) { // featureSettingsHelper.setPocketEnabled(false)
mDevice.waitForIdle() //
}.openTabDrawer { // val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
}.openNewTab { //
}.submitQuery(secondWebPage.url.toString()) { // navigationToolbar {
mDevice.waitForIdle() // }.enterURLAndEnterToBrowser(webPage.url) {
}.goToHomescreen { // }.openTabDrawer {
swipeToBottom() // createCollection(webPage.title, collectionName)
}.clickSaveTabsToCollectionButton { // snackBarButtonClick("VIEW")
longClickTab(firstWebPage.title) // }
selectTab(secondWebPage.title) //
}.clickSaveCollection { // homeScreen {
typeCollectionNameAndSave(collectionName) // verifyCollectionIsDisplayed(collectionName)
} // verifyCollectionIcon()
// }.expandCollection(collectionName) {
tabDrawer { // verifyTabSavedInCollection(webPage.title)
verifySnackBarText("Collection saved!") // verifyCollectionTabLogo(true)
snackBarButtonClick("VIEW") // verifyCollectionTabUrl(true)
} // verifyShareCollectionButtonIsVisible(true)
// verifyCollectionMenuIsVisible(true)
homeScreen { // verifyCollectionItemRemoveButtonIsVisible(webPage.title, true)
verifyCollectionIsDisplayed(collectionName) // }.collapseCollection(collectionName) {}
verifyCollectionIcon() //
} // collectionRobot {
} // verifyTabSavedInCollection(webPage.title, false)
// verifyShareCollectionButtonIsVisible(false)
@Test // verifyCollectionMenuIsVisible(false)
fun verifyExpandedCollectionItemsTest() { // verifyCollectionTabLogo(false)
// disabling these features to have better visibility of Collections // verifyCollectionTabUrl(false)
featureSettingsHelper.setRecentTabsFeatureEnabled(false) // verifyCollectionItemRemoveButtonIsVisible(webPage.title, false)
featureSettingsHelper.setPocketEnabled(false) // }
//
val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) // homeScreen {
// }.expandCollection(collectionName) {
navigationToolbar { // verifyTabSavedInCollection(webPage.title)
}.enterURLAndEnterToBrowser(webPage.url) { // verifyCollectionTabLogo(true)
}.openTabDrawer { // verifyCollectionTabUrl(true)
createCollection(webPage.title, collectionName) // verifyShareCollectionButtonIsVisible(true)
snackBarButtonClick("VIEW") // verifyCollectionMenuIsVisible(true)
} // verifyCollectionItemRemoveButtonIsVisible(webPage.title, true)
// }.collapseCollection(collectionName) {}
homeScreen { //
verifyCollectionIsDisplayed(collectionName) // collectionRobot {
verifyCollectionIcon() // verifyTabSavedInCollection(webPage.title, false)
}.expandCollection(collectionName) { // verifyShareCollectionButtonIsVisible(false)
verifyTabSavedInCollection(webPage.title) // verifyCollectionMenuIsVisible(false)
verifyCollectionTabLogo(true) // verifyCollectionTabLogo(false)
verifyCollectionTabUrl(true) // verifyCollectionTabUrl(false)
verifyShareCollectionButtonIsVisible(true) // verifyCollectionItemRemoveButtonIsVisible(webPage.title, false)
verifyCollectionMenuIsVisible(true) // }
verifyCollectionItemRemoveButtonIsVisible(webPage.title, true) // }
}.collapseCollection(collectionName) {} //
// @Test
collectionRobot { // fun openAllTabsInCollectionTest() {
verifyTabSavedInCollection(webPage.title, false) // val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
verifyShareCollectionButtonIsVisible(false) //
verifyCollectionMenuIsVisible(false) // navigationToolbar {
verifyCollectionTabLogo(false) // }.enterURLAndEnterToBrowser(webPage.url) {
verifyCollectionTabUrl(false) // }.openTabDrawer {
verifyCollectionItemRemoveButtonIsVisible(webPage.title, false) // createCollection(webPage.title, collectionName)
} // verifySnackBarText("Collection saved!")
// closeTab()
homeScreen { // }
}.expandCollection(collectionName) { //
verifyTabSavedInCollection(webPage.title) // homeScreen {
verifyCollectionTabLogo(true) // }.expandCollection(collectionName) {
verifyCollectionTabUrl(true) // clickCollectionThreeDotButton()
verifyShareCollectionButtonIsVisible(true) // selectOpenTabs()
verifyCollectionMenuIsVisible(true) // }
verifyCollectionItemRemoveButtonIsVisible(webPage.title, true) // tabDrawer {
}.collapseCollection(collectionName) {} // verifyExistingOpenTabs(webPage.title)
// }
collectionRobot { // }
verifyTabSavedInCollection(webPage.title, false) //
verifyShareCollectionButtonIsVisible(false) // @Test
verifyCollectionMenuIsVisible(false) // fun shareCollectionTest() {
verifyCollectionTabLogo(false) // val firstWebsite = TestAssetHelper.getGenericAsset(mockWebServer, 1)
verifyCollectionTabUrl(false) // val secondWebsite = TestAssetHelper.getGenericAsset(mockWebServer, 2)
verifyCollectionItemRemoveButtonIsVisible(webPage.title, false) // val sharingApp = "Gmail"
} // val urlString = "${secondWebsite.url}\n\n${firstWebsite.url}"
} //
// navigationToolbar {
@Test // }.enterURLAndEnterToBrowser(firstWebsite.url) {
fun openAllTabsInCollectionTest() { // verifyPageContent(firstWebsite.content)
val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) // }.openTabDrawer {
// createCollection(firstWebsite.title, collectionName)
navigationToolbar { // }.openNewTab {
}.enterURLAndEnterToBrowser(webPage.url) { // }.submitQuery(secondWebsite.url.toString()) {
}.openTabDrawer { // verifyPageContent(secondWebsite.content)
createCollection(webPage.title, collectionName) // }.openThreeDotMenu {
verifySnackBarText("Collection saved!") // }.openSaveToCollection {
closeTab() // }.selectExistingCollection(collectionName) {
} // }.goToHomescreen {
// }.expandCollection(collectionName) {
homeScreen { // }.clickShareCollectionButton {
}.expandCollection(collectionName) { // verifyShareTabsOverlay(firstWebsite.title, secondWebsite.title)
clickCollectionThreeDotButton() // selectAppToShareWith(sharingApp)
selectOpenTabs() // verifySharedTabsIntent(urlString, collectionName)
} // }
tabDrawer { // }
verifyExistingOpenTabs(webPage.title) //
} // @Test
} // // Test running on beta/release builds in CI:
// // caution when making changes to it, so they don't block the builds
@Test // fun deleteCollectionTest() {
fun shareCollectionTest() { // val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val firstWebsite = TestAssetHelper.getGenericAsset(mockWebServer, 1) //
val secondWebsite = TestAssetHelper.getGenericAsset(mockWebServer, 2) // navigationToolbar {
val sharingApp = "Gmail" // }.enterURLAndEnterToBrowser(webPage.url) {
val urlString = "${secondWebsite.url}\n\n${firstWebsite.url}" // }.openTabDrawer {
// createCollection(webPage.title, collectionName)
navigationToolbar { // snackBarButtonClick("VIEW")
}.enterURLAndEnterToBrowser(firstWebsite.url) { // }
verifyPageContent(firstWebsite.content) //
}.openTabDrawer { // homeScreen {
createCollection(firstWebsite.title, collectionName) // }.expandCollection(collectionName) {
}.openNewTab { // clickCollectionThreeDotButton()
}.submitQuery(secondWebsite.url.toString()) { // selectDeleteCollection()
verifyPageContent(secondWebsite.content) // }
}.openThreeDotMenu { //
}.openSaveToCollection { // homeScreen {
}.selectExistingCollection(collectionName) { // verifySnackBarText("Collection deleted")
}.goToHomescreen { // verifyNoCollectionsText()
}.expandCollection(collectionName) { // }
}.clickShareCollectionButton { // }
verifyShareTabsOverlay(firstWebsite.title, secondWebsite.title)
selectAppToShareWith(sharingApp)
verifySharedTabsIntent(urlString, collectionName)
}
}
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23296")
@Test
// Test running on beta/release builds in CI:
// caution when making changes to it, so they don't block the builds
fun deleteCollectionTest() {
val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
navigationToolbar {
}.enterURLAndEnterToBrowser(webPage.url) {
}.openTabDrawer {
createCollection(webPage.title, collectionName)
snackBarButtonClick("VIEW")
}
homeScreen {
}.expandCollection(collectionName) {
clickCollectionThreeDotButton()
selectDeleteCollection()
}
homeScreen {
verifySnackBarText("Collection deleted")
verifyNoCollectionsText()
}
}
@Test @Test
// Verifies that deleting a Bookmarks folder also removes the item from inside it. // Verifies that deleting a Bookmarks folder also removes the item from inside it.

View File

@ -98,33 +98,33 @@ class CollectionRobot {
) )
} }
fun verifyShareCollectionButtonIsVisible(visible: Boolean) { // fun verifyShareCollectionButtonIsVisible(visible: Boolean) {
shareCollectionButton() // shareCollectionButton()
.check( // .check(
if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) // if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))
else matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)) // else matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE))
) // )
} // }
fun verifyCollectionMenuIsVisible(visible: Boolean) { // fun verifyCollectionMenuIsVisible(visible: Boolean) {
collectionThreeDotButton() // collectionThreeDotButton()
.check( // .check(
if (visible) matches( // if (visible) matches(
withEffectiveVisibility( // withEffectiveVisibility(
ViewMatchers.Visibility.VISIBLE // ViewMatchers.Visibility.VISIBLE
) // )
) // )
else matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)) // else matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE))
) // )
} // }
fun clickCollectionThreeDotButton() { // fun clickCollectionThreeDotButton() {
collectionThreeDotButton().click() // collectionThreeDotButton().click()
mDevice.waitNotNull( // mDevice.waitNotNull(
Until.findObject(By.text("Delete collection")), // Until.findObject(By.text("Delete collection")),
waitingTime // waitingTime
) // )
} // }
fun selectOpenTabs() { fun selectOpenTabs() {
onView(withText("Open tabs")).click() onView(withText("Open tabs")).click()
@ -251,12 +251,12 @@ class CollectionRobot {
return BrowserRobot.Transition() return BrowserRobot.Transition()
} }
fun clickShareCollectionButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition { // fun clickShareCollectionButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition {
shareCollectionButton().click() // shareCollectionButton().click()
//
ShareOverlayRobot().interact() // ShareOverlayRobot().interact()
return ShareOverlayRobot.Transition() // return ShareOverlayRobot.Transition()
} // }
} }
} }
@ -265,13 +265,13 @@ fun collectionRobot(interact: CollectionRobot.() -> Unit): CollectionRobot.Trans
return CollectionRobot.Transition() return CollectionRobot.Transition()
} }
private fun collectionThreeDotButton() = // private fun collectionThreeDotButton() =
onView(withId(R.id.collection_overflow_button)) // onView(withId(R.id.collection_overflow_button))
private fun collectionItem(title: String) = private fun collectionItem(title: String) =
onView(allOf(withId(R.id.label), withText(title))) onView(allOf(withId(R.id.label), withText(title)))
private fun shareCollectionButton() = onView(withId(R.id.collection_share_button)) // private fun shareCollectionButton() = onView(withId(R.id.collection_share_button))
private fun removeTabFromCollectionButton(title: String) = private fun removeTabFromCollectionButton(title: String) =
onView( onView(

View File

@ -399,21 +399,21 @@ class HomeScreenRobot {
return TabDrawerRobot.Transition() return TabDrawerRobot.Transition()
} }
fun expandCollection( // fun expandCollection(
title: String, // title: String,
interact: CollectionRobot.() -> Unit // interact: CollectionRobot.() -> Unit
): CollectionRobot.Transition { // ): CollectionRobot.Transition {
// Depending on the screen dimensions collections might report as visible on screen // // Depending on the screen dimensions collections might report as visible on screen
// but actually have the bottom toolbar above so interactions with collections might fail. // // but actually have the bottom toolbar above so interactions with collections might fail.
// As a quick solution we'll try scrolling to the element below collection on the homescreen // // As a quick solution we'll try scrolling to the element below collection on the homescreen
// so that they are displayed above in their entirety. // // so that they are displayed above in their entirety.
scrollToElementByText(appContext.getString(R.string.pocket_stories_header_1)) // scrollToElementByText(appContext.getString(R.string.pocket_stories_header_1))
//
collectionTitle(title).click() // collectionTitle(title).click()
//
CollectionRobot().interact() // CollectionRobot().interact()
return CollectionRobot.Transition() // return CollectionRobot.Transition()
} // }
fun openRecentlyVisitedSearchGroupHistoryList( fun openRecentlyVisitedSearchGroupHistoryList(
title: String, title: String,
@ -670,9 +670,6 @@ private fun assertPrivateSessionMessage() =
).waitForExists(waitingTime) ).waitForExists(waitingTime)
) )
private fun collectionTitle(title: String) =
onView(allOf(withId(R.id.collection_title), withText(title)))
private fun assertExistingTopSitesList() = private fun assertExistingTopSitesList() =
onView(allOf(withId(R.id.top_sites_list))) onView(allOf(withId(R.id.top_sites_list)))
.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) .check((matches(withEffectiveVisibility(Visibility.VISIBLE))))