[fenix] For https://github.com/mozilla-mobile/fenix/issues/21002: improve Manage Downloads smoke tests coverage
Add parametrized test for downloading various file typespull/600/head
parent
78a5a4bde0
commit
4cc2e61f8e
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<a id="link" href="../resources/tAJwqaWjJsXS8AhzSninBMCfIZbHBGgcc001lx5DIdDwIcfEgQ6vE5Gb5VgAled17DFZ2A7ZDOHA0NpQPHXXFHPSD4wzCkRWiaOorNI574zLtv4Hjiz6O6T7onmUTGgUQ2YQoiQFyrCrPv8ZB9Kvmt.svg" download>Page content: tAJwqaWjJsXS8AhzSninBMCfIZbHBGgcc001lx5DIdDwIcfEgQ6vE5Gb5VgAled17DFZ2A7ZDOHA0NpQPHXXFHPSD4wzCkRWiaOorNI574zLtv4Hjiz6O6T7onmUTGgUQ2YQoiQFyrCrPv8ZB9Kvmt.svg</a>
|
||||
<script>
|
||||
(function() {
|
||||
document.getElementById("link").click()
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +0,0 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="context-fill" d="M8 0a8 8 0 1 0 8 8 8.009 8.009 0 0 0-8-8zm5.163 4.958h-1.552a7.7 7.7 0 0 0-1.051-2.376 6.03 6.03 0 0 1 2.603 2.376zM14 8a5.963 5.963 0 0 1-.335 1.958h-1.821A12.327 12.327 0 0 0 12 8a12.327 12.327 0 0 0-.156-1.958h1.821A5.963 5.963 0 0 1 14 8zm-6 6c-1.075 0-2.037-1.2-2.567-2.958h5.135C10.037 12.8 9.075 14 8 14zM5.174 9.958a11.084 11.084 0 0 1 0-3.916h5.651A11.114 11.114 0 0 1 11 8a11.114 11.114 0 0 1-.174 1.958zM2 8a5.963 5.963 0 0 1 .335-1.958h1.821a12.361 12.361 0 0 0 0 3.916H2.335A5.963 5.963 0 0 1 2 8zm6-6c1.075 0 2.037 1.2 2.567 2.958H5.433C5.963 3.2 6.925 2 8 2zm-2.56.582a7.7 7.7 0 0 0-1.051 2.376H2.837A6.03 6.03 0 0 1 5.44 2.582zm-2.6 8.46h1.549a7.7 7.7 0 0 0 1.051 2.376 6.03 6.03 0 0 1-2.603-2.376zm7.723 2.376a7.7 7.7 0 0 0 1.051-2.376h1.552a6.03 6.03 0 0 1-2.606 2.376z"></path></svg>
|
Before Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,95 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import androidx.core.net.toUri
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
import org.mozilla.fenix.customannotations.SmokeTest
|
||||
import org.mozilla.fenix.helpers.FeatureSettingsHelper
|
||||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
||||
import org.mozilla.fenix.helpers.RetryTestRule
|
||||
import org.mozilla.fenix.helpers.TestHelper
|
||||
import org.mozilla.fenix.ui.robots.navigationToolbar
|
||||
|
||||
/**
|
||||
* Test for verifying downloading a list of different file types:
|
||||
* - Initiates a download
|
||||
* - Verifies download prompt
|
||||
* - Verifies downloading of varying file types and the appearance inside the Downloads listing.
|
||||
**/
|
||||
@RunWith(Parameterized::class)
|
||||
class DownloadFileTypesTest(fileName: String) {
|
||||
/* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */
|
||||
private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
|
||||
private var downloadFile: String = fileName
|
||||
private val featureSettingsHelper = FeatureSettingsHelper()
|
||||
|
||||
@get:Rule
|
||||
val activityTestRule = HomeActivityIntentTestRule()
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
val retryTestRule = RetryTestRule(3)
|
||||
|
||||
@get:Rule
|
||||
var mGrantPermissions = GrantPermissionRule.grant(
|
||||
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
android.Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
)
|
||||
|
||||
companion object {
|
||||
// Creating test data. The test will take each file name as a parameter and run it individually.
|
||||
@JvmStatic
|
||||
@Parameterized.Parameters
|
||||
fun downloadList() = listOf(
|
||||
"washington.pdf",
|
||||
"MyDocument.docx",
|
||||
"audioSample.mp3",
|
||||
"textfile.txt",
|
||||
"web_icon.png",
|
||||
"videoSample.webm",
|
||||
"CSVfile.csv",
|
||||
"XMLfile.xml"
|
||||
)
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
// disabling the jump-back-in pop-up that interferes with the tests.
|
||||
featureSettingsHelper.setJumpBackCFREnabled(false)
|
||||
// disabling the PWA CFR on 3rd visit
|
||||
featureSettingsHelper.disablePwaCFR(true)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
TestHelper.deleteDownloadFromStorage(downloadFile)
|
||||
featureSettingsHelper.resetAllFeatureFlags()
|
||||
}
|
||||
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun downloadMultipleFileTypesTest() {
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(downloadTestPage.toUri()) {
|
||||
}.clickDownloadLink(downloadFile) {
|
||||
verifyDownloadPrompt(downloadFile)
|
||||
}.clickDownload {
|
||||
verifyDownloadNotificationPopup()
|
||||
}.closePrompt {
|
||||
}.openThreeDotMenu {
|
||||
}.openDownloadsManager {
|
||||
waitForDownloadsListToExist()
|
||||
verifyDownloadedFileName(downloadFile)
|
||||
verifyDownloadedFileIcon()
|
||||
}.exitDownloadsManagerToBrowser { }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue