1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix.ui
7 import androidx.compose.ui.test.junit4.AndroidComposeTestRule
8 import androidx.core.net.toUri
11 import org.junit.runner.RunWith
12 import org.junit.runners.Parameterized
13 import org.mozilla.fenix.customannotations.SmokeTest
14 import org.mozilla.fenix.helpers.HomeActivityTestRule
15 import org.mozilla.fenix.helpers.TestSetup
16 import org.mozilla.fenix.ui.robots.downloadRobot
19 * Test for verifying downloading a list of different file types:
20 * - Initiates a download
21 * - Verifies download prompt
22 * - Verifies downloading of varying file types and the appearance inside the Downloads listing.
24 @RunWith(Parameterized::class)
25 class DownloadFileTypesTest(fileName: String) : TestSetup() {
26 /* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */
27 private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html"
28 private var downloadFile: String = fileName
31 val activityTestRule =
32 AndroidComposeTestRule(
33 HomeActivityTestRule.withDefaultSettingsOverrides(),
37 // Creating test data. The test will take each file name as a parameter and run it individually.
39 @Parameterized.Parameters
40 fun downloadList() = listOf(
49 "tAJwqaWjJsXS8AhzSninBMCfIZbHBGgcc001lx5DIdDwIcfEgQ6vE5Gb5VgAled17DFZ2A7ZDOHA0NpQPHXXFt.svg",
53 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/251028
56 fun allFilesAppearInDownloadsMenuTest() {
58 openPageAndDownloadFile(url = downloadTestPage.toUri(), downloadFile = downloadFile)
59 verifyDownloadCompleteNotificationPopup()
60 }.closeDownloadPrompt {
62 }.openDownloadsManager() {
63 verifyDownloadedFileExistsInDownloadsList(activityTestRule, downloadFile)
64 }.exitDownloadsManagerToBrowser { }