From 0d6d76b5dba244178f090a43b0bb5b25cbd15f9e Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Wed, 13 Mar 2024 20:27:59 +0530 Subject: [PATCH] Increased retry count to 5 for flaky test cases on API level 33, where failures occurred multiple times due to the heavy `google_apis`. so to address this we have increased it to 5 to properly run the test cases. * We are removing the `ZimHostFragment` test from the API level 33 because, most of the time, the emulator does not have WiFi service. Running this test on this emulator is not worthwhile, as we are testing this code on WiFi. --- .../java/org/kiwix/kiwixmobile/testutils/TestUtils.kt | 6 +++++- .../org/kiwix/kiwixmobile/webserver/ZimHostFragmentTest.kt | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt index d5f0c0063..541573781 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt @@ -54,7 +54,11 @@ object TestUtils { @JvmField var TEST_PAUSE_MS = 3000 var TEST_PAUSE_MS_FOR_SEARCH_TEST = 1000 var TEST_PAUSE_MS_FOR_DOWNLOAD_TEST = 10000 - const val RETRY_COUNT_FOR_FLAKY_TEST = 3 + + // Increased retry count to 5 for flaky test cases on API level 33, + // where failures occurred multiple times due to the heavy `google_apis`. + // so to address this we have increased it to 5 to properly run the test cases. + const val RETRY_COUNT_FOR_FLAKY_TEST = 5 /* TEST_PAUSE_MS is used as such: diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/webserver/ZimHostFragmentTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/webserver/ZimHostFragmentTest.kt index d2f663a40..22e0735d0 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/webserver/ZimHostFragmentTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/webserver/ZimHostFragmentTest.kt @@ -98,7 +98,9 @@ class ZimHostFragmentTest { @Test fun testZimHostFragment() { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1 && + Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU + ) { activityScenario.onActivity { it.navigate(R.id.libraryFragment) }