|
|
|
@ -5,18 +5,15 @@
|
|
|
|
|
package org.mozilla.fenix.ui
|
|
|
|
|
|
|
|
|
|
import androidx.core.net.toUri
|
|
|
|
|
import mozilla.components.concept.engine.utils.EngineReleaseChannel
|
|
|
|
|
import org.junit.After
|
|
|
|
|
import org.junit.Before
|
|
|
|
|
import org.junit.Rule
|
|
|
|
|
import org.junit.Test
|
|
|
|
|
import org.mozilla.fenix.customannotations.SmokeTest
|
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
|
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.assertExternalAppOpens
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.deleteDownloadedFileOnStorage
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.runWithCondition
|
|
|
|
|
import org.mozilla.fenix.ui.robots.browserScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.downloadRobot
|
|
|
|
|
import org.mozilla.fenix.ui.robots.navigationToolbar
|
|
|
|
@ -195,40 +192,28 @@ class DownloadTest {
|
|
|
|
|
@SmokeTest
|
|
|
|
|
@Test
|
|
|
|
|
fun openPDFInBrowserTest() {
|
|
|
|
|
runWithCondition(
|
|
|
|
|
// Returns the GeckoView channel set for the current version, if a feature is limited to Nightly.
|
|
|
|
|
// Once this feature lands in Beta/RC we should remove the wrapper.
|
|
|
|
|
activityTestRule.activity.components.core.engine.version.releaseChannel == EngineReleaseChannel.NIGHTLY,
|
|
|
|
|
) {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
|
|
|
|
|
clickLinkMatchingText(pdfFileName)
|
|
|
|
|
verifyUrl(pdfFileURL)
|
|
|
|
|
verifyPageContent(pdfFileContent)
|
|
|
|
|
}
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
|
|
|
|
|
clickLinkMatchingText(pdfFileName)
|
|
|
|
|
verifyUrl(pdfFileURL)
|
|
|
|
|
verifyPageContent(pdfFileContent)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SmokeTest
|
|
|
|
|
@Test
|
|
|
|
|
fun saveAndOpenPdfTest() {
|
|
|
|
|
runWithCondition(
|
|
|
|
|
// Returns the GeckoView channel set for the current version, if a feature is limited to Nightly.
|
|
|
|
|
// Once this feature lands in Beta/RC we should remove the wrapper.
|
|
|
|
|
activityTestRule.activity.components.core.engine.version.releaseChannel == EngineReleaseChannel.NIGHTLY,
|
|
|
|
|
) {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
|
|
|
|
|
clickLinkMatchingText(pdfFileName)
|
|
|
|
|
verifyPageContent(pdfFileContent)
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.clickShareButton {
|
|
|
|
|
}.clickSaveAsPDF {
|
|
|
|
|
verifyDownloadPrompt(pdfFileName)
|
|
|
|
|
}.clickDownload {
|
|
|
|
|
}.clickOpen("application/pdf") {
|
|
|
|
|
assertExternalAppOpens("com.google.android.apps.docs")
|
|
|
|
|
}
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
|
|
|
|
|
clickLinkMatchingText(pdfFileName)
|
|
|
|
|
verifyPageContent(pdfFileContent)
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.clickShareButton {
|
|
|
|
|
}.clickSaveAsPDF {
|
|
|
|
|
verifyDownloadPrompt(pdfFileName)
|
|
|
|
|
}.clickDownload {
|
|
|
|
|
}.clickOpen("application/pdf") {
|
|
|
|
|
assertExternalAppOpens("com.google.android.apps.docs")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|