mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -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
|
package org.kiwix.kiwixmobile.help
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.test.core.app.ActivityScenario
|
import androidx.test.core.app.ActivityScenario
|
||||||
import androidx.test.espresso.IdlingRegistry
|
import androidx.test.espresso.IdlingRegistry
|
||||||
@ -51,6 +50,15 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
}
|
}
|
||||||
waitForIdle()
|
waitForIdle()
|
||||||
}
|
}
|
||||||
|
context.let {
|
||||||
|
sharedPreferenceUtil = SharedPreferenceUtil(it).apply {
|
||||||
|
setIntroShown()
|
||||||
|
putPrefWifiOnly(false)
|
||||||
|
setIsPlayStoreBuildType(true)
|
||||||
|
prefIsTest = true
|
||||||
|
putPrefLanguage("en")
|
||||||
|
}
|
||||||
|
}
|
||||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||||
moveToState(Lifecycle.State.RESUMED)
|
moveToState(Lifecycle.State.RESUMED)
|
||||||
onActivity {
|
onActivity {
|
||||||
@ -75,7 +83,6 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun verifyHelpActivity() {
|
fun verifyHelpActivity() {
|
||||||
setShowPlayStoreRestriction(false)
|
|
||||||
activityScenario.onActivity {
|
activityScenario.onActivity {
|
||||||
it.navigate(R.id.helpFragment)
|
it.navigate(R.id.helpFragment)
|
||||||
}
|
}
|
||||||
@ -89,50 +96,11 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
clickOnHowToUpdateContent()
|
clickOnHowToUpdateContent()
|
||||||
assertHowToUpdateContentIsExpanded()
|
assertHowToUpdateContentIsExpanded()
|
||||||
clickOnHowToUpdateContent()
|
clickOnHowToUpdateContent()
|
||||||
assertZimFileNotShowingIsNotVisible()
|
|
||||||
clickOnSendFeedback()
|
clickOnSendFeedback()
|
||||||
}
|
}
|
||||||
LeakAssertions.assertNoLeaks()
|
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
|
@After
|
||||||
fun finish() {
|
fun finish() {
|
||||||
IdlingRegistry.getInstance().unregister(KiwixIdlingResource.getInstance())
|
IdlingRegistry.getInstance().unregister(KiwixIdlingResource.getInstance())
|
||||||
|
@ -19,7 +19,6 @@ package org.kiwix.kiwixmobile.help
|
|||||||
|
|
||||||
import androidx.test.espresso.Espresso.onView
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.action.ViewActions.click
|
import androidx.test.espresso.action.ViewActions.click
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||||
import org.kiwix.kiwixmobile.BaseRobot
|
import org.kiwix.kiwixmobile.BaseRobot
|
||||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||||
@ -83,19 +82,6 @@ class HelpRobot : BaseRobot() {
|
|||||||
clickOn(ViewId(id.activity_help_feedback_text_view))
|
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) =
|
private fun helpTextFormat(vararg stringIds: Int) =
|
||||||
stringIds.joinToString(separator = "\n", transform = context::getString)
|
stringIds.joinToString(separator = "\n", transform = context::getString)
|
||||||
}
|
}
|
||||||
|
@ -22,21 +22,9 @@ import org.kiwix.kiwixmobile.core.R
|
|||||||
import org.kiwix.kiwixmobile.core.help.HelpFragment
|
import org.kiwix.kiwixmobile.core.help.HelpFragment
|
||||||
|
|
||||||
class KiwixHelpFragment : HelpFragment() {
|
class KiwixHelpFragment : HelpFragment() {
|
||||||
override fun rawTitleDescriptionMap() =
|
override fun rawTitleDescriptionMap() = listOf(
|
||||||
if (sharedPreferenceUtil.isPlayStoreBuildWithAndroid11OrAbove()) {
|
R.string.help_2 to R.array.description_help_2,
|
||||||
listOf(
|
R.string.help_5 to R.array.description_help_5,
|
||||||
R.string.help_2 to R.array.description_help_2,
|
R.string.how_to_update_content to R.array.update_content_description
|
||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -324,8 +324,6 @@
|
|||||||
<string name="tabs_restored">Tabs restored</string>
|
<string name="tabs_restored">Tabs restored</string>
|
||||||
<string name="open_drawer">Open Drawer</string>
|
<string name="open_drawer">Open Drawer</string>
|
||||||
<string name="close_drawer">Close 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="preparing_file_for_copy">Preparing for copy/move</string>
|
||||||
<string name="action_copy">Copy</string>
|
<string name="action_copy">Copy</string>
|
||||||
<string name="move">Move</string>
|
<string name="move">Move</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user