mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-18 11:55:38 -04:00
Moved entire test functionality inside Robot
This commit is contained in:
parent
c95ec5eadd
commit
6bb4b69eee
@ -27,33 +27,15 @@ class KiwixSettingsActivityTest : BaseActivityTest<KiwixSettingsActivity>() {
|
|||||||
override var activityRule = activityTestRule<KiwixSettingsActivity>()
|
override var activityRule = activityTestRule<KiwixSettingsActivity>()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testToggling() {
|
fun executeSettingsActivity() {
|
||||||
settingsRobo {
|
settingsRobo {
|
||||||
toggleButtons()
|
toggleButtons()
|
||||||
}
|
invokeContributorsDialog()
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testLanguageDialog() {
|
|
||||||
settingsRobo {
|
|
||||||
invokeLanguageDialog()
|
|
||||||
assertDisplayed(R.string.pref_language_title)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testStorageDialog() {
|
|
||||||
settingsRobo {
|
|
||||||
invokeStorageDialog()
|
|
||||||
assertDisplayed(R.string.pref_storage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testHistoryDialog() {
|
|
||||||
settingsRobo {
|
|
||||||
invokeHistoryDeletionDialog()
|
invokeHistoryDeletionDialog()
|
||||||
assertDisplayed(R.string.clear_all_history_dialog_title)
|
invokeLanguageDialog()
|
||||||
|
// invokeNightModeDialog()
|
||||||
|
invokeStorageDialog()
|
||||||
|
checkRemainingTextViews()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,20 +49,6 @@ class KiwixSettingsActivityTest : BaseActivityTest<KiwixSettingsActivity>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testCreditsDialog() {
|
|
||||||
settingsRobo {
|
|
||||||
invokeContributorsDialog()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testVersionTextView() {
|
|
||||||
settingsRobo {
|
|
||||||
checkRemainingTextViews()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun nightModeStrings(): Array<String> =
|
private fun nightModeStrings(): Array<String> =
|
||||||
activityRule.activity.resources.getStringArray(R.array.pref_night_modes_entries)
|
activityRule.activity.resources.getStringArray(R.array.pref_night_modes_entries)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
|
|||||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||||
|
import com.schibsted.spain.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||||
import org.hamcrest.Matcher
|
import org.hamcrest.Matcher
|
||||||
import org.hamcrest.Matchers
|
import org.hamcrest.Matchers
|
||||||
import org.kiwix.kiwixmobile.BaseRobot
|
import org.kiwix.kiwixmobile.BaseRobot
|
||||||
@ -65,14 +66,17 @@ class SettingsRobot : BaseRobot() {
|
|||||||
|
|
||||||
fun invokeLanguageDialog() {
|
fun invokeLanguageDialog() {
|
||||||
clickRecyclerViewItems(R.string.device_default)
|
clickRecyclerViewItems(R.string.device_default)
|
||||||
|
assertDisplayed(R.string.pref_language_title)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun invokeStorageDialog() {
|
fun invokeStorageDialog() {
|
||||||
clickRecyclerViewItems(R.string.internal_storage, R.string.external_storage)
|
clickRecyclerViewItems(R.string.internal_storage, R.string.external_storage)
|
||||||
|
assertDisplayed(R.string.pref_storage)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun invokeHistoryDeletionDialog() {
|
fun invokeHistoryDeletionDialog() {
|
||||||
clickRecyclerViewItems(R.string.pref_clear_all_history_title)
|
clickRecyclerViewItems(R.string.pref_clear_all_history_title)
|
||||||
|
assertDisplayed(R.string.clear_all_history_dialog_title)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun invokeNightModeDialog() {
|
fun invokeNightModeDialog() {
|
||||||
@ -85,6 +89,7 @@ class SettingsRobot : BaseRobot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun checkRemainingTextViews() {
|
fun checkRemainingTextViews() {
|
||||||
clickRecyclerViewItems(R.string.pref_info_version, R.string.pref_text_zoom_title)
|
clickRecyclerViewItems(R.string.pref_info_version)
|
||||||
|
clickRecyclerViewItems(R.string.pref_text_zoom_title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user