diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt index 56fedc406..562569bf3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt @@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit */ object TestAssetHelper { @Suppress("MagicNumber") - val waitingTime: Long = TimeUnit.SECONDS.toMillis(45) + val waitingTime: Long = TimeUnit.SECONDS.toMillis(15) val waitingTimeShort: Long = TimeUnit.SECONDS.toMillis(1) data class TestAsset(val url: Uri, val content: String) diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt index 92f0f1837..d513726f2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt @@ -27,6 +27,7 @@ import androidx.test.uiautomator.Until import org.hamcrest.Matchers.allOf import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper +import org.junit.Assert.assertNotNull @Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") class SyncIntegrationTest { @@ -96,7 +97,7 @@ class SyncIntegrationTest { } fun tapOnContinueButton() { - val continueButton = mDevice.findObject(By.res("submit-btn")) + val continueButton = mDevice.findObject(By.res("org.mozilla.fenix.debug:id/submit-btn")) continueButton.clickAndWait(Until.newWindow(), TestAssetHelper.waitingTime) } @@ -110,7 +111,7 @@ class SyncIntegrationTest { } fun tapOnSignIn() { - mDevice.wait(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTimeShort) + assertNotNull(mDevice.wait(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTimeShort)) // Let's tap on enter, sometimes depending on the device the sign in button is // hidden by the keyboard mDevice.pressEnter() @@ -132,7 +133,7 @@ class SyncIntegrationTest { } fun seeBookmark() { - mDevice.wait(Until.findObjects(By.text("Bookmark")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObjects(By.text("Bookmark")), TestAssetHelper.waitingTime)) val bookmarkButton = mDevice.findObject(By.text("Bookmark")) bookmarkButton.click() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt index f0deb91e8..0eeb78073 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt @@ -5,6 +5,7 @@ package org.mozilla.fenix.ui import androidx.test.uiautomator.UiDevice +import org.junit.Assert.assertNotNull import org.junit.Rule import org.junit.Test import org.junit.Ignore @@ -121,7 +122,7 @@ class HomeScreenTest { homeScreen { // To deal with the race condition where multiple "add tab" buttons are present, // we need to wait until previous HomeFragment View objects are gone. - mDevice.wait(Until.gone(By.text(PRIVATE_SESSION_MESSAGE)), waitingTime) + assertNotNull(mDevice.wait(Until.gone(By.text(PRIVATE_SESSION_MESSAGE)), waitingTime)) verifyHomeScreen() verifyNavigationToolbar() verifyHomePrivateBrowsingButton() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index 3d7a6ae03..0c0958f2b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -9,6 +9,7 @@ import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import okhttp3.mockwebserver.MockWebServer +import org.junit.Assert.assertNotNull import org.junit.After import org.junit.Before import org.junit.Rule @@ -74,7 +75,8 @@ class TabbedBrowsingTest { }.openHomeScreen { } homeScreen { - mDevice.wait(Until.findObject(By.res("R.id.item_tab")), TestAssetHelper.waitingTime) + // Timing issue on slow devices on Firebase + assertNotNull(mDevice.wait(Until.findObjects(By.res("org.mozilla.fenix.debug:id/item_tab")), TestAssetHelper.waitingTime)) verifyExistingTabList() }.openTabsListThreeDotMenu { @@ -103,7 +105,8 @@ class TabbedBrowsingTest { verifyPageContent(defaultWebPage.content) verifyTabCounter("1") }.openHomeScreen { - mDevice.wait(Until.findObject(By.res("R.id.item_tab")), TestAssetHelper.waitingTime) + // Timing issue on slow devices on Firebase + assertNotNull(mDevice.wait(Until.findObjects(By.res("org.mozilla.fenix.debug:id/item_tab")), TestAssetHelper.waitingTime)) verifyExistingTabList() verifyShareTabsButton(true) verifyCloseTabsButton(true) @@ -131,7 +134,8 @@ class TabbedBrowsingTest { }.openHomeScreen { } homeScreen { - mDevice.wait(Until.findObject(By.res("R.id.item_tab")), TestAssetHelper.waitingTime) + // Timing issue on slow devices on Firebase + assertNotNull(mDevice.wait(Until.findObjects(By.res("org.mozilla.fenix.debug:id/item_tab")), TestAssetHelper.waitingTime)) verifyExistingTabList() }.openTabsListThreeDotMenu { verifyCloseAllTabsButton() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index 90ec973dc..0b7432405 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -15,6 +15,7 @@ import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers.containsString +import org.junit.Assert.assertNotNull import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.click @@ -24,7 +25,7 @@ class BrowserRobot { fun verifyHelpUrl() { val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) val redirectUrl = "https://support.mozilla.org/" - mDevice.wait(Until.findObject(By.res("mozac_browser_toolbar_url_view")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view")), TestAssetHelper.waitingTime)) onView(withId(R.id.mozac_browser_toolbar_url_view)) .check(matches(withText(containsString(redirectUrl)))) } @@ -32,8 +33,7 @@ class BrowserRobot { fun verifyWhatsNewURL() { val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) val redirectUrl = "https://support.mozilla.org/" - - mDevice.wait(Until.findObject(By.res("mozac_browser_toolbar_url_view")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view")), TestAssetHelper.waitingTime)) onView(withId(R.id.mozac_browser_toolbar_url_view)) .check(matches(withText(containsString(redirectUrl)))) } @@ -43,7 +43,7 @@ class BrowserRobot { */ fun verifyPageContent(expectedText: String) { val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - mDevice.wait(Until.findObject(By.res(expectedText)), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text(expectedText)), TestAssetHelper.waitingTime)) } fun verifyTabCounter(expectedText: String) { @@ -67,19 +67,19 @@ class BrowserRobot { tabsCounter().click() - mDevice.wait( - Until.findObject(By.res("R.id.header_text")), + assertNotNull(mDevice.wait( + Until.findObject(By.res("org.mozilla.fenix.debug:id/header_text")), TestAssetHelper.waitingTime - ) + )) HomeScreenRobot().interact() return HomeScreenRobot.Transition() } fun openQuickActionBar(interact: QuickActionBarRobot.() -> Unit): QuickActionBarRobot.Transition { - mDevice.wait(Until.gone(By.res("org.mozilla.fenix.nightly:id/quick_action_sheet")), + assertNotNull(mDevice.wait(Until.gone(By.res("org.mozilla.fenix.debug:id/quick_action_sheet")), TestAssetHelper.waitingTime - ) + )) quickActionBarHandle().click() QuickActionBarRobot().interact() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt index 8d12bce37..d7cf78743 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt @@ -17,6 +17,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until +import org.junit.Assert.assertNotNull import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.click @@ -33,15 +34,15 @@ class FindInPageRobot { fun verifyFindInPageCloseButton() = assertFindInPageCloseButton()!! fun enterFindInPageQuery(expectedText: String) { - mDevice.wait(Until.findObject(By.res("find_in_page_query_text")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/find_in_page_query_text")), waitingTime)) findInPageQuery().perform(clearText()) - mDevice.wait(Until.gone(By.res("find_in_page_result_text")), waitingTime) + assertNotNull(mDevice.wait(Until.gone(By.res("org.mozilla.fenix.debug:id/find_in_page_result_text")), waitingTime)) findInPageQuery().perform(typeText(expectedText)) - mDevice.wait(Until.findObject(By.res("find_in_page_result_text")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/find_in_page_result_text")), waitingTime)) } fun verifyFindNextInPageResult(ratioCounter: String) { - mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime)) val element = mDevice.findObject(By.text(ratioCounter)) findInPageResult().check(matches(withText((ratioCounter)))) findInPageNextButton().click() @@ -49,7 +50,7 @@ class FindInPageRobot { } fun verifyFindPrevInPageResult(ratioCounter: String) { - mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime)) val element = mDevice.findObject(By.text(ratioCounter)) findInPageResult().check(matches(withText((ratioCounter)))) findInPagePrevButton().click() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibraryRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibraryRobot.kt index 4fc609c3f..a36727e98 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibraryRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibraryRobot.kt @@ -18,6 +18,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers.allOf +import org.junit.Assert.assertNotNull import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.click @@ -51,7 +52,7 @@ class LibraryRobot { } fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition { - mDevice.wait(Until.findObject(By.text("Bookmarks")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Bookmarks")), TestAssetHelper.waitingTime)) bookmarksButton().click() BookmarksRobot().interact() @@ -59,7 +60,7 @@ class LibraryRobot { } fun openHistory(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition { - mDevice.wait(Until.findObject(By.text("History")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("History")), TestAssetHelper.waitingTime)) historyButton().click() HistoryRobot().interact() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt index 48939ba16..1e8cea150 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt @@ -18,6 +18,7 @@ import androidx.test.uiautomator.Until import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.click +import org.junit.Assert.assertNotNull /** * Implementation of Robot Pattern for the URL toolbar. @@ -28,7 +29,7 @@ class NavigationToolbarRobot { val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) fun enterURLAndEnterToBrowser(url: Uri, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.text("Search or enter address")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/toolbar")), waitingTime)) urlBar().click() awesomeBar().perform(replaceText(url.toString()), pressImeActionButton()) @@ -37,7 +38,7 @@ class NavigationToolbarRobot { } fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition { - mDevice.wait(Until.findObject(By.text("Menu")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.descContains("Menu")), waitingTime)) threeDotButton().click() ThreeDotMenuMainRobot().interact() @@ -45,7 +46,7 @@ class NavigationToolbarRobot { } fun openNewTabAndEnterToBrowser(url: Uri, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.descContains("Add tab")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.descContains("Add tab")), waitingTime)) newTab().click() awesomeBar().perform(replaceText(url.toString()), pressImeActionButton()) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt index 191f3fe70..1e309136b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt @@ -27,6 +27,7 @@ import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.startsWith import org.hamcrest.Matchers +import org.junit.Assert.assertNotNull import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper @@ -64,7 +65,7 @@ class SearchRobot { } fun clickDuckDuckGoResult() { - mDevice.wait(Until.findObjects(By.text("DuckDuckGo")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObjects(By.text("DuckDuckGo")), TestAssetHelper.waitingTime)) awesomeBar().perform(RecyclerViewActions.actionOnItemAtPosition(0, click())) } @@ -100,28 +101,29 @@ private fun awesomeBar() = onView(withId(R.id.awesomeBar)) private fun browserToolbarEditView() = onView(Matchers.allOf(withId(R.id.mozac_browser_toolbar_edit_url_view))) private fun duckDuckGoEngineButton(): ViewInteraction { - mDevice.wait(Until.findObject(By.text("DuckDuckGo")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("DuckDuckGo")), TestAssetHelper.waitingTime)) return onView(Matchers.allOf(withText("DuckDuckGo"))) } private fun denyPermissionButton(): UiObject { - mDevice.wait(Until.findObjects(By.text("Deny")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObjects(By.text("Deny")), TestAssetHelper.waitingTime)) return mDevice.findObject(UiSelector().text("Deny")) } private fun allowPermissionButton(): UiObject { - mDevice.wait(Until.findObjects(By.text("Allow")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObjects(By.text("Allow")), TestAssetHelper.waitingTime)) return mDevice.findObject(UiSelector().text("Allow")) } private fun scanButton(): ViewInteraction { - mDevice.wait(Until.findObject(By.res("R.id.search_scan_button")), TestAssetHelper.waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/search_scan_button")), TestAssetHelper.waitingTime)) return onView(allOf(withId(R.id.searchScanButton))) } private fun clearButton() = onView(withId(R.id.mozac_browser_toolbar_clear_view)) private fun assertDuckDuckGoURL() { + assertNotNull(mDevice.wait(Until.findObject(By.textContains("https://duckduckgo.com/?q=mozilla")), TestAssetHelper.waitingTime)) onView(allOf(withText(startsWith("https://duckduckgo.com")))) .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt index 552894522..4830b3cfa 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt @@ -18,6 +18,7 @@ import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import org.hamcrest.Matchers.allOf +import org.junit.Assert.assertNotNull import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.click @@ -38,7 +39,7 @@ class ThreeDotMenuMainRobot { fun verifyShareButton() = assertShareButton() fun clickShareButton() { shareButton().click() - mDevice.wait(Until.findObject(By.text("SHARE A LINK")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("SHARE A LINK")), waitingTime)) } fun verifyShareTabButton() = assertShareTabButton() @@ -54,7 +55,7 @@ class ThreeDotMenuMainRobot { private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) fun openSettings(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition { - mDevice.wait(Until.findObject(By.text("R.string.settings")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Settings")), waitingTime)) settingsButton().click() SettingsRobot().interact() @@ -62,7 +63,7 @@ class ThreeDotMenuMainRobot { } fun openLibrary(interact: LibraryRobot.() -> Unit): LibraryRobot.Transition { - mDevice.wait(Until.findObject(By.text("R.string.Library")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Your Library")), waitingTime)) libraryButton().click() LibraryRobot().interact() @@ -70,7 +71,7 @@ class ThreeDotMenuMainRobot { } fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.text("Help")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Help")), waitingTime)) helpButton().click() BrowserRobot().interact() @@ -78,7 +79,7 @@ class ThreeDotMenuMainRobot { } fun goForward(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.desc("Forward")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.desc("Forward")), waitingTime)) forwardButton().click() BrowserRobot().interact() @@ -86,7 +87,7 @@ class ThreeDotMenuMainRobot { } fun goBack(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.desc("Back")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.desc("Back")), waitingTime)) backButton().click() BrowserRobot().interact() @@ -94,7 +95,7 @@ class ThreeDotMenuMainRobot { } fun refreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.desc("Refresh")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.desc("Refresh")), waitingTime)) refreshButton().click() BrowserRobot().interact() @@ -102,7 +103,7 @@ class ThreeDotMenuMainRobot { } fun closeAllTabs(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { - mDevice.wait(Until.findObject(By.text("Close all tabs")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Close all tabs")), waitingTime)) closeAllTabsButton().click() HomeScreenRobot().interact() @@ -110,7 +111,7 @@ class ThreeDotMenuMainRobot { } fun openFindInPage(interact: FindInPageRobot.() -> Unit): FindInPageRobot.Transition { - mDevice.wait(Until.findObject(By.text("Find in page")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("Find in page")), waitingTime)) findInPageButton().click() FindInPageRobot().interact() @@ -118,7 +119,7 @@ class ThreeDotMenuMainRobot { } fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - mDevice.wait(Until.findObject(By.text("What's New")), waitingTime) + assertNotNull(mDevice.wait(Until.findObject(By.text("What's New")), waitingTime)) whatsNewButton().click() BrowserRobot().interact() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/screenshots/MenuScreenShotTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/screenshots/MenuScreenShotTest.kt index 7abd74359..311807b2b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/screenshots/MenuScreenShotTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/screenshots/MenuScreenShotTest.kt @@ -19,6 +19,7 @@ // import okhttp3.mockwebserver.MockWebServer // import org.hamcrest.Matchers // import org.junit.After +// import org.junit.Assert.assertNotNull // import org.junit.Before // import org.junit.Rule // import org.junit.Test @@ -167,22 +168,22 @@ // .instance(1) // .className(ImageView::class.java)).click() // // Homescreen with visited tabs -// device.wait(Until.findObjects(By.text("Save to collection")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObjects(By.text("Save to collection")), TestAssetHelper.waitingTimeShort)) // openTabsMenu() // Screengrab.screenshot("open-tabs-menu") // device.pressBack() -// device.wait(Until.findObjects(By.text("Save to collection")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObjects(By.text("Save to collection")), TestAssetHelper.waitingTimeShort)) // Screengrab.screenshot("save-collection-button") // // // Save a collection // saveToCollectionButton() // Screengrab.screenshot("save-collection-view") -// device.wait(Until.findObject(By.res("name_collection_edittext")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/name_collection_edittext")), TestAssetHelper.waitingTimeShort)) // nameCollectionTextBox().perform(replaceText("CollectionName"), // pressImeActionButton()) // // // Homescreen after saving one collection -// device.wait(Until.findObject(By.res("collection_title")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObject(By.res("org.mozilla.fenix.debug:id/collection_title")), TestAssetHelper.waitingTimeShort)) // Screengrab.screenshot("saved-tab") // // // Open Collection menu @@ -196,7 +197,7 @@ // navigationToolbar { // }.enterURLAndEnterToBrowser(defaultWebPage.url) { // } -// device.wait(Until.findObjects(By.res("quick_action_sheet_handle")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObjects(By.res("org.mozilla.fenix.debug:id/quick_action_sheet_handle")), TestAssetHelper.waitingTimeShort)) // openQuickActionMenu() // Screengrab.screenshot("browser-tab-share-bookmark") // // Open Browser tab menu @@ -209,7 +210,7 @@ // device.findObject(UiSelector() // .instance(1) // .className(ImageView::class.java)).click() -// device.wait(Until.findObjects(By.res("close_tab_button")), TestAssetHelper.waitingTimeShort) +// assertNotNull(device.wait(Until.findObjects(By.res("org.mozilla.fenix.debug:id/close_tab_button")), TestAssetHelper.waitingTimeShort)) // closeTabButton() // Screengrab.screenshot("remove-tab") // }