Skip to content

Commit

Permalink
Fixed KiwixSettingsFragmentTest was failing.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohitMaliDeveloper committed Aug 6, 2024
1 parent 960189e commit 1f0cdbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ class KiwixSettingsFragmentTest {
toggleOpenNewTabInBackground()
toggleExternalLinkWarningPref()
toggleWifiDownloadsOnlyPref()
clickStoragePreference()
assertStorageDialogDisplayed()
dismissDialog()
clickExternalStoragePreference()
clickInternalStoragePreference()
clickClearHistoryPreference()
assertHistoryDialogDisplayed()
dismissDialog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.kiwix.kiwixmobile.settings

import android.os.Build
import androidx.annotation.StringRes
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onData
Expand Down Expand Up @@ -100,12 +101,18 @@ class SettingsRobot : BaseRobot() {
isVisible(TextId(R.string.pref_language_title))
}

fun clickStoragePreference() {
clickRecyclerViewItems(R.string.internal_storage, R.string.external_storage)
fun clickInternalStoragePreference() {
clickRecyclerViewItems(R.string.internal_storage)
}

fun assertStorageDialogDisplayed() {
isVisible(TextId(R.string.pref_storage))
fun clickExternalStoragePreference() {
clickRecyclerViewItems(R.string.external_storage)
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
// for now when we will click on the external storage then it will show folder
// selection dialog which we are removing the #3935 so, for now, dismiss this dialog, we
// will remove this in #3935.
dismissDialog()
}
}

fun clickClearHistoryPreference() {
Expand Down

0 comments on commit 1f0cdbe

Please sign in to comment.