2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

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

This commit is contained in:
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() clickContextCopyLink()
verifySnackBarText("Link copied to clipboard") verifySnackBarText("Link copied to clipboard")
}.openNavigationToolbar { }.openNavigationToolbar {
}.visitLinkFromClipboard(genericURL.url) { }.visitLinkFromClipboard {
verifyUrl(genericURL.url.toString()) verifyUrl(genericURL.url.toString())
} }
} }
@ -169,7 +169,7 @@ class ContextMenusTest {
clickContextCopyImageLocation() clickContextCopyImageLocation()
verifySnackBarText("Link copied to clipboard") verifySnackBarText("Link copied to clipboard")
}.openNavigationToolbar { }.openNavigationToolbar {
}.visitLinkFromClipboard(imageResource.url) { }.visitLinkFromClipboard {
verifyUrl(imageResource.url.toString()) verifyUrl(imageResource.url.toString())
} }
} }

View File

@ -38,14 +38,14 @@ class BrowserRobot {
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
} }
fun verifyUrl(redirectUrl: String) { fun verifyUrl(url: String) {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mDevice.waitNotNull( mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view")), Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view")),
TestAssetHelper.waitingTime TestAssetHelper.waitingTime
) )
onView(withId(R.id.mozac_browser_toolbar_url_view)) onView(withId(R.id.mozac_browser_toolbar_url_view))
.check(matches(withText(containsString(redirectUrl)))) .check(matches(withText(containsString(url))))
} }
fun verifyHelpUrl() { fun verifyHelpUrl() {

View File

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