From ebdbf32c330d4f4f3c0ee4705395ae5ed986ab7d Mon Sep 17 00:00:00 2001 From: "v.scharf" Date: Wed, 12 Aug 2026 14:11:22 +0200 Subject: [PATCH] Fix androidTest junit classpath --- .woodpecker/integration-test.yml | 6 +++--- opencloudApp/build.gradle | 1 + .../src/integrationTest/docker-compose.yaml | 2 +- .../java/eu/opencloud/android/IntegrationTest.kt | 15 +++++++++++++++ .../java/eu/opencloud/android/LoginTest.kt | 1 + opencloudComLibrary/build.gradle | 7 ++++++- 6 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 opencloudApp/src/integrationTest/java/eu/opencloud/android/IntegrationTest.kt diff --git a/.woodpecker/integration-test.yml b/.woodpecker/integration-test.yml index f3dbd34bf1..0e3f4cdd5b 100644 --- a/.woodpecker/integration-test.yml +++ b/.woodpecker/integration-test.yml @@ -11,15 +11,15 @@ labels: platform: android-emulator steps: - - name: run tests + - name: integration tests image: *android_image commands: - adb connect android-emulator-cuda:5555 - adb devices - - curl -L -o adbserver-desktop.jar https://github.com/KasperskyLab/Kaspresso/refs/tags/1.6.0/artifacts/adbserver-desktop.jar + - curl -fL -o adbserver-desktop.jar https://raw.githubusercontent.com/KasperskyLab/Kaspresso/v.1.6.0/artifacts/adbserver-desktop.jar - java -jar adbserver-desktop.jar & - sleep 3 - - ./gradlew :opencloudApp:connectedOriginalDebugAndroidTest --console=plain + - ./gradlew :opencloudApp:connectedOriginalDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=eu.opencloud.android.IntegrationTest --console=plain - name: instrumented data tests image: *android_image diff --git a/opencloudApp/build.gradle b/opencloudApp/build.gradle index ab17823c05..edba764edb 100644 --- a/opencloudApp/build.gradle +++ b/opencloudApp/build.gradle @@ -74,6 +74,7 @@ dependencies { // Instrumented tests androidTestImplementation project(":opencloudTestUtil") + androidTestImplementation libs.junit4 androidTestImplementation libs.androidx.annotation androidTestImplementation libs.androidx.arch.core.testing androidTestImplementation libs.androidx.test.core diff --git a/opencloudApp/src/integrationTest/docker-compose.yaml b/opencloudApp/src/integrationTest/docker-compose.yaml index cb68758c08..854b710da1 100644 --- a/opencloudApp/src/integrationTest/docker-compose.yaml +++ b/opencloudApp/src/integrationTest/docker-compose.yaml @@ -10,7 +10,7 @@ services: hostname: android-emulator-cuda restart: unless-stopped environment: - - DISABLE_ANIMATION=false + - DISABLE_ANIMATION=true - DISABLE_HIDDEN_POLICY=true - SKIP_AUTH=false - MEMORY=16384 diff --git a/opencloudApp/src/integrationTest/java/eu/opencloud/android/IntegrationTest.kt b/opencloudApp/src/integrationTest/java/eu/opencloud/android/IntegrationTest.kt new file mode 100644 index 0000000000..6259972a35 --- /dev/null +++ b/opencloudApp/src/integrationTest/java/eu/opencloud/android/IntegrationTest.kt @@ -0,0 +1,15 @@ +package eu.opencloud.android + +/** + * Marks an end-to-end integration test (src/integrationTest) that drives the real UI against a + * running OpenCloud server on the emulator, as opposed to the isolated instrumented tests. + * + * Run only these tests with: + * ./gradlew :opencloudApp:connectedOriginalDebugAndroidTest \ + * -Pandroid.testInstrumentationRunnerArguments.annotation=eu.opencloud.android.IntegrationTest + * + * Retention must be RUNTIME so the AndroidJUnitRunner can read it for filtering. + */ +@Retention(AnnotationRetention.RUNTIME) +@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) +annotation class IntegrationTest diff --git a/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginTest.kt b/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginTest.kt index 173ba91ff7..9abe60fdb7 100644 --- a/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginTest.kt +++ b/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginTest.kt @@ -13,6 +13,7 @@ import screens.MainScreen import screens.ManageAccountsDialog import screens.StartScreen +@IntegrationTest class LoginTest : TestCase( kaspressoBuilder = Kaspresso.Builder.advanced { flakySafetyParams = FlakySafetyParams.custom( diff --git a/opencloudComLibrary/build.gradle b/opencloudComLibrary/build.gradle index 5eedb84913..6a2605d651 100644 --- a/opencloudComLibrary/build.gradle +++ b/opencloudComLibrary/build.gradle @@ -6,7 +6,12 @@ apply plugin: 'kotlin-parcelize' dependencies { api 'com.squareup.okhttp3:okhttp:4.9.2' implementation libs.kotlin.stdlib - api 'com.github.opencloud-eu:android-dav:oc_support_2.1.6' + api('com.github.opencloud-eu:android-dav:oc_support_2.1.6') { + // xpp3:1.1.6 drags in a stray junit:junit:4.7 at runtime scope, which leaks + // into the production classpath and pins the androidTest classpath to + // "strictly 4.7" via AGP consistent resolution, breaking androidx.test (junit 4.13.2). + exclude group: 'junit', module: 'junit' + } // Androidx implementation libs.androidx.core.ktx