1
0
Fork 0

Closes #5192 - Add UI Test for "What's New" menu option (#5193)

master
Aaron Train 2019-09-11 11:41:05 -04:00 committed by GitHub
parent 4485b7f647
commit 017fb625dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -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()
}
}
}

View File

@ -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
*/

View File

@ -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)))