Moved entire test functionality inside Robot

This commit is contained in:
s-ayush2903 2020-08-25 23:17:07 +05:30
parent c95ec5eadd
commit 6bb4b69eee
No known key found for this signature in database
GPG Key ID: B4341DD08B2371CB
2 changed files with 12 additions and 39 deletions

View File

@ -27,33 +27,15 @@ class KiwixSettingsActivityTest : BaseActivityTest<KiwixSettingsActivity>() {
override var activityRule = activityTestRule<KiwixSettingsActivity>()
@Test
fun testToggling() {
fun executeSettingsActivity() {
settingsRobo {
toggleButtons()
}
}
@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 {
invokeContributorsDialog()
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> =
activityRule.activity.resources.getStringArray(R.array.pref_night_modes_entries)
}

View File

@ -27,6 +27,7 @@ import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.withClassName
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.schibsted.spain.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
import org.hamcrest.Matcher
import org.hamcrest.Matchers
import org.kiwix.kiwixmobile.BaseRobot
@ -65,14 +66,17 @@ class SettingsRobot : BaseRobot() {
fun invokeLanguageDialog() {
clickRecyclerViewItems(R.string.device_default)
assertDisplayed(R.string.pref_language_title)
}
fun invokeStorageDialog() {
clickRecyclerViewItems(R.string.internal_storage, R.string.external_storage)
assertDisplayed(R.string.pref_storage)
}
fun invokeHistoryDeletionDialog() {
clickRecyclerViewItems(R.string.pref_clear_all_history_title)
assertDisplayed(R.string.clear_all_history_dialog_title)
}
fun invokeNightModeDialog() {
@ -85,6 +89,7 @@ class SettingsRobot : BaseRobot() {
}
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)
}
}