mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 10:18:59 +03:00
RetryTestRule: don't modify in scripts, use buildConfigField instead
Modifying code in scripts is bad Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
421a672e1d
commit
b5f727f945
3 changed files with 8 additions and 3 deletions
|
@ -21,7 +21,6 @@ steps:
|
|||
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
|
||||
- sed -i s"#server#server#" gradle.properties
|
||||
- sed -i s"#1#5#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- ./gradlew assembleGplay
|
||||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
|
@ -85,7 +84,6 @@ steps:
|
|||
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
|
||||
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
|
||||
- sed -i s"#1#5#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- scripts/runCombinedTest.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER
|
||||
|
||||
services:
|
||||
|
|
|
@ -111,6 +111,8 @@ android {
|
|||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
|
||||
buildConfigField 'boolean', 'CI', ciBuild.toString()
|
||||
|
||||
// arguments to be passed to functional tests
|
||||
testInstrumentationRunner "com.nextcloud.client.ScreenshotTestRunner"
|
||||
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
|
||||
|
@ -235,6 +237,7 @@ android {
|
|||
htmlOutput file("$project.buildDir/reports/lint/lint.html")
|
||||
htmlReport true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
package com.nextcloud.client
|
||||
|
||||
import android.util.Log
|
||||
import com.owncloud.android.BuildConfig
|
||||
import org.junit.rules.TestRule
|
||||
import org.junit.runner.Description
|
||||
import org.junit.runners.model.Statement
|
||||
|
@ -30,10 +31,13 @@ import org.junit.runners.model.Statement
|
|||
/**
|
||||
* C&p from https://stackoverflow.com/questions/45635833/how-can-i-use-flakytest-annotation-now on 18.03.2020
|
||||
*/
|
||||
class RetryTestRule(val retryCount: Int = 1) : TestRule {
|
||||
class RetryTestRule(val retryCount: Int = defaultRetryValue) : TestRule {
|
||||
|
||||
companion object {
|
||||
private val TAG = RetryTestRule::class.java.simpleName
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
private val defaultRetryValue: Int = if (BuildConfig.CI) 5 else 1
|
||||
}
|
||||
|
||||
override fun apply(base: Statement, description: Description): Statement {
|
||||
|
|
Loading…
Reference in a new issue