From b2fcc8dc7b8aa29eb17cb04ef96da9f9f934c9a2 Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Thu, 23 Apr 2026 14:39:41 +0545 Subject: [PATCH] import certificate for test --- opencloudApp/src/integrationTest/install-cert.sh | 7 +++++++ .../java/eu/opencloud/android/LoginScreenTest.kt | 13 +++---------- .../java/screens/TrustCertificate.kt | 12 ------------ 3 files changed, 10 insertions(+), 22 deletions(-) create mode 100755 opencloudApp/src/integrationTest/install-cert.sh delete mode 100644 opencloudApp/src/integrationTest/java/screens/TrustCertificate.kt diff --git a/opencloudApp/src/integrationTest/install-cert.sh b/opencloudApp/src/integrationTest/install-cert.sh new file mode 100755 index 000000000..f6659546c --- /dev/null +++ b/opencloudApp/src/integrationTest/install-cert.sh @@ -0,0 +1,7 @@ +#!/bin/bash +TMP_FOLDER=$(mktemp -d) +if [[ -z "$OPENCLOUD_PATH" ]]; then + OPENCLOUD_PATH="$HOME/.opencloud/" +fi +openssl x509 -in "$OPENCLOUD_PATH"/proxy/server.crt -out "$TMP_FOLDER"/opencloud-cert.pem -outform PEM +adb-install-cert --cert "$TMP_FOLDER"/opencloud-cert.pem \ No newline at end of file diff --git a/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginScreenTest.kt b/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginScreenTest.kt index 17601fb47..82b35603a 100644 --- a/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginScreenTest.kt +++ b/opencloudApp/src/integrationTest/java/eu/opencloud/android/LoginScreenTest.kt @@ -12,7 +12,6 @@ import screens.LoginScreen import screens.MainScreen import screens.ManageAccountsDialog import screens.StartScreen -import screens.TrustCertificate class LoginScreenTest : TestCase( kaspressoBuilder = Kaspresso.Builder.advanced { @@ -35,11 +34,13 @@ class LoginScreenTest : TestCase( fun loginApp() { before { adbServer.performCmd("adb", listOf("reverse", "tcp:9200", "tcp:9200")) + }.after { adbServer.performCmd("adb", listOf("shell", "am", "force-stop", "com.android.chrome")) adbServer.performCmd("adb", listOf("reverse", "--remove", "tcp:9200")) }.run { step("set opencloud url") { + StartScreen { hostUrlInput { isVisible() @@ -52,15 +53,7 @@ class LoginScreenTest : TestCase( } } } - step("trust certificate") { - TrustCertificate { - yesBtn { - isVisible() - isClickable() - click() - } - } - } + step("login") { LoginScreen { username.isDisplayed() diff --git a/opencloudApp/src/integrationTest/java/screens/TrustCertificate.kt b/opencloudApp/src/integrationTest/java/screens/TrustCertificate.kt deleted file mode 100644 index 0c53cb7b5..000000000 --- a/opencloudApp/src/integrationTest/java/screens/TrustCertificate.kt +++ /dev/null @@ -1,12 +0,0 @@ -package screens - -import com.kaspersky.kaspresso.screens.KScreen -import eu.opencloud.android.R -import io.github.kakaocup.kakao.text.KButton - -object TrustCertificate: KScreen() { - override val layoutId: Int? = R.layout.ssl_untrusted_cert_layout - override val viewClass: Class<*>? = null - - val yesBtn = KButton { withId(R.id.ok) } -}