From 8770efd03d4c29e3a8f5a41fcfe12d73e863c8bd Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Fri, 13 Sep 2024 17:48:31 +0530 Subject: [PATCH] Improved the DownloadTest to handle cases where pausing the download may show a complete pause message, such as 'Pause: Waiting for Retry,' which previously caused the test case to fail. The test case has been updated to accommodate this behavior. --- .../java/org/kiwix/kiwixmobile/download/DownloadRobot.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/download/DownloadRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/download/DownloadRobot.kt index bd30e2719..6cf3c49d1 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/download/DownloadRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/download/DownloadRobot.kt @@ -24,6 +24,7 @@ import androidx.test.espresso.assertion.ViewAssertions.doesNotExist import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId +import androidx.test.espresso.matcher.ViewMatchers.withSubstring import androidx.test.espresso.matcher.ViewMatchers.withText import applyWithViewHierarchyPrinting import com.adevinta.android.barista.interaction.BaristaSleepInteractions @@ -131,11 +132,7 @@ class DownloadRobot : BaseRobot() { fun assertDownloadPaused() { testFlakyView({ pauseForBetterTestPerformance() - onView( - withText( - org.kiwix.kiwixmobile.core.R.string.paused_state - ) - ).check(matches(isDisplayed())) + onView(withSubstring(context.getString(string.paused_state))).check(matches(isDisplayed())) }) }