Skip to content

Commit

Permalink
Fixed link from clipboard open up from same URL on every new tab mozi…
Browse files Browse the repository at this point in the history
  • Loading branch information
vmadalin committed Oct 6, 2020
1 parent 07748f6 commit eed1970
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,30 @@ class ContextMenusTest {
}
}

@Ignore("Test failures: https://github.com/mozilla-mobile/fenix/issues/12473")
@Test
fun verifyContextCopyLinkNotDisplayedAfterApplied() {
val pageLinks =
TestAssetHelper.getGenericAsset(mockWebServer, 4)
val genericURL =
TestAssetHelper.getGenericAsset(mockWebServer, 3)

navigationToolbar {
}.enterURLAndEnterToBrowser(pageLinks.url) {
mDevice.waitForIdle()
longClickMatchingText("Link 3")
verifyLinkContextMenuItems(genericURL.url)
clickContextCopyLink()
verifySnackBarText("Link copied to clipboard")
}.openNavigationToolbar {
}.visitLinkFromClipboard {
verifyUrl(genericURL.url.toString())
}.openTabDrawer {
}.openNewTab {
verifyFillLinkButton()
}
}

@Test
fun verifyContextShareLink() {
val pageLinks =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SearchRobot {
onView(withContentDescription(expectedText))
}
fun verifyDefaultSearchEngine(expectedText: String) = assertDefaultSearchEngine(expectedText)
fun verifyFillLinkButton() = assertFillLinkButton()

fun changeDefaultSearchEngine(searchEngineName: String) =
selectDefaultSearchEngine(searchEngineName)
Expand Down Expand Up @@ -278,4 +279,10 @@ private fun assertDefaultSearchEngine(expectedText: String) {
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}

private fun assertFillLinkButton() {
mDevice.waitForIdle()
onView(withId(R.id.fill_link_from_clipboard))
.check(matches(withEffectiveVisibility(Visibility.GONE)))
}

private fun goBackButton() = onView(allOf(withContentDescription("Navigate up")))
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
newTab = store.state.tabId == null,
from = BrowserDirection.FromSearchDialog
)
requireContext().components.clipboardHandler.text = null
}

val stubListener = ViewStub.OnInflateListener { _, inflated ->
Expand Down

0 comments on commit eed1970

Please sign in to comment.