From fc18ea5bb614d632a8edaecddd107c393a7f8f94 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Mon, 29 Jun 2026 11:56:51 +0200 Subject: [PATCH] Try a different workaround for flaky `ScanQrCodeViewTest` (#7109) Changing the SDK version using `@Config` to one supported by `ShadowNativeHardwareRenderer` (it has a `maxSdk` of `UPSIDE_DOWN_CAKE`) seems like fixed the issue. --- .../linknewdevice/impl/screens/scan/ScanQrCodeViewTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/linknewdevice/impl/src/test/kotlin/io/element/android/features/linknewdevice/impl/screens/scan/ScanQrCodeViewTest.kt b/features/linknewdevice/impl/src/test/kotlin/io/element/android/features/linknewdevice/impl/screens/scan/ScanQrCodeViewTest.kt index 5daf78660a..a8bc2b27a9 100644 --- a/features/linknewdevice/impl/src/test/kotlin/io/element/android/features/linknewdevice/impl/screens/scan/ScanQrCodeViewTest.kt +++ b/features/linknewdevice/impl/src/test/kotlin/io/element/android/features/linknewdevice/impl/screens/scan/ScanQrCodeViewTest.kt @@ -9,6 +9,7 @@ package io.element.android.features.linknewdevice.impl.screens.scan +import android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE import androidx.activity.ComponentActivity import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.platform.LocalInspectionMode @@ -25,9 +26,11 @@ import io.element.android.tests.testutils.ensureCalledOnce import io.element.android.tests.testutils.pressBackKey import io.element.android.tests.testutils.robolectric.RobolectricTest import org.junit.Test +import org.robolectric.annotation.Config class ScanQrCodeViewTest : RobolectricTest() { @Test + @Config(sdk = [UPSIDE_DOWN_CAKE]) fun `on back pressed - calls the expected callback`() = runAndroidComposeUiTest { val eventRecorder = EventsRecorder(expectEvents = false) ensureCalledOnce { callback -> @@ -42,6 +45,7 @@ class ScanQrCodeViewTest : RobolectricTest() { } @Test + @Config(sdk = [UPSIDE_DOWN_CAKE]) fun `try again button clicked - emits the expected event`() = runAndroidComposeUiTest { val eventRecorder = EventsRecorder() setView(