mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 23:07:26 -04:00
Rebase all changes in once commit
This commit is contained in:
parent
9a227f532d
commit
871cefad3f
7
.github/workflows/coverage.yml
vendored
7
.github/workflows/coverage.yml
vendored
@ -14,18 +14,19 @@ jobs:
|
|||||||
|
|
||||||
coverageReport:
|
coverageReport:
|
||||||
strategy:
|
strategy:
|
||||||
|
max-parallel: 2
|
||||||
matrix:
|
matrix:
|
||||||
api-level: [21, 21, 30]
|
api-level: [21, 30, 21,30]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: create instrumentation coverage
|
- name: create instrumentation coverage
|
||||||
uses: ReactiveCircus/android-emulator-runner@v2.14.3
|
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
||||||
with:
|
with:
|
||||||
api-level: ${{ matrix.api-level }}
|
api-level: ${{ matrix.api-level }}
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.kiwix.kiwixmobile">
|
package="org.kiwix.kiwixmobile">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:usesCleartextTraffic="true"/>
|
||||||
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator" />
|
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -81,7 +81,7 @@ abstract class BaseRobot(
|
|||||||
|
|
||||||
private fun waitFor(
|
private fun waitFor(
|
||||||
findable: Findable,
|
findable: Findable,
|
||||||
timeout: Long = DEFAULT_WAIT
|
timeout: Long = VERY_LONG_WAIT
|
||||||
): UiObject2? =
|
): UiObject2? =
|
||||||
uiDevice.wait(Until.findObject(findable.selector(this)), timeout)
|
uiDevice.wait(Until.findObject(findable.selector(this)), timeout)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.help
|
package org.kiwix.kiwixmobile.help
|
||||||
|
|
||||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
|
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||||
import org.kiwix.kiwixmobile.R
|
import org.kiwix.kiwixmobile.R
|
||||||
@ -26,7 +26,7 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun verifyHelpActivity() {
|
fun verifyHelpActivity() {
|
||||||
runOnUiThread { activityRule.activity.navigate(R.id.helpFragment) }
|
UiThreadStatement.runOnUiThread { activityRule.activity.navigate(R.id.helpFragment) }
|
||||||
help {
|
help {
|
||||||
clickOnWhatDoesKiwixDo()
|
clickOnWhatDoesKiwixDo()
|
||||||
assertWhatDoesKiwixDoIsExpanded()
|
assertWhatDoesKiwixDoIsExpanded()
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.intro
|
package org.kiwix.kiwixmobile.intro
|
||||||
|
|
||||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
|
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.kiwix.kiwixmobile.BaseActivityTest
|
import org.kiwix.kiwixmobile.BaseActivityTest
|
||||||
import org.kiwix.kiwixmobile.R
|
import org.kiwix.kiwixmobile.R
|
||||||
@ -26,7 +26,7 @@ class IntroFragmentTest : BaseActivityTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun viewIsSwipeableAndNavigatesToMain() {
|
fun viewIsSwipeableAndNavigatesToMain() {
|
||||||
runOnUiThread { activityRule.activity.navigate(R.id.introFragment) }
|
UiThreadStatement.runOnUiThread { activityRule.activity.navigate(R.id.introFragment) }
|
||||||
intro(IntroRobot::swipeLeft) clickGetStarted { }
|
intro(IntroRobot::swipeLeft) clickGetStarted { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.main
|
package org.kiwix.kiwixmobile.main
|
||||||
|
|
||||||
|
import com.schibsted.spain.barista.interaction.BaristaSleepInteractions
|
||||||
import applyWithViewHierarchyPrinting
|
import applyWithViewHierarchyPrinting
|
||||||
import org.kiwix.kiwixmobile.BaseRobot
|
import org.kiwix.kiwixmobile.BaseRobot
|
||||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||||
@ -36,6 +37,7 @@ import org.kiwix.kiwixmobile.page.history.HistoryRobot
|
|||||||
import org.kiwix.kiwixmobile.page.history.history
|
import org.kiwix.kiwixmobile.page.history.history
|
||||||
import org.kiwix.kiwixmobile.settings.SettingsRobot
|
import org.kiwix.kiwixmobile.settings.SettingsRobot
|
||||||
import org.kiwix.kiwixmobile.settings.settingsRobo
|
import org.kiwix.kiwixmobile.settings.settingsRobo
|
||||||
|
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||||
import org.kiwix.kiwixmobile.utils.StandardActions.openDrawer
|
import org.kiwix.kiwixmobile.utils.StandardActions.openDrawer
|
||||||
import org.kiwix.kiwixmobile.webserver.ZimHostRobot
|
import org.kiwix.kiwixmobile.webserver.ZimHostRobot
|
||||||
import org.kiwix.kiwixmobile.webserver.zimHost
|
import org.kiwix.kiwixmobile.webserver.zimHost
|
||||||
@ -50,6 +52,7 @@ class TopLevelDestinationRobot : BaseRobot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
||||||
|
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||||
clickOn(ViewId(R.id.readerFragment))
|
clickOn(ViewId(R.id.readerFragment))
|
||||||
reader(func)
|
reader(func)
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
android:extractNativeLibs="false"
|
android:extractNativeLibs="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
tools:targetApi="m">
|
tools:targetApi="m">
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ object Versions {
|
|||||||
|
|
||||||
const val org_jacoco: String = "0.8.7"
|
const val org_jacoco: String = "0.8.7"
|
||||||
|
|
||||||
const val io_mockk: String = "1.10.2"
|
const val io_mockk: String = "1.12.0"
|
||||||
|
|
||||||
const val android_arch_lifecycle_extensions: String = "1.1.1"
|
const val android_arch_lifecycle_extensions: String = "1.1.1"
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
<!-- Device with versions >= Pie need this permission -->
|
<!-- Device with versions >= Pie need this permission -->
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||||
|
tools:ignore="QueryAllPackagesPermission" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -34,7 +34,7 @@ private const val CONNECTION_TIMEOUT = 10L
|
|||||||
private const val READ_TIMEOUT = 60L
|
private const val READ_TIMEOUT = 60L
|
||||||
private const val CALL_TIMEOUT = 60L
|
private const val CALL_TIMEOUT = 60L
|
||||||
private const val USER_AGENT = "kiwix-android-version:${BuildConfig.VERSION_CODE}"
|
private const val USER_AGENT = "kiwix-android-version:${BuildConfig.VERSION_CODE}"
|
||||||
private const val KIWIX_DOWNLOAD_URL = "http://mirror.download.kiwix.org/"
|
private const val KIWIX_DOWNLOAD_URL = "https://mirror.download.kiwix.org/"
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
class NetworkModule {
|
class NetworkModule {
|
||||||
|
@ -34,7 +34,8 @@ data class StartSpeechInput(private val actions: Channel<Action>) : SideEffect<U
|
|||||||
override fun invokeWith(activity: AppCompatActivity) {
|
override fun invokeWith(activity: AppCompatActivity) {
|
||||||
try {
|
try {
|
||||||
activity.startActivityForResult(
|
activity.startActivityForResult(
|
||||||
Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
|
Intent().apply {
|
||||||
|
action = RecognizerIntent.ACTION_RECOGNIZE_SPEECH
|
||||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
||||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
|
putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
|
||||||
putExtra(
|
putExtra(
|
||||||
|
@ -50,16 +50,16 @@ internal class StartSpeechInputTest {
|
|||||||
val activity = mockk<AppCompatActivity>()
|
val activity = mockk<AppCompatActivity>()
|
||||||
every { activity.getString(R.string.app_name) } returns "app"
|
every { activity.getString(R.string.app_name) } returns "app"
|
||||||
every { activity.getString(R.string.speech_prompt_text, "app") } returns "the app"
|
every { activity.getString(R.string.speech_prompt_text, "app") } returns "the app"
|
||||||
every { activity.startActivityForResult(any(), any()) } throws ActivityNotFoundException()
|
every { activity.startActivityForResult(any(), any()) } returns Unit
|
||||||
mockkConstructor(Intent::class)
|
mockkConstructor(Intent::class)
|
||||||
StartSpeechInput(actions).invokeWith(activity)
|
StartSpeechInput(actions).invokeWith(activity)
|
||||||
verify {
|
verify {
|
||||||
anyConstructed<Intent>().putExtra(
|
constructedWith<Intent>().putExtra(
|
||||||
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
||||||
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
|
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
|
||||||
)
|
)
|
||||||
anyConstructed<Intent>().putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
|
constructedWith<Intent>().putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
|
||||||
anyConstructed<Intent>().putExtra(RecognizerIntent.EXTRA_PROMPT, "the app")
|
constructedWith<Intent>().putExtra(RecognizerIntent.EXTRA_PROMPT, "the app")
|
||||||
activity.startActivityForResult(any(), StartSpeechInput.REQ_CODE_SPEECH_INPUT)
|
activity.startActivityForResult(any(), StartSpeechInput.REQ_CODE_SPEECH_INPUT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"app_name": "Test Custom App",
|
"app_name": "Test Custom App",
|
||||||
"zim_url": "http://download.kiwix.org/zim/wikipedia_fr_test.zim",
|
"zim_url": "https://mirror.download.kiwix.org/zim/wikipedia/wikipedia_ace_all_maxi_2022-03.zim",
|
||||||
"enforced_lang": "en",
|
"enforced_lang": "en",
|
||||||
"disable_sidebar": false,
|
"disable_sidebar": false,
|
||||||
"disable_tabs": false,
|
"disable_tabs": false,
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
android:extractNativeLibs="false"
|
android:extractNativeLibs="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
tools:targetApi="m">
|
tools:targetApi="m">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user