mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 03:16:27 -04:00
Fix nightly workflow is almost always red
This commit is contained in:
parent
012d010728
commit
82d79934d5
@ -18,13 +18,10 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.language
|
||||
|
||||
import android.widget.AutoCompleteTextView
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.typeText
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable
|
||||
@ -54,7 +51,7 @@ class LanguageRobot : BaseRobot() {
|
||||
|
||||
fun searchAndSaveLanguage(searchLanguage: String, matchLanguage: String) {
|
||||
onView(withId(R.id.menu_language_search)).perform(click())
|
||||
onView(isAssignableFrom(AutoCompleteTextView::class.java)).perform(typeText(searchLanguage))
|
||||
isVisible(ViewId(androidx.appcompat.R.id.search_src_text)).text = searchLanguage
|
||||
onView(withText(matchLanguage)).perform(click())
|
||||
onView(withId(R.id.menu_language_save)).perform(click())
|
||||
}
|
||||
|
@ -19,18 +19,24 @@ package org.kiwix.kiwixmobile.main
|
||||
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
|
||||
import org.kiwix.kiwixmobile.help.HelpRobot
|
||||
import org.kiwix.kiwixmobile.nav.destination.library.OnlineLibraryRobot
|
||||
import org.kiwix.kiwixmobile.settings.SettingsRobot
|
||||
import org.kiwix.kiwixmobile.webserver.ZimHostRobot
|
||||
|
||||
class TopLevelDestinationTest : BaseActivityTest() {
|
||||
|
||||
override var activityRule: ActivityTestRule<KiwixMainActivity> = activityTestRule {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit {
|
||||
@Before
|
||||
fun setUp() {
|
||||
PreferenceManager.getDefaultSharedPreferences(
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.applicationContext
|
||||
).edit {
|
||||
putBoolean(SharedPreferenceUtil.PREF_SHOW_INTRO, false)
|
||||
putBoolean(SharedPreferenceUtil.PREF_WIFI_ONLY, false)
|
||||
}
|
||||
@ -38,6 +44,7 @@ class TopLevelDestinationTest : BaseActivityTest() {
|
||||
|
||||
@Test
|
||||
fun testTopLevelDestination() {
|
||||
ActivityScenario.launch(KiwixMainActivity::class.java)
|
||||
topLevel {
|
||||
clickReaderOnBottomNav {
|
||||
}
|
||||
@ -46,11 +53,7 @@ class TopLevelDestinationTest : BaseActivityTest() {
|
||||
clickFileTransferIcon {
|
||||
}
|
||||
}
|
||||
clickDownloadOnBottomNav {
|
||||
assertLibraryListDisplayed()
|
||||
clickOnGlobeIcon {
|
||||
}
|
||||
}
|
||||
clickDownloadOnBottomNav(OnlineLibraryRobot::assertLibraryListDisplayed)
|
||||
clickBookmarksOnNavDrawer {
|
||||
assertBookMarksDisplayed()
|
||||
clickOnTrashIcon()
|
||||
|
@ -22,8 +22,6 @@ import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.language.LanguageRobot
|
||||
import org.kiwix.kiwixmobile.language.language
|
||||
|
||||
fun onlineLibrary(func: OnlineLibraryRobot.() -> Unit) =
|
||||
OnlineLibraryRobot().applyWithViewHierarchyPrinting(func)
|
||||
@ -34,8 +32,7 @@ class OnlineLibraryRobot : BaseRobot() {
|
||||
isVisible(ViewId(R.id.libraryList))
|
||||
}
|
||||
|
||||
fun clickOnGlobeIcon(func: LanguageRobot.() -> Unit) {
|
||||
fun clickOnGlobeIcon() {
|
||||
clickOn(ViewId(R.id.select_language))
|
||||
language(func)
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,16 @@
|
||||
package org.kiwix.kiwixmobile.utils
|
||||
|
||||
import android.util.Log
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import com.adevinta.android.barista.interaction.BaristaDialogInteractions
|
||||
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions
|
||||
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawerWithGravity
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
import java.lang.RuntimeException
|
||||
|
||||
/**
|
||||
* Created by mhutti1 on 27/04/17.
|
||||
@ -39,7 +39,7 @@ object StandardActions {
|
||||
}
|
||||
|
||||
fun openDrawer() {
|
||||
BaristaDrawerInteractions.openDrawer()
|
||||
openDrawerWithGravity(R.id.navigation_container, GravityCompat.START)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
Loading…
x
Reference in New Issue
Block a user