1
0
Fork 0

Closes #8015: fix UI test verifyContextCopyLink (#8026)

master
Aaron Train 2020-01-31 14:58:02 -05:00 committed by GitHub
parent 1372ed5837
commit eb2eed1c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -112,7 +112,7 @@ class ContextMenusTest {
clickContextCopyLink()
verifySnackBarText("Link copied to clipboard")
}.openNavigationToolbar {
}.visitLinkFromClipboard(genericURL.url) {
}.visitLinkFromClipboard {
verifyUrl(genericURL.url.toString())
}
}
@ -169,7 +169,7 @@ class ContextMenusTest {
clickContextCopyImageLocation()
verifySnackBarText("Link copied to clipboard")
}.openNavigationToolbar {
}.visitLinkFromClipboard(imageResource.url) {
}.visitLinkFromClipboard {
verifyUrl(imageResource.url.toString())
}
}

View File

@ -38,14 +38,14 @@ class BrowserRobot {
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}
fun verifyUrl(redirectUrl: String) {
fun verifyUrl(url: String) {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mDevice.waitNotNull(
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))))
.check(matches(withText(containsString(url))))
}
fun verifyHelpUrl() {

View File

@ -54,7 +54,7 @@ class NavigationToolbarRobot {
return BrowserRobot.Transition()
}
fun visitLinkFromClipboard(url: Uri, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_clear_view")),
waitingTime
@ -62,11 +62,12 @@ class NavigationToolbarRobot {
clearAddressBar().click()
mDevice.waitNotNull(
Until.findObject(By.text(url.toString())), waitingTime
Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_title")),
waitingTime
)
mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/fill_link_from_clipboard")),
Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_url")),
waitingTime
)
fillLinkButton().click()
@ -87,5 +88,5 @@ private fun urlBar() = onView(ViewMatchers.withId(R.id.toolbar))
private fun awesomeBar() = onView(ViewMatchers.withId(R.id.mozac_browser_toolbar_edit_url_view))
private fun threeDotButton() = onView(ViewMatchers.withContentDescription("Menu"))
private fun newTab() = onView(ViewMatchers.withContentDescription("Add tab"))
private fun fillLinkButton() = onView(ViewMatchers.withId(R.id.fill_link_from_clipboard))
private fun fillLinkButton() = onView(ViewMatchers.withId(R.id.clipboard_url))
private fun clearAddressBar() = onView(ViewMatchers.withId(R.id.mozac_browser_toolbar_clear_view))