mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-14 09:57:31 -04:00
Merge pull request #2833 from kiwix/Issue#2832
Change CI OS to macos-12, running 30 and 21 on separate runner, remove code coverage
This commit is contained in:
commit
b0ff782cdd
12
.github/workflows/coverage.yml
vendored
12
.github/workflows/coverage.yml
vendored
@ -14,11 +14,10 @@ jobs:
|
|||||||
|
|
||||||
coverageReport:
|
coverageReport:
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 2
|
|
||||||
matrix:
|
matrix:
|
||||||
api-level: [21, 30, 21,30]
|
api-level: [21,30]
|
||||||
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
|
||||||
@ -27,12 +26,15 @@ jobs:
|
|||||||
|
|
||||||
- name: create instrumentation coverage
|
- name: create instrumentation coverage
|
||||||
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
uses: ReactiveCircus/android-emulator-runner@v2.23.0
|
||||||
|
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"
|
||||||
with:
|
with:
|
||||||
api-level: ${{ matrix.api-level }}
|
api-level: ${{ matrix.api-level }}
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
ndk: 21.4.7075529
|
ndk: 21.4.7075529
|
||||||
script: bash contrib/instrumentation.sh
|
script: bash contrib/instrumentation.sh
|
||||||
|
|
||||||
|
|
||||||
- name: Upload screenshot result
|
- name: Upload screenshot result
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
if: failure()
|
if: failure()
|
||||||
@ -41,15 +43,17 @@ jobs:
|
|||||||
path: screencap.png
|
path: screencap.png
|
||||||
|
|
||||||
- name: create unit coverage
|
- name: create unit coverage
|
||||||
|
if: ${{ matrix.api-level==21 }}
|
||||||
run: ./gradlew jacocoTestDebugUnitTestReport jacocoTestCustomExampleDebugUnitTestReport
|
run: ./gradlew jacocoTestDebugUnitTestReport jacocoTestCustomExampleDebugUnitTestReport
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
|
if: ${{ matrix.api-level==21 }}
|
||||||
run: |
|
run: |
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
- name: Upload Coverage to GH-Actions
|
- name: Upload Coverage to GH-Actions
|
||||||
uses: actions/upload-artifact@v2.2.0
|
uses: actions/upload-artifact@v2.2.0
|
||||||
if: ${{ always() }}
|
if: ${{ matrix.api-level==21 }}
|
||||||
with:
|
with:
|
||||||
name: Tests Coverage Report
|
name: Tests Coverage Report
|
||||||
path: |
|
path: |
|
||||||
|
@ -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