This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #21002: improve Manage Downloads smoke tests coverage
Add parametrized test for downloading various file types
- Loading branch information
1 parent
12a9071
commit 02d62c8
Showing
11 changed files
with
310 additions
and
146 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...A0NpQPHXXFHPSD4wzCkRWiaOorNI574zLtv4Hjiz6O6T7onmUTGgUQ2YQoiQFyrCrPv8ZB9Kvmt.svg
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.