From 35b7fa71111896dfa8047015905b54dd7a9eb7bc Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Thu, 3 Dec 2026 15:16:43 +0100 Subject: [PATCH 1/5] Emulator end-to-end tests on GitHub-hosted runners The development machine has no KVM, so instrumented tests run in a repository workflow on GitHub-hosted runners (which have KVM): Nextcloud 33 and the self-signed HTTPS proxy from scripts/test-server.sh, an API 35 emulator (cached snapshot) reaching them at 10.0.2.2, Test Orchestrator with cleared app data per test. First tests (SignInTest): nc://login link with confirmation, self-signed certificate trust, a second account and removing the first. The Login Flow v2 browser hand-off and SSO stay on the manual test plan. scripts/test-server.sh: TLS_HOST for the proxy's certificate address. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z Signed-off-by: Tobias Kaminsky --- .github/workflows/emulator.yml | 98 ++++++++++++++++ AGENTS.md | 6 + app/build.gradle.kts | 16 +++ .../com/nextcloud/photos/e2e/SignInTest.kt | 109 ++++++++++++++++++ .../com/nextcloud/photos/e2e/TestServer.kt | 56 +++++++++ gradle/libs.versions.toml | 6 + gradle/verification-metadata.xml | 86 +++++++++----- scripts/test-server.sh | 6 +- 8 files changed, 354 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/emulator.yml create mode 100644 app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt create mode 100644 app/src/androidTest/kotlin/com/nextcloud/photos/e2e/TestServer.kt diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml new file mode 100644 index 0000000..669aa96 --- /dev/null +++ b/.github/workflows/emulator.yml @@ -0,0 +1,98 @@ +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# Repository workflow (not synced from android-config): end-to-end tests on an Android emulator against a throw-away +# Nextcloud (scripts/test-server.sh). GitHub-hosted runners have KVM; the emulator reaches the host at 10.0.2.2. +name: Emulator tests + +on: + pull_request: + branches: [main] + schedule: + - cron: '17 3 * * *' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: emulator-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + emulator: + runs-on: ubuntu-latest + timeout-minutes: 75 + env: + API_LEVEL: 35 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up JDK 21 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 + + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Start test server (Nextcloud 33, self-signed HTTPS proxy) + env: + TLS_HOST: 10.0.2.2 + run: scripts/test-server.sh start + + - name: Build app and tests + run: ./gradlew --console=plain assembleQaDebug assembleQaDebugAndroidTest + + - name: AVD cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ env.API_LEVEL }}-google_apis-x86_64 + + - name: Create AVD snapshot + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: ReactiveCircus/android-emulator-runner@c9c93e6ba9c4194322e114c40970d5983d9a07cc # v2.38.0 + with: + api-level: ${{ env.API_LEVEL }} + target: google_apis + arch: x86_64 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: echo "AVD snapshot created" + + - name: Run end-to-end tests + uses: ReactiveCircus/android-emulator-runner@c9c93e6ba9c4194322e114c40970d5983d9a07cc # v2.38.0 + with: + api-level: ${{ env.API_LEVEL }} + target: google_apis + arch: x86_64 + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: >- + ./gradlew --console=plain connectedQaDebugAndroidTest + -Pandroid.testInstrumentationRunnerArguments.testServer=http://10.0.2.2:8089 + -Pandroid.testInstrumentationRunnerArguments.testServerTls=https://10.0.2.2:8443 + + - name: Upload test reports + if: failure() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: emulator-test-reports + path: | + app/build/reports/androidTests/ + app/build/outputs/androidTest-results/ diff --git a/AGENTS.md b/AGENTS.md index dc968ea..a195373 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -61,6 +61,12 @@ photos.localAndroidCommon=../android-common `./gradlew :core:network:testDebugUnitTest -Pphotos.testServer=http://127.0.0.1:8089 -Pphotos.testServerTls=https://127.0.0.1:8443` runs `ServerIntegrationTest` and `CertificateTrustIntegrationTest` (skipped without the properties). +**Emulator tests:** `app/src/androidTest` holds end-to-end tests that run on an Android emulator against the same +Docker server, in `.github/workflows/emulator.yml` (GitHub-hosted runner with KVM; the emulator reaches the host at +`10.0.2.2`). Local development machines without KVM rely on that workflow. Locally with a device or emulator: +`TLS_HOST=10.0.2.2 scripts/test-server.sh` and +`./gradlew connectedQaDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.testServer=http://10.0.2.2:8089 -Pandroid.testInstrumentationRunnerArguments.testServerTls=https://10.0.2.2:8443`. + **Dependency verification** is on (`gradle/verification-metadata.xml`). After adding or updating a dependency, run `./gradlew --write-verification-metadata sha256,pgp --export-keys ` and commit the changed metadata and keyring. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index de2a977..32b1736 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,6 +20,12 @@ android { applicationId = "com.nextcloud.android.photos" versionCode = 1 versionName = "0.1.0" + // Every instrumented test starts with a fresh app (no accounts), see androidTest/README + testInstrumentationRunnerArguments["clearPackageData"] = "true" + } + + testOptions { + execution = "ANDROIDX_TEST_ORCHESTRATOR" } flavorDimensions += "version" @@ -68,4 +74,14 @@ dependencies { implementation(libs.kotlinx.serialization.json) testImplementation(projects.core.testing) + + // End-to-end tests on an emulator against scripts/test-server.sh (.github/workflows/emulator.yml) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.androidx.test.rules) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.okhttp) + androidTestUtil(libs.androidx.test.orchestrator) + androidTestUtil(libs.androidx.test.services) } diff --git a/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt new file mode 100644 index 0000000..b9266a5 --- /dev/null +++ b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt @@ -0,0 +1,109 @@ +/* + * Nextcloud Photos - Android Client + * + * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +package com.nextcloud.photos.e2e + +import android.content.Intent +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.SemanticsMatcher +import androidx.compose.ui.test.hasAnyAncestor +import androidx.compose.ui.test.hasContentDescription +import androidx.compose.ui.test.hasText +import androidx.compose.ui.test.isDialog +import androidx.compose.ui.test.junit4.createEmptyComposeRule +import androidx.compose.ui.test.onAllNodesWithText +import androidx.compose.ui.test.performClick +import androidx.test.core.app.ActivityScenario +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.nextcloud.photos.MainActivity +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Sign-in end to end on an emulator against a real Nextcloud (SPEC §5.1, §14): login links with confirmation, + * self-signed certificates, several accounts. The Login Flow v2 browser hand-off and SSO need a real browser or Files + * app and stay on the manual test plan. + */ +@OptIn(ExperimentalTestApi::class) +@RunWith(AndroidJUnit4::class) +class SignInTest { + @get:Rule + val compose = createEmptyComposeRule() + + private fun open(link: android.net.Uri): ActivityScenario = ActivityScenario.launch( + Intent( + Intent.ACTION_VIEW, + link, + ).setClass(ApplicationProvider.getApplicationContext(), MainActivity::class.java), + ) + + private fun inDialog(text: String): SemanticsMatcher = hasText(text) and hasAnyAncestor(isDialog()) + + private fun confirmLogin() { + compose.waitUntilAtLeastOneExists(hasText("Log in?"), TIMEOUT) + compose.onNode(inDialog("Log in")).performClick() + } + + private fun waitForAccount(server: String) = + compose.waitUntilAtLeastOneExists(hasText(TestServer.label(server), substring = true), TIMEOUT) + + @Test + fun loginLinkAsksFirstThenSignsIn() { + val server = TestServer.url + open(TestServer.loginLink(server)).use { + confirmLogin() + waitForAccount(server) + } + } + + @Test + fun selfSignedServerAsksToTrustTheCertificate() { + val server = TestServer.tlsUrl + open(TestServer.loginLink(server)).use { + confirmLogin() + compose.waitUntilAtLeastOneExists(hasText("Trust this certificate?"), TIMEOUT) + compose.waitUntilAtLeastOneExists(hasText("SHA-256", substring = true), TIMEOUT) + compose.onNode(inDialog("Trust")).performClick() + waitForAccount(server) + } + } + + @Test + fun secondAccountThenRemoveTheFirst() { + val first = TestServer.url + val second = TestServer.tlsUrl + open(TestServer.loginLink(first)).use { scenario -> + confirmLogin() + waitForAccount(first) + // A second link while the app runs adds a second account (onNewIntent). + scenario.onActivity { + it.startActivity( + Intent(Intent.ACTION_VIEW, TestServer.loginLink(second)).setClass(it, MainActivity::class.java), + ) + } + confirmLogin() + compose.waitUntilAtLeastOneExists(hasText("Trust this certificate?"), TIMEOUT) + compose.onNode(inDialog("Trust")).performClick() + waitForAccount(second) + + compose.onNode(hasContentDescription("Settings")).performClick() + compose.waitUntilAtLeastOneExists(hasText("2 accounts"), TIMEOUT) + compose.onNode(hasText("2 accounts")).performClick() + compose.waitUntilAtLeastOneExists(hasText(TestServer.label(first), substring = true), TIMEOUT) + // Accounts are listed oldest first: remove the first one. + compose.onAllNodesWithText("Remove")[0].performClick() + compose.onNode(inDialog("Remove")).performClick() + compose.waitUntilDoesNotExist(hasText(TestServer.label(first), substring = true), TIMEOUT) + compose.waitUntilAtLeastOneExists(hasText(TestServer.label(second), substring = true), TIMEOUT) + } + } + + private companion object { + const val TIMEOUT = 30_000L + } +} diff --git a/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/TestServer.kt b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/TestServer.kt new file mode 100644 index 0000000..d7bf0e0 --- /dev/null +++ b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/TestServer.kt @@ -0,0 +1,56 @@ +/* + * Nextcloud Photos - Android Client + * + * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +package com.nextcloud.photos.e2e + +import android.net.Uri +import androidx.test.platform.app.InstrumentationRegistry +import okhttp3.Credentials +import okhttp3.OkHttpClient +import okhttp3.Request +import org.json.JSONObject +import org.junit.Assume.assumeTrue + +/** + * The Nextcloud of scripts/test-server.sh, as the emulator sees it (10.0.2.2 is the host). Given as instrumentation + * arguments testServer and testServerTls; tests are skipped without them. + */ +object TestServer { + private val arguments get() = InstrumentationRegistry.getArguments() + + val url: String get() = arguments.getString("testServer").orEmpty().also { + assumeTrue("No testServer", it.isNotEmpty()) + } + + val tlsUrl: String get() = arguments.getString("testServerTls").orEmpty().also { + assumeTrue("No testServerTls", it.isNotEmpty()) + } + + const val USER = "admin" + private const val PASSWORD = "admin" + + /** A new app password for [USER], as the QR code in the web settings would carry. */ + fun createAppPassword(): String { + val request = Request.Builder() + .url("$url/ocs/v2.php/core/getapppassword?format=json") + .header("Authorization", Credentials.basic(USER, PASSWORD)) + .header("OCS-APIRequest", "true") + .build() + OkHttpClient().newCall(request).execute().use { response -> + check(response.isSuccessful) { "getapppassword: HTTP ${response.code}" } + return JSONObject( + response.body.string(), + ).getJSONObject("ocs").getJSONObject("data").getString("apppassword") + } + } + + /** nc://login link with the app password (SPEC §5.1), the same content as the web's QR code. */ + fun loginLink(server: String, password: String = createAppPassword()): Uri = + Uri.parse("nc://login/server:$server&user:$USER&password:$password") + + /** "admin@10.0.2.2:8089", as the app labels the account. */ + fun label(server: String) = "$USER@" + server.substringAfter("://") +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab54aa0..0b7e0f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,6 +53,8 @@ zxing = "3.5.4" # Tests androidxTest = "1.7.0" androidxTestJunit = "1.3.0" +androidxTestOrchestrator = "1.6.1" +androidxTestServices = "1.6.0" junit = "4.13.2" mockk = "1.14.12" robolectric = "4.18.1" @@ -123,6 +125,10 @@ aboutlibraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", # Tests androidx-test-core = { module = "androidx.test:core", version.ref = "androidxTest" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidxTest" } +androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidxTest" } +androidx-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "androidxTestOrchestrator" } +androidx-test-services = { module = "androidx.test.services:test-services", version.ref = "androidxTestServices" } androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidxTestJunit" } junit = { module = "junit:junit", version.ref = "junit" } mockk = { module = "io.mockk:mockk", version.ref = "mockk" } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 5c9324c..5f64e7e 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -427,12 +427,12 @@ - - - + + + @@ -454,12 +454,12 @@ - - - + + + @@ -1031,12 +1031,12 @@ - - - + + + @@ -1063,12 +1063,12 @@ - - - + + + @@ -1132,12 +1132,12 @@ - - - + + + @@ -1181,12 +1181,12 @@ - - - + + + @@ -1226,12 +1226,12 @@ - - - + + + @@ -1245,12 +1245,12 @@ - - - + + + @@ -1313,6 +1313,14 @@ + + + + + + + + @@ -1321,6 +1329,22 @@ + + + + + + + + + + + + + + + + @@ -1329,6 +1353,14 @@ + + + + + + + + @@ -1455,12 +1487,12 @@ - - - + + + diff --git a/scripts/test-server.sh b/scripts/test-server.sh index af886cd..ab7ea21 100755 --- a/scripts/test-server.sh +++ b/scripts/test-server.sh @@ -9,7 +9,8 @@ # # Also starts an HTTPS proxy with a self-signed certificate (Caddy) on port 8443, for the certificate trust tests. # -# Environment: NEXTCLOUD_IMAGE (default nextcloud:33-apache). +# Environment: NEXTCLOUD_IMAGE (default nextcloud:33-apache), TLS_HOST (address the HTTPS proxy's certificate is for, +# default 127.0.0.1; 10.0.2.2 for the Android emulator, which reaches the host there). # Then run: ./gradlew :core:network:testDebugUnitTest -Pphotos.testServer=http://127.0.0.1: set -eu @@ -20,6 +21,7 @@ NAME=photos-android-test-server PROXY=photos-android-test-proxy NETWORK=photos-android-test TLS_PORT=${TLS_PORT:-8443} +TLS_HOST=${TLS_HOST:-127.0.0.1} if [ "$ACTION" = "stop" ]; then docker rm -f "$NAME" "$PROXY" >/dev/null 2>&1 || true @@ -63,7 +65,7 @@ if ! docker ps --format '{{.Names}}' | grep -qx "$PROXY"; then docker rm -f "$PROXY" >/dev/null 2>&1 || true # tls internal: a certificate from Caddy's own CA, which Android does not trust docker run -d --name "$PROXY" --network "$NETWORK" -p "127.0.0.1:$TLS_PORT:$TLS_PORT" caddy:2 sh -c " - printf '{\\n default_sni 127.0.0.1\\n}\\nhttps://127.0.0.1:$TLS_PORT, https://localhost:$TLS_PORT {\\n bind 0.0.0.0\\n tls internal\\n reverse_proxy $NAME:80\\n}\\n' > /etc/caddy/Caddyfile && + printf '{\\n default_sni $TLS_HOST\\n}\\nhttps://$TLS_HOST:$TLS_PORT, https://127.0.0.1:$TLS_PORT, https://localhost:$TLS_PORT {\\n bind 0.0.0.0\\n tls internal\\n reverse_proxy $NAME:80\\n}\\n' > /etc/caddy/Caddyfile && caddy run --config /etc/caddy/Caddyfile --adapter caddyfile" >/dev/null fi TRIES=0 From 3c21ed2517c6b50e6d6fac21220a4a4de56c12b4 Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Thu, 3 Dec 2026 15:28:03 +0100 Subject: [PATCH 2/5] Verify the Test Orchestrator and test services APKs They are resolved only when tests run on a device, so a local strict run did not see them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z Signed-off-by: Tobias Kaminsky --- gradle/verification-metadata.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 5f64e7e..5939f03 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1313,6 +1313,14 @@ + + + + + + + + @@ -1393,6 +1401,14 @@ + + + + + + + + From 425685678d9b2554e59c2c0c249f637c4e818ebf Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Thu, 3 Dec 2026 15:33:36 +0100 Subject: [PATCH 3/5] Emulator tests: ask for ubuntu-24.04 and fail clearly without KVM In the Nextcloud organisation ubuntu-latest is mostly served by self-hosted runners without KVM. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z Signed-off-by: Tobias Kaminsky --- .github/workflows/emulator.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index 669aa96..595358b 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -21,7 +21,8 @@ concurrency: jobs: emulator: - runs-on: ubuntu-latest + # Not ubuntu-latest: in the Nextcloud organisation that label is mostly served by self-hosted runners without KVM. + runs-on: ubuntu-24.04 timeout-minutes: 75 env: API_LEVEL: 35 @@ -41,6 +42,10 @@ jobs: - name: Enable KVM run: | + if [ ! -e /dev/kvm ]; then + echo "::error::This runner ($RUNNER_NAME) has no /dev/kvm; the emulator needs a GitHub-hosted runner." + exit 1 + fi echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm From da9839999953809d8f72a966799b2762c251f52c Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Thu, 3 Dec 2026 15:53:06 +0100 Subject: [PATCH 4/5] Emulator tests: resolve from Google's Maven Central mirror Maven Central rate-limits GitHub-hosted runners (HTTP 429); the mirror serves the same files. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z Signed-off-by: Tobias Kaminsky --- .github/workflows/emulator.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index 595358b..8bb3f60 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -40,6 +40,21 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 + - name: Use Google's Maven Central mirror + # Maven Central rate-limits GitHub-hosted runners (HTTP 429). The mirror serves the same files, so dependency + # verification still applies. + run: | + mkdir -p ~/.gradle/init.d + cat > ~/.gradle/init.d/maven-central-mirror.init.gradle.kts <<'KTS' + val mirror = "https://maven-central.storage-download.googleapis.com/maven2/" + beforeSettings { + // Builds without own plugin repositories (build-logic) would otherwise lose the plugin portal. + pluginManagement.repositories.maven(mirror) + pluginManagement.repositories.gradlePluginPortal() + dependencyResolutionManagement.repositories.maven(mirror) + } + KTS + - name: Enable KVM run: | if [ ! -e /dev/kvm ]; then From 6d1719a3485b5409df3c4f4a833e2bfaab954e7b Mon Sep 17 00:00:00 2001 From: Tobias Kaminsky Date: Thu, 3 Dec 2026 16:19:40 +0100 Subject: [PATCH 5/5] SignInTest: create the second app password off the main thread Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Nb4eMg7ShMcjycNqaRBq3z Signed-off-by: Tobias Kaminsky --- .../kotlin/com/nextcloud/photos/e2e/SignInTest.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt index b9266a5..0f9cc46 100644 --- a/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt +++ b/app/src/androidTest/kotlin/com/nextcloud/photos/e2e/SignInTest.kt @@ -80,11 +80,11 @@ class SignInTest { open(TestServer.loginLink(first)).use { scenario -> confirmLogin() waitForAccount(first) - // A second link while the app runs adds a second account (onNewIntent). + // A second link while the app runs adds a second account (onNewIntent). The app password is created here, + // off the main thread that onActivity runs on. + val secondLink = TestServer.loginLink(second) scenario.onActivity { - it.startActivity( - Intent(Intent.ACTION_VIEW, TestServer.loginLink(second)).setClass(it, MainActivity::class.java), - ) + it.startActivity(Intent(Intent.ACTION_VIEW, secondLink).setClass(it, MainActivity::class.java)) } confirmLogin() compose.waitUntilAtLeastOneExists(hasText("Trust this certificate?"), TIMEOUT)