diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt index ebdf977ce..6e8eb0f5a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt @@ -49,6 +49,7 @@ class ThreeDotMenuMainTest { verifySettingsButton() verifyLibraryButton() verifyHelpButton() + verifyWhatsNewButton() }.openSettings { verifySettingsView() }.goBack { @@ -59,6 +60,10 @@ class ThreeDotMenuMainTest { }.openThreeDotMenu { }.openHelp { verifyHelpUrl() + }.openHomeScreen { + }.openThreeDotMenu { + }.openWhatsNew { + verifyWhatsNewURL() } } } 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 e50870c17..37cafcb12 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 @@ -30,6 +30,15 @@ class BrowserRobot { .check(matches(withText(containsString(redirectUrl)))) } + fun verifyWhatsNewURL() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + val redirectUrl = "https://support.mozilla.org/" + + mDevice.waitForIdle() + onView(withId(R.id.mozac_browser_toolbar_url_view)) + .check(matches(withText(containsString(redirectUrl)))) + } + /* Asserts that the text within DOM element with ID="testContent" has the given text, i.e. * document.querySelector('#testContent').innerText == expectedText */ diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuRobot.kt index 579816586..c2c3b3ca4 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuRobot.kt @@ -44,6 +44,7 @@ class ThreeDotMenuRobot { fun verifyShareDialogTitle() = assertShareDialogTitle() fun verifySendToDeviceTitle() = assertSendToDeviceTitle() fun verifyShareALinkTitle() = assertShareALinkTitle() + fun verifyWhatsNewButton() = assertWhatsNewButton() class Transition { @@ -112,6 +113,14 @@ class ThreeDotMenuRobot { FindInPageRobot().interact() return FindInPageRobot.Transition() } + + fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { + mDevice.wait(Until.findObject(By.text("What's New")), waitingTime) + whatsNewButton().click() + + BrowserRobot().interact() + return BrowserRobot.Transition() + } } } @@ -166,3 +175,7 @@ private fun assertSendToDeviceTitle() = SendToDeviceTitle() private fun ShareALinkTitle() = onView(allOf(withText("SHARE A LINK"), withResourceName("link_header"))) private fun assertShareALinkTitle() = ShareALinkTitle() + +private fun whatsNewButton() = onView(allOf(withText("What's New"))) +private fun assertWhatsNewButton() = whatsNewButton() + .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))