From ca2bdcb2416f034ef6ff3b88722dcdaee5e42d77 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Tue, 13 May 2025 21:34:00 +0530 Subject: [PATCH] Fixed: `GetContentShortcutTest` sometimes failing on API level 30, and 33. --- .../java/org/kiwix/kiwixmobile/main/TopLevelDestinationTest.kt | 1 + .../org/kiwix/kiwixmobile/nav/destination/reader/ReaderRobot.kt | 2 +- .../org/kiwix/kiwixmobile/shortcuts/GetContentShortcutTest.kt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/main/TopLevelDestinationTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/main/TopLevelDestinationTest.kt index 536668bc4..65c51b5d3 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/main/TopLevelDestinationTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/main/TopLevelDestinationTest.kt @@ -110,6 +110,7 @@ class TopLevelDestinationTest : BaseActivityTest() { fun testTopLevelDestination() { topLevel { clickReaderOnBottomNav { + assertReaderScreenDisplayed() } clickDownloadOnBottomNav { onlineLibrary { diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/nav/destination/reader/ReaderRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/nav/destination/reader/ReaderRobot.kt index a91daaf02..a74c3705d 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/nav/destination/reader/ReaderRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/nav/destination/reader/ReaderRobot.kt @@ -26,7 +26,7 @@ import org.kiwix.kiwixmobile.core.R fun reader(func: ReaderRobot.() -> Unit) = ReaderRobot().applyWithViewHierarchyPrinting(func) class ReaderRobot : BaseRobot() { - init { + fun assertReaderScreenDisplayed() { isVisible(ViewId(R.id.activity_main_root)) } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/shortcuts/GetContentShortcutTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/shortcuts/GetContentShortcutTest.kt index 744b5e82c..d8bfae6fc 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/shortcuts/GetContentShortcutTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/shortcuts/GetContentShortcutTest.kt @@ -129,6 +129,7 @@ class GetContentShortcutTest { onlineLibrary { assertOnlineLibraryFragmentDisplayed(composeTestRule) } topLevel { clickReaderOnBottomNav { + assertReaderScreenDisplayed() } clickDownloadOnBottomNav { onlineLibrary { assertOnlineLibraryFragmentDisplayed(composeTestRule) }