Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Replaces verifyPageContent in UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Oana Horvath committed Jul 13, 2020
1 parent 5172805 commit 9054dbb
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 97 deletions.
1 change: 1 addition & 0 deletions app/src/androidTest/assets/pages/refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
} else {
setCookie("REFRESHED");
return "REFRESHED";

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class BookmarksTest {
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
}.openThreeDotMenu(defaultWebPage.url) {
}.clickOpenInNewTab {
// verifyPageContent(defaultWebPage.content)
verifyUrl(defaultWebPage.url.toString())
}.openTabDrawer {
verifyNormalModeSelected()
}
Expand All @@ -252,7 +252,7 @@ class BookmarksTest {
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
}.openThreeDotMenu(defaultWebPage.url) {
}.clickOpenInPrivateTab {
// verifyPageContent(defaultWebPage.content)
verifyUrl(defaultWebPage.url.toString())
}.openTabDrawer {
verifyPrivateModeSelected()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("Link 1")
verifyLinkContextMenuItems(genericURL.url)
clickContextOpenLinkInNewTab()
Expand All @@ -83,7 +83,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("Link 2")
verifyLinkContextMenuItems(genericURL.url)
clickContextOpenLinkInPrivateTab()
Expand All @@ -105,7 +105,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("Link 3")
verifyLinkContextMenuItems(genericURL.url)
clickContextCopyLink()
Expand All @@ -125,12 +125,13 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("Link 1")
verifyLinkContextMenuItems(genericURL.url)
clickContextShareLink(genericURL.url) // verify share intent is matched with associated URL
}
}

@Ignore("Intermittent: https://github.com/mozilla-mobile/fenix/issues/12367")
@Test
fun verifyContextOpenImageNewTab() {
Expand All @@ -141,7 +142,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("test_link_image")
verifyLinkImageContextMenuItems(imageResource.url)
clickContextOpenImageNewTab()
Expand All @@ -161,7 +162,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("test_link_image")
verifyLinkImageContextMenuItems(imageResource.url)
clickContextCopyImageLocation()
Expand All @@ -182,7 +183,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("test_link_image")
verifyLinkImageContextMenuItems(imageResource.url)
clickContextSaveImage()
Expand All @@ -209,7 +210,7 @@ class ContextMenusTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
// verifyPageContent(pageLinks.content)
mDevice.waitForIdle()
longClickMatchingText("Link 1")
verifyLinkContextMenuItems(genericURL.url)
dismissContentContextMenu(genericURL.url)
Expand Down
4 changes: 2 additions & 2 deletions app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DownloadTest {

navigationToolbar {
}.openNewTabAndEnterToBrowser(defaultWebPage.url) {
// verifyPageContent(defaultWebPage.content)
mDevice.waitForIdle()
clickLinkMatchingText(defaultWebPage.content)
}

Expand All @@ -100,7 +100,7 @@ class DownloadTest {

navigationToolbar {
}.openNewTabAndEnterToBrowser(defaultWebPage.url) {
// verifyPageContent(defaultWebPage.content)
mDevice.waitForIdle()
clickLinkMatchingText(defaultWebPage.content)
}

Expand Down
30 changes: 15 additions & 15 deletions app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper.longTapSelectItem
import org.mozilla.fenix.ui.robots.historyMenu
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.mDevice
import org.mozilla.fenix.ui.robots.multipleSelectionToolbar
import org.mozilla.fenix.ui.robots.navigationToolbar

Expand Down Expand Up @@ -70,7 +71,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
verifyHistoryMenuView()
Expand All @@ -86,7 +87,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
}.openThreeDotMenu {
Expand All @@ -101,7 +102,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
}.openThreeDotMenu {
Expand All @@ -119,12 +120,12 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
}.openThreeDotMenu {
}.clickOpenInNormalTab {
// verifyPageContent(firstWebPage.content)
verifyUrl(firstWebPage.url.toString())
}.openTabDrawer {
verifyNormalModeSelected()
}
Expand All @@ -136,12 +137,12 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
}.openThreeDotMenu {
}.clickOpenInPrivateTab {
// verifyPageContent(firstWebPage.content)
verifyUrl(firstWebPage.url.toString())
}.openTabDrawer {
verifyPrivateModeSelected()
}
Expand All @@ -153,7 +154,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
}.openThreeDotMenu {
Expand All @@ -168,7 +169,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
clickDeleteHistoryButton()
Expand All @@ -184,7 +185,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
longTapSelectItem(firstWebPage.url)
Expand All @@ -206,7 +207,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openTabDrawer {
closeTab()
}.openHomeScreen { }.openThreeDotMenu {
Expand All @@ -228,7 +229,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
longTapSelectItem(firstWebPage.url)
Expand All @@ -249,12 +250,11 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
}.openTabDrawer { }.openHomeScreen { }

navigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
// verifyPageContent("Page content: 2")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
longTapSelectItem(firstWebPage.url)
Expand All @@ -277,7 +277,7 @@ class HistoryTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
// verifyPageContent("Page content: 1")
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openHistory {
longTapSelectItem(firstWebPage.url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ class MediaNotificationTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(videoTestPage.url) {
// verifyPageContent(videoTestPage.content)
mDevice.waitForIdle()
clickMediaPlayerPlayButton()
waitForPlaybackToStart()
// verifyPageContent("Media file is playing")
}.openNotificationShade {
verifySystemNotificationExists(videoTestPage.title)
clickMediaSystemNotificationControlButton("Pause")
Expand Down Expand Up @@ -92,7 +90,7 @@ class MediaNotificationTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(audioTestPage.url) {
// verifyPageContent(audioTestPage.content)
mDevice.waitForIdle()
clickMediaPlayerPlayButton()
waitForPlaybackToStart()
}.openNotificationShade {
Expand Down Expand Up @@ -125,10 +123,9 @@ class MediaNotificationTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(audioTestPage.url) {
// verifyPageContent(audioTestPage.content)
mDevice.waitForIdle()
clickMediaPlayerPlayButton()
waitForPlaybackToStart()
// verifyPageContent("Media file is playing")
}.openTabDrawer {
verifyTabMediaControlButtonState("Pause")
clickTabMediaControlButton()
Expand All @@ -146,10 +143,9 @@ class MediaNotificationTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(audioTestPage.url) {
// verifyPageContent(audioTestPage.content)
mDevice.waitForIdle()
clickMediaPlayerPlayButton()
waitForPlaybackToStart()
// verifyPageContent("Media file is playing")
}.openNotificationShade {
verifySystemNotificationExists("A site is playing media")
clickMediaSystemNotificationControlButton("Pause")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,12 @@ class NavigationToolbarTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
// verifyPageContent(defaultWebPage.content)
mDevice.waitForIdle()
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(nextWebPage.url) {
// verifyPageContent(nextWebPage.content)
}

// Re-open the three-dot menu for verification
navigationToolbar {
}.openThreeDotMenu {
verifyThreeDotMenuExists()
}.goBack {
// verifyPageContent(defaultWebPage.content)
verifyUrl(nextWebPage.url.toString())
mDevice.pressBack()
verifyUrl(defaultWebPage.url.toString())
}
}

Expand All @@ -77,12 +71,14 @@ class NavigationToolbarTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
// verifyPageContent(defaultWebPage.content)
mDevice.waitForIdle()
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(nextWebPage.url) {
// verifyPageContent(nextWebPage.content)
mDevice.waitForIdle()
verifyUrl(nextWebPage.url.toString())
mDevice.pressBack()
// verifyPageContent(defaultWebPage.content)
mDevice.waitForIdle()
verifyUrl(defaultWebPage.url.toString())
}

// Re-open the three-dot menu for verification
Expand All @@ -91,7 +87,7 @@ class NavigationToolbarTest {
verifyThreeDotMenuExists()
verifyForwardButton()
}.goForward {
// verifyPageContent(nextWebPage.content)
verifyUrl(nextWebPage.url.toString())
}
}

Expand All @@ -101,7 +97,7 @@ class NavigationToolbarTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(refreshWebPage.url) {
// verifyPageContent("DEFAULT")
mDevice.waitForIdle()
}

// Use refresh from the three-dot menu
Expand All @@ -110,7 +106,7 @@ class NavigationToolbarTest {
verifyThreeDotMenuExists()
verifyRefreshButton()
}.refreshPage {
// verifyPageContent("REFRESHED")
verifyPageContent("REFRESHED")
}
}

Expand All @@ -120,7 +116,7 @@ class NavigationToolbarTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
// verifyPageContent(defaultWebPage.content)
verifyUrl(defaultWebPage.url.toString())
}
}

Expand All @@ -131,7 +127,7 @@ class NavigationToolbarTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(loremIpsumWebPage.url) {
// verifyPageContent(loremIpsumWebPage.content)
mDevice.waitForIdle()
}

navigationToolbar {
Expand Down
Loading

0 comments on commit 9054dbb

Please sign in to comment.