Improved the background download test.

This commit is contained in:
MohitMaliFtechiz 2025-08-11 22:51:18 +05:30
parent 16ea02274b
commit f99e37a017

View File

@ -242,6 +242,7 @@ class DownloadTest : BaseActivityTest() {
@Test
fun downloadZIMFileInBackground() {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
activityScenario.onActivity {
kiwixMainActivity = it
it.navigate(KiwixDestination.Library.route)
@ -281,7 +282,15 @@ class DownloadTest : BaseActivityTest() {
refreshList(composeTestRule)
waitUntilZimFilesRefreshing(composeTestRule)
downloadRobot {
runCatching {
checkIfZimFileDownloaded(composeTestRule)
}.onFailure {
// if currently downloading check.
clickDownloadOnBottomNav(composeTestRule)
waitForDataToLoad(composeTestRule = composeTestRule)
stopDownloadIfAlreadyStarted(composeTestRule)
}
}
}
}
}