mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
rebase and all changes done for optimization performance and fix test failure
This commit is contained in:
parent
b7d54f0211
commit
005f250096
@ -14,17 +14,17 @@ jobs:
|
||||
|
||||
coverageReport:
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
api-level: [21, 30, 21,30]
|
||||
api-level: [21]
|
||||
fail-fast: false
|
||||
runs-on: macOS-latest
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
env:
|
||||
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
|
||||
- name: create instrumentation coverage
|
||||
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
||||
with:
|
44
.github/workflows/coverage_api30_request.yml
vendored
Normal file
44
.github/workflows/coverage_api30_request.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: Coverage Reporting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
|
||||
coverageReport:
|
||||
strategy:
|
||||
matrix:
|
||||
api-level: [30]
|
||||
fail-fast: false
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
env:
|
||||
GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
|
||||
- name: create instrumentation coverage
|
||||
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
||||
with:
|
||||
api-level: ${{ matrix.api-level }}
|
||||
arch: x86_64
|
||||
ndk: 21.4.7075529
|
||||
script: bash contrib/instrumentation.sh
|
||||
|
||||
- name: Upload screenshot result
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ matrix.api-level }}
|
||||
path: screencap.png
|
||||
|
||||
- name: create unit coverage
|
||||
run: ./gradlew jacocoTestDebugUnitTestReport jacocoTestCustomExampleDebugUnitTestReport
|
@ -21,6 +21,7 @@ package org.kiwix.kiwixmobile
|
||||
import android.R.id
|
||||
import android.app.Instrumentation
|
||||
import android.content.Context
|
||||
import androidx.test.espresso.NoMatchingViewException
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.Direction
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
@ -81,9 +82,20 @@ abstract class BaseRobot(
|
||||
|
||||
private fun waitFor(
|
||||
findable: Findable,
|
||||
timeout: Long = VERY_LONG_WAIT
|
||||
): UiObject2? =
|
||||
uiDevice.wait(Until.findObject(findable.selector(this)), timeout)
|
||||
timeout: Long = VERY_LONG_WAIT,
|
||||
retryCount: Int = 5
|
||||
): UiObject2? {
|
||||
var uiObject2: UiObject2? = null
|
||||
for (i in 0 until retryCount) {
|
||||
try {
|
||||
uiObject2 = uiDevice.wait(Until.findObject(findable.selector(this)), timeout)
|
||||
break
|
||||
} catch (noMatchingViewException: NoMatchingViewException) {
|
||||
noMatchingViewException.printStackTrace()
|
||||
}
|
||||
}
|
||||
return uiObject2
|
||||
}
|
||||
|
||||
private fun UiObject2.customSwipe(
|
||||
direction: Direction,
|
||||
|
@ -34,13 +34,10 @@ class IntroRobot : BaseRobot() {
|
||||
private val getStarted = ViewId(R.id.get_started)
|
||||
private val viewPager = ViewId(R.id.view_pager)
|
||||
|
||||
init {
|
||||
fun swipeLeft() {
|
||||
isVisible(getStarted)
|
||||
isVisible(TextId(R.string.welcome_to_the_family))
|
||||
isVisible(TextId(R.string.humankind_knowledge))
|
||||
}
|
||||
|
||||
fun swipeLeft() {
|
||||
attempt(10) {
|
||||
isVisible(viewPager).swipeLeft()
|
||||
isVisible(TextId(R.string.save_books_offline))
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.main
|
||||
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||
@ -47,11 +47,8 @@ fun topLevel(func: TopLevelDestinationRobot.() -> Unit) =
|
||||
|
||||
class TopLevelDestinationRobot : BaseRobot() {
|
||||
|
||||
init {
|
||||
isVisible(ViewId(R.id.navigation_container))
|
||||
}
|
||||
|
||||
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
||||
isVisible(ViewId(R.id.navigation_container))
|
||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||
clickOn(ViewId(R.id.readerFragment))
|
||||
reader(func)
|
||||
|
Loading…
x
Reference in New Issue
Block a user