Fixed: The SearchFragmentTestForCustomApp was failing sometimes.

This commit is contained in:
MohitMaliFtechiz 2025-01-31 15:23:35 +05:30 committed by Kelson
parent 499ea74048
commit a9364d5881
2 changed files with 6 additions and 4 deletions

View File

@ -131,7 +131,7 @@ class SearchFragmentTestForCustomApp {
customMainActivity = it
}
// test with a large ZIM file to properly test the scenario
downloadingZimFile = getDownloadingZimFile()
downloadingZimFile = getDownloadingZimFileFromDataFolder()
getOkkHttpClientForTesting().newCall(downloadRequest()).execute().use { response ->
if (response.isSuccessful) {
response.body?.let { responseBody ->
@ -147,7 +147,7 @@ class SearchFragmentTestForCustomApp {
UiThreadStatement.runOnUiThread {
customMainActivity.navigate(customMainActivity.readerFragmentResId)
}
openZimFileInReaderWithAssetFileDescriptor(downloadingZimFile)
openZimFileInReader(zimFile = downloadingZimFile)
openSearchWithQuery()
val searchTerm = "gard"
val searchedItem = "Gardanta Spirito"

View File

@ -100,14 +100,16 @@ class SearchRobot {
}
fun searchAndClickOnArticle(searchString: String) {
// wait a bit to properly load the ZIM file in the reader
// Wait a bit to properly load the ZIM file in the reader.
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
openSearchScreen()
// Wait a bit to properly visible the search screen.
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
searchWithFrequentlyTypedWords(searchString)
clickOnSearchItemInSearchList()
}
fun clickOnSearchItemInSearchList() {
private fun clickOnSearchItemInSearchList() {
testFlakyView({
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong())
Espresso.onView(ViewMatchers.withId(R.id.search_list)).perform(