mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-15 02:18:04 -04:00
Fixed HelpFragmentTest and PlayStoreRestrictionTest on api level 24
This commit is contained in:
parent
90dc8ec292
commit
b572d02e6c
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.help
|
package org.kiwix.kiwixmobile.help
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
@ -83,26 +84,28 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun verifyHelpActivityWithPlayStoreRestriction() {
|
fun verifyHelpActivityWithPlayStoreRestriction() {
|
||||||
setShowPlayStoreRestriction(true)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
activityScenario.onActivity {
|
setShowPlayStoreRestriction(true)
|
||||||
it.navigate(R.id.helpFragment)
|
activityScenario.onActivity {
|
||||||
|
it.navigate(R.id.helpFragment)
|
||||||
|
}
|
||||||
|
help {
|
||||||
|
clickOnWhatDoesKiwixDo()
|
||||||
|
assertWhatDoesKiwixDoIsExpanded()
|
||||||
|
clickOnWhatDoesKiwixDo()
|
||||||
|
clickOnWhereIsContent()
|
||||||
|
assertWhereIsContentIsExpanded()
|
||||||
|
clickOnWhereIsContent()
|
||||||
|
clickOnHowToUpdateContent()
|
||||||
|
assertHowToUpdateContentIsExpanded()
|
||||||
|
clickOnHowToUpdateContent()
|
||||||
|
clickOnZimFileNotShowing()
|
||||||
|
assertZimFileNotShowingIsExpanded()
|
||||||
|
clickOnZimFileNotShowing()
|
||||||
|
clickOnSendFeedback()
|
||||||
|
}
|
||||||
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
help {
|
|
||||||
clickOnWhatDoesKiwixDo()
|
|
||||||
assertWhatDoesKiwixDoIsExpanded()
|
|
||||||
clickOnWhatDoesKiwixDo()
|
|
||||||
clickOnWhereIsContent()
|
|
||||||
assertWhereIsContentIsExpanded()
|
|
||||||
clickOnWhereIsContent()
|
|
||||||
clickOnHowToUpdateContent()
|
|
||||||
assertHowToUpdateContentIsExpanded()
|
|
||||||
clickOnHowToUpdateContent()
|
|
||||||
clickOnZimFileNotShowing()
|
|
||||||
assertZimFileNotShowingIsExpanded()
|
|
||||||
clickOnZimFileNotShowing()
|
|
||||||
clickOnSendFeedback()
|
|
||||||
}
|
|
||||||
LeakAssertions.assertNoLeaks()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setShowPlayStoreRestriction(showRestriction: Boolean) {
|
private fun setShowPlayStoreRestriction(showRestriction: Boolean) {
|
||||||
|
@ -78,29 +78,33 @@ class PlayStoreRestrictionDialogTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun showPlayStoreRestrictionDialog() {
|
fun showPlayStoreRestrictionDialog() {
|
||||||
setShowPlayStoreRestrictionDialog(true)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
setShowPlayStoreRestrictionDialog(true)
|
||||||
moveToState(Lifecycle.State.RESUMED)
|
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||||
|
moveToState(Lifecycle.State.RESUMED)
|
||||||
|
}
|
||||||
|
playStoreRestriction {
|
||||||
|
clickLibraryOnBottomNav()
|
||||||
|
assertPlayStoreRestrictionDialogDisplayed()
|
||||||
|
clickOnUnderstood()
|
||||||
|
}
|
||||||
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
playStoreRestriction {
|
|
||||||
clickLibraryOnBottomNav()
|
|
||||||
assertPlayStoreRestrictionDialogDisplayed()
|
|
||||||
clickOnUnderstood()
|
|
||||||
}
|
|
||||||
LeakAssertions.assertNoLeaks()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testPlayStoreDialogShowOnlyOnce() {
|
fun testPlayStoreDialogShowOnlyOnce() {
|
||||||
setShowPlayStoreRestrictionDialog(false)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
setShowPlayStoreRestrictionDialog(false)
|
||||||
moveToState(Lifecycle.State.RESUMED)
|
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||||
|
moveToState(Lifecycle.State.RESUMED)
|
||||||
|
}
|
||||||
|
playStoreRestriction {
|
||||||
|
clickLibraryOnBottomNav()
|
||||||
|
assetPlayStoreRestrictionDialogNotDisplayed()
|
||||||
|
}
|
||||||
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
playStoreRestriction {
|
|
||||||
clickLibraryOnBottomNav()
|
|
||||||
assetPlayStoreRestrictionDialogNotDisplayed()
|
|
||||||
}
|
|
||||||
LeakAssertions.assertNoLeaks()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setShowPlayStoreRestrictionDialog(showDialog: Boolean) {
|
private fun setShowPlayStoreRestrictionDialog(showDialog: Boolean) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user