mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Refactored the GetContentShortcutTest
test according to compose UI.
This commit is contained in:
parent
12e17e4d87
commit
7764a6a207
@ -38,6 +38,7 @@ import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.core.R.string
|
||||
import org.kiwix.kiwixmobile.core.page.SEARCH_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.language.composables.LANGUAGE_ITEM_CHECKBOX_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
|
||||
|
@ -18,23 +18,35 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.page.history
|
||||
|
||||
import androidx.compose.ui.test.assertTextEquals
|
||||
import androidx.compose.ui.test.junit4.ComposeTestRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.performClick
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.ContentDesc
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.page.DELETE_MENU_ICON_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.core.page.SWITCH_TEXT_TESTING_TAG
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.testFlakyView
|
||||
|
||||
fun history(func: HistoryRobot.() -> Unit) = HistoryRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class HistoryRobot : BaseRobot() {
|
||||
fun assertHistoryDisplayed() {
|
||||
assertDisplayed(R.string.history_from_current_book)
|
||||
fun assertHistoryDisplayed(composeTestRule: ComposeTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitForIdle()
|
||||
onNodeWithTag(SWITCH_TEXT_TESTING_TAG)
|
||||
.assertTextEquals(context.getString(R.string.history_from_current_book))
|
||||
}
|
||||
}
|
||||
|
||||
fun clickOnTrashIcon() {
|
||||
clickOn(ContentDesc(R.string.pref_clear_all_history_title))
|
||||
fun clickOnTrashIcon(composeTestRule: ComposeTestRule) {
|
||||
composeTestRule.apply {
|
||||
waitForIdle()
|
||||
onNodeWithTag(DELETE_MENU_ICON_TESTING_TAG)
|
||||
.performClick()
|
||||
}
|
||||
}
|
||||
|
||||
fun assertDeleteHistoryDialogDisplayed() {
|
||||
|
@ -123,13 +123,13 @@ class GetContentShortcutTest {
|
||||
}
|
||||
}
|
||||
clickBookmarksOnNavDrawer {
|
||||
assertBookMarksDisplayed()
|
||||
clickOnTrashIcon()
|
||||
assertBookMarksDisplayed(composeTestRule)
|
||||
clickOnTrashIcon(composeTestRule)
|
||||
assertDeleteBookmarksDialogDisplayed()
|
||||
}
|
||||
clickHistoryOnSideNav {
|
||||
assertHistoryDisplayed()
|
||||
clickOnTrashIcon()
|
||||
assertHistoryDisplayed(composeTestRule)
|
||||
clickOnTrashIcon(composeTestRule)
|
||||
assertDeleteHistoryDialogDisplayed()
|
||||
}
|
||||
clickHostBooksOnSideNav(ZimHostRobot::assertMenuWifiHotspotDiplayed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user