mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 17:08:59 -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:
|
coverageReport:
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 2
|
|
||||||
matrix:
|
matrix:
|
||||||
api-level: [21, 30, 21,30]
|
api-level: [21]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: macOS-latest
|
runs-on: macos-10.15
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
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
|
- name: create instrumentation coverage
|
||||||
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
||||||
with:
|
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.R.id
|
||||||
import android.app.Instrumentation
|
import android.app.Instrumentation
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.test.espresso.NoMatchingViewException
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.uiautomator.Direction
|
import androidx.test.uiautomator.Direction
|
||||||
import androidx.test.uiautomator.UiDevice
|
import androidx.test.uiautomator.UiDevice
|
||||||
@ -81,9 +82,20 @@ abstract class BaseRobot(
|
|||||||
|
|
||||||
private fun waitFor(
|
private fun waitFor(
|
||||||
findable: Findable,
|
findable: Findable,
|
||||||
timeout: Long = VERY_LONG_WAIT
|
timeout: Long = VERY_LONG_WAIT,
|
||||||
): UiObject2? =
|
retryCount: Int = 5
|
||||||
uiDevice.wait(Until.findObject(findable.selector(this)), timeout)
|
): 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(
|
private fun UiObject2.customSwipe(
|
||||||
direction: Direction,
|
direction: Direction,
|
||||||
|
@ -34,13 +34,10 @@ class IntroRobot : BaseRobot() {
|
|||||||
private val getStarted = ViewId(R.id.get_started)
|
private val getStarted = ViewId(R.id.get_started)
|
||||||
private val viewPager = ViewId(R.id.view_pager)
|
private val viewPager = ViewId(R.id.view_pager)
|
||||||
|
|
||||||
init {
|
fun swipeLeft() {
|
||||||
isVisible(getStarted)
|
isVisible(getStarted)
|
||||||
isVisible(TextId(R.string.welcome_to_the_family))
|
isVisible(TextId(R.string.welcome_to_the_family))
|
||||||
isVisible(TextId(R.string.humankind_knowledge))
|
isVisible(TextId(R.string.humankind_knowledge))
|
||||||
}
|
|
||||||
|
|
||||||
fun swipeLeft() {
|
|
||||||
attempt(10) {
|
attempt(10) {
|
||||||
isVisible(viewPager).swipeLeft()
|
isVisible(viewPager).swipeLeft()
|
||||||
isVisible(TextId(R.string.save_books_offline))
|
isVisible(TextId(R.string.save_books_offline))
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.main
|
package org.kiwix.kiwixmobile.main
|
||||||
|
|
||||||
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
|
||||||
import applyWithViewHierarchyPrinting
|
import applyWithViewHierarchyPrinting
|
||||||
|
import com.adevinta.android.barista.interaction.BaristaSleepInteractions
|
||||||
import org.kiwix.kiwixmobile.BaseRobot
|
import org.kiwix.kiwixmobile.BaseRobot
|
||||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||||
import org.kiwix.kiwixmobile.Findable.ViewId
|
import org.kiwix.kiwixmobile.Findable.ViewId
|
||||||
@ -47,11 +47,8 @@ fun topLevel(func: TopLevelDestinationRobot.() -> Unit) =
|
|||||||
|
|
||||||
class TopLevelDestinationRobot : BaseRobot() {
|
class TopLevelDestinationRobot : BaseRobot() {
|
||||||
|
|
||||||
init {
|
|
||||||
isVisible(ViewId(R.id.navigation_container))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
||||||
|
isVisible(ViewId(R.id.navigation_container))
|
||||||
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS.toLong())
|
||||||
clickOn(ViewId(R.id.readerFragment))
|
clickOn(ViewId(R.id.readerFragment))
|
||||||
reader(func)
|
reader(func)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user