Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #15588: Fixed link from clipboard open up from same URL on every …
Browse files Browse the repository at this point in the history
…new tab
  • Loading branch information
vmadalin authored and rocketsroger committed Dec 5, 2022
1 parent ce6dd57 commit 5728efe
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
21 changes: 21 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 @@ -128,6 +128,27 @@ class ContextMenusTest {
}
}

@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 @@ -187,6 +187,7 @@ class SearchRobot {
onView(withContentDescription(expectedText))
}
fun verifyDefaultSearchEngine(expectedText: String) = assertDefaultSearchEngine(expectedText)
fun verifyFillLinkButton() = assertFillLinkButton()

fun verifyEnginesListShortcutContains(rule: ComposeTestRule, searchEngineName: String) = assertEngineListShortcutContains(rule, searchEngineName)

Expand Down Expand Up @@ -533,7 +534,15 @@ private fun assertTranslatedFocusedNavigationToolbar(toolbarHintString: String)
).waitForExists(waitingTime),
)

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

private val awesomeBar =
mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"))

private val voiceSearchButton = mDevice.findObject(UiSelector().description("Voice search"))

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

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

0 comments on commit 5728efe

Please sign in to comment.