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

Bug 1821035 - New PDF text selection UI smoke tests

This commit is contained in:
AndiAJ 2023-03-08 14:26:20 +02:00 committed by mergify[bot]
parent a02f692410
commit fa38639322

View File

@ -1,5 +1,6 @@
package org.mozilla.fenix.ui
import androidx.core.net.toUri
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
@ -20,6 +21,11 @@ import org.mozilla.fenix.ui.robots.searchScreen
class TextSelectionTest {
private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer
private val downloadTestPage =
"https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
private val pdfFileName = "washington.pdf"
private val pdfFileURL = "storage.googleapis.com/mobile_test_assets/public/washington.pdf"
private val pdfFileContent = "Washington Crossing the Delaware"
@get:Rule
val activityIntentTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
@ -58,7 +64,8 @@ class TextSelectionTest {
clickClearButton()
longClickToolbar()
clickPasteText()
// with Select all, some white space is copied over, so we need to include that too
// With Select all, white spaces are copied
// Potential bug https://bugzilla.mozilla.org/show_bug.cgi?id=1821310
verifyTypedToolbarText(" Page content: 1 ")
}
}
@ -126,4 +133,93 @@ class TextSelectionTest {
verifyUrl("google")
}
}
@SmokeTest
@Test
fun selectAllAndCopyPDFTextTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
clickLinkMatchingText(pdfFileName)
verifyUrl(pdfFileURL)
verifyPageContent(pdfFileContent)
longClickAndCopyText("Crossing", true)
}.openNavigationToolbar {
openEditURLView()
}
searchScreen {
clickClearButton()
longClickToolbar()
clickPasteText()
// With Select all, white spaces are copied
// Potential bug https://bugzilla.mozilla.org/show_bug.cgi?id=1821310
verifyTypedToolbarText(" Washington Crossing the Delaware ")
}
}
@SmokeTest
@Test
fun copyPDFTextTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
clickLinkMatchingText(pdfFileName)
verifyUrl(pdfFileURL)
verifyPageContent(pdfFileContent)
longClickAndCopyText("Crossing")
}.openNavigationToolbar {
openEditURLView()
}
searchScreen {
clickClearButton()
longClickToolbar()
clickPasteText()
verifyTypedToolbarText("Crossing")
}
}
@SmokeTest
@Test
fun shareSelectedPDFTextTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
clickLinkMatchingText(pdfFileName)
verifyUrl(pdfFileURL)
verifyPageContent(pdfFileContent)
longClickMatchingText("Crossing")
}.clickShareSelectedText {
verifyAndroidShareLayout()
}
}
@SmokeTest
@Test
fun selectAndSearchPDFTextTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
clickLinkMatchingText(pdfFileName)
verifyUrl(pdfFileURL)
verifyPageContent(pdfFileContent)
longClickAndSearchText("Search", "Crossing")
verifyTabCounter("3")
verifyUrl("google")
}
}
@SmokeTest
@Test
fun privateSelectAndSearchPDFTextTest() {
homeScreen {
}.togglePrivateBrowsingMode()
navigationToolbar {
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
clickLinkMatchingText(pdfFileName)
verifyUrl(pdfFileURL)
verifyPageContent(pdfFileContent)
longClickAndSearchText("Private Search", "Crossing")
verifyTabCounter("3")
verifyUrl("google")
}
}
}