mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Removed the message from help screen.
* Refactored the HelpFragmentTest.
This commit is contained in:
parent
e1a25e3b9b
commit
f9a6323b27
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.help
|
||||
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.IdlingRegistry
|
||||
@ -51,6 +50,15 @@ class HelpFragmentTest : BaseActivityTest() {
|
||||
}
|
||||
waitForIdle()
|
||||
}
|
||||
context.let {
|
||||
sharedPreferenceUtil = SharedPreferenceUtil(it).apply {
|
||||
setIntroShown()
|
||||
putPrefWifiOnly(false)
|
||||
setIsPlayStoreBuildType(true)
|
||||
prefIsTest = true
|
||||
putPrefLanguage("en")
|
||||
}
|
||||
}
|
||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||
moveToState(Lifecycle.State.RESUMED)
|
||||
onActivity {
|
||||
@ -75,7 +83,6 @@ class HelpFragmentTest : BaseActivityTest() {
|
||||
|
||||
@Test
|
||||
fun verifyHelpActivity() {
|
||||
setShowPlayStoreRestriction(false)
|
||||
activityScenario.onActivity {
|
||||
it.navigate(R.id.helpFragment)
|
||||
}
|
||||
@ -89,50 +96,11 @@ class HelpFragmentTest : BaseActivityTest() {
|
||||
clickOnHowToUpdateContent()
|
||||
assertHowToUpdateContentIsExpanded()
|
||||
clickOnHowToUpdateContent()
|
||||
assertZimFileNotShowingIsNotVisible()
|
||||
clickOnSendFeedback()
|
||||
}
|
||||
LeakAssertions.assertNoLeaks()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun verifyHelpActivityWithPlayStoreRestriction() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
setShowPlayStoreRestriction(true)
|
||||
activityScenario.onActivity {
|
||||
it.navigate(R.id.helpFragment)
|
||||
}
|
||||
help {
|
||||
clickOnWhatDoesKiwixDo()
|
||||
assertWhatDoesKiwixDoIsExpanded()
|
||||
clickOnWhatDoesKiwixDo()
|
||||
clickOnWhereIsContent()
|
||||
assertWhereIsContentIsExpanded()
|
||||
clickOnWhereIsContent()
|
||||
clickOnHowToUpdateContent()
|
||||
assertHowToUpdateContentIsExpanded()
|
||||
clickOnHowToUpdateContent()
|
||||
clickOnHowToOpenZimFiles()
|
||||
assertHowToOpenZimFilesIsExpanded()
|
||||
clickOnHowToOpenZimFiles()
|
||||
clickOnSendFeedback()
|
||||
}
|
||||
LeakAssertions.assertNoLeaks()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setShowPlayStoreRestriction(showRestriction: Boolean) {
|
||||
context.let {
|
||||
sharedPreferenceUtil = SharedPreferenceUtil(it).apply {
|
||||
setIntroShown()
|
||||
putPrefWifiOnly(false)
|
||||
setIsPlayStoreBuildType(showRestriction)
|
||||
prefIsTest = true
|
||||
putPrefLanguage("en")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
fun finish() {
|
||||
IdlingRegistry.getInstance().unregister(KiwixIdlingResource.getInstance())
|
||||
|
@ -19,7 +19,6 @@ package org.kiwix.kiwixmobile.help
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
@ -83,19 +82,6 @@ class HelpRobot : BaseRobot() {
|
||||
clickOn(ViewId(id.activity_help_feedback_text_view))
|
||||
}
|
||||
|
||||
fun clickOnHowToOpenZimFiles() {
|
||||
clickOn(TextId(string.how_to_open_existing_zim_files))
|
||||
}
|
||||
|
||||
fun assertHowToOpenZimFilesIsExpanded() {
|
||||
isVisible(Text(context.getString(string.how_to_open_existing_zim_files_description)))
|
||||
}
|
||||
|
||||
fun assertZimFileNotShowingIsNotVisible() {
|
||||
onView(withText("Zim files not showing?"))
|
||||
.check(doesNotExist())
|
||||
}
|
||||
|
||||
private fun helpTextFormat(vararg stringIds: Int) =
|
||||
stringIds.joinToString(separator = "\n", transform = context::getString)
|
||||
}
|
||||
|
@ -22,21 +22,9 @@ import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.help.HelpFragment
|
||||
|
||||
class KiwixHelpFragment : HelpFragment() {
|
||||
override fun rawTitleDescriptionMap() =
|
||||
if (sharedPreferenceUtil.isPlayStoreBuildWithAndroid11OrAbove()) {
|
||||
listOf(
|
||||
R.string.help_2 to R.array.description_help_2,
|
||||
R.string.help_5 to R.array.description_help_5,
|
||||
R.string.how_to_update_content to R.array.update_content_description,
|
||||
R.string.how_to_open_existing_zim_files to getString(
|
||||
R.string.how_to_open_existing_zim_files_description
|
||||
)
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
R.string.help_2 to R.array.description_help_2,
|
||||
R.string.help_5 to R.array.description_help_5,
|
||||
R.string.how_to_update_content to R.array.update_content_description
|
||||
)
|
||||
}
|
||||
override fun rawTitleDescriptionMap() = listOf(
|
||||
R.string.help_2 to R.array.description_help_2,
|
||||
R.string.help_5 to R.array.description_help_5,
|
||||
R.string.how_to_update_content to R.array.update_content_description
|
||||
)
|
||||
}
|
||||
|
@ -324,8 +324,6 @@
|
||||
<string name="tabs_restored">Tabs restored</string>
|
||||
<string name="open_drawer">Open Drawer</string>
|
||||
<string name="close_drawer">Close Drawer</string>
|
||||
<string name="how_to_open_existing_zim_files">How to open existing ZIM files?</string>
|
||||
<string name="how_to_open_existing_zim_files_description">To read your existing zim file from storage, use the file picker(+) icon in the library screen.</string>
|
||||
<string name="preparing_file_for_copy">Preparing for copy/move</string>
|
||||
<string name="action_copy">Copy</string>
|
||||
<string name="move">Move</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user