diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a659e78e0037..8bfabe7c7535 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -53,6 +53,12 @@ configurations.configureEach { useVersion(libs.versions.jacoco.get()) } else if (requested.group == "commons-logging" && requested.name == "commons-logging") { useTarget(libs.slfj) + } else if (requested.group == "org.hamcrest") { + useVersion("2.2") + because( + "Align hamcrest on compile and runtime. 1.3 (via junit) exposes fixed-arity " + + "anyOf/allOf overloads that 2.2 (via androidx.test) removed, causing NoSuchMethodError." + ) } } } diff --git a/app/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.kt b/app/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.kt index d727d1acd9aa..ca13d25070e1 100644 --- a/app/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.kt +++ b/app/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.kt @@ -33,8 +33,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() { @get:Rule val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS + Manifest.permission.WRITE_EXTERNAL_STORAGE ) companion object { diff --git a/app/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.kt b/app/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.kt index 9b9d283af3f6..47b2f227648c 100644 --- a/app/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.kt +++ b/app/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.kt @@ -9,7 +9,6 @@ package com.nextcloud.client import android.content.Intent -import android.os.Looper import androidx.test.core.app.launchActivity import androidx.test.espresso.Espresso.onView import androidx.test.espresso.assertion.ViewAssertions.matches @@ -61,12 +60,8 @@ class SettingsActivityIT : AbstractIT() { } } - @Suppress("DEPRECATION") @Test fun showMnemonic() { - if (Looper.myLooper() == null) { - Looper.prepare() - } val intent = Intent().apply { putExtra(RequestCredentialsActivity.KEY_CHECK_RESULT, RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE) } @@ -76,13 +71,10 @@ class SettingsActivityIT : AbstractIT() { } launchActivity().use { scenario -> - onView(isRoot()).check(matches(isDisplayed())) - scenario.onActivity { sut -> sut.handleMnemonicRequest(intent) } - Looper.myLooper()?.quitSafely() Assert.assertTrue(true) } } diff --git a/app/src/androidTest/java/com/nextcloud/client/assistant/AssistantRepositoryTests.kt b/app/src/androidTest/java/com/nextcloud/client/assistant/AssistantRepositoryTests.kt index d2d333f4797f..693724df360f 100644 --- a/app/src/androidTest/java/com/nextcloud/client/assistant/AssistantRepositoryTests.kt +++ b/app/src/androidTest/java/com/nextcloud/client/assistant/AssistantRepositoryTests.kt @@ -87,17 +87,13 @@ class AssistantRepositoryTests : AbstractOnServerIT() { testCreateTask() - sleep(120) - runBlocking { val taskList = sut?.getTaskList("assistant") assertTrue(taskList != null) - sleep(120) - - assert((taskList?.size ?: 0) > 0) + val taskId = taskList?.firstOrNull()?.id ?: return@runBlocking - val result = sut?.deleteTask(taskList!!.first().id) + val result = sut?.deleteTask(taskId) assertTrue(result?.isSuccess == true) } } diff --git a/app/src/androidTest/java/com/nextcloud/ui/SetOnlineStatusBottomSheetIT.kt b/app/src/androidTest/java/com/nextcloud/ui/SetOnlineStatusBottomSheetIT.kt index c9e07da94cfd..583697e196f3 100644 --- a/app/src/androidTest/java/com/nextcloud/ui/SetOnlineStatusBottomSheetIT.kt +++ b/app/src/androidTest/java/com/nextcloud/ui/SetOnlineStatusBottomSheetIT.kt @@ -27,10 +27,7 @@ import org.junit.Test class SetOnlineStatusBottomSheetIT : AbstractIT() { @get:Rule - val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS - ) + val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE) @Test fun open() { diff --git a/app/src/androidTest/java/com/nextcloud/ui/SetStatusMessageBottomSheetIT.kt b/app/src/androidTest/java/com/nextcloud/ui/SetStatusMessageBottomSheetIT.kt index b9e9feec6e2e..a9b98bedb941 100644 --- a/app/src/androidTest/java/com/nextcloud/ui/SetStatusMessageBottomSheetIT.kt +++ b/app/src/androidTest/java/com/nextcloud/ui/SetStatusMessageBottomSheetIT.kt @@ -28,10 +28,7 @@ import org.junit.Test class SetStatusMessageBottomSheetIT : AbstractIT() { @get:Rule - val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS - ) + val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE) @Test fun open() { diff --git a/app/src/androidTest/java/com/owncloud/android/ScreenshotsIT.kt b/app/src/androidTest/java/com/owncloud/android/ScreenshotsIT.kt index 100395a13fa9..9bec54c4cdfa 100644 --- a/app/src/androidTest/java/com/owncloud/android/ScreenshotsIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ScreenshotsIT.kt @@ -37,8 +37,7 @@ class ScreenshotsIT : AbstractIT() { @get:Rule val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS + Manifest.permission.WRITE_EXTERNAL_STORAGE ) @Test diff --git a/app/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.kt index 93caa0dba447..3ea25ab244d6 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.kt @@ -40,8 +40,7 @@ class DrawerActivityIT : AbstractIT() { @get:Rule val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS + Manifest.permission.WRITE_EXTERNAL_STORAGE ) @Test diff --git a/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.kt index 5c4707f99e06..cbb1a3e649fd 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.kt @@ -85,8 +85,7 @@ class DialogFragmentIT : AbstractIT() { @get:Rule val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.POST_NOTIFICATIONS + Manifest.permission.WRITE_EXTERNAL_STORAGE ) @After diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7d32971ffe02..ffd5d3e157fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ androidCommonLibraryVersion = "0.33.2" androidGifDrawableVersion = "1.2.32" androidImageCropperVersion = "4.7.0" -androidLibraryVersion ="0282f675c8f11af9f1da91436f1fa95abe2333fe" +androidLibraryVersion ="e4126f66ffdead52f94a2edd6855b11a8a94f812" androidOpensslVersion = "3.5.6" androidPluginVersion = "9.2.1" androidsvgVersion = "1.4" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index dd487e24e7a4..dbd2438eb804 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -125,9 +125,7 @@ - - - + @@ -362,12 +360,12 @@ + - @@ -20079,16 +20077,16 @@ - - - - - + + + + + @@ -22028,6 +22026,14 @@ + + + + + + + + diff --git a/scripts/wait_for_emulator.sh b/scripts/wait_for_emulator.sh index 3428059427b3..a42061a93f08 100755 --- a/scripts/wait_for_emulator.sh +++ b/scripts/wait_for_emulator.sh @@ -25,5 +25,17 @@ until [[ "$bootanim" =~ "stopped" ]]; do sleep 5 done echo "($checkcounter) Done" + +# Keep the screen awake and unlocked for the whole run. On a headless emulator the +# screen can sleep or keep the keyguard up, which leaves the app window without focus +# and makes Espresso fail with RootViewWithoutFocusException. +adb -e shell svc power stayon true +adb -e shell wm dismiss-keyguard adb -e shell input keyevent 82 + +# Disable animations so Espresso does not wait on "not request layout". +adb -e shell settings put global window_animation_scale 0.0 +adb -e shell settings put global transition_animation_scale 0.0 +adb -e shell settings put global animator_duration_scale 0.0 + echo "($checkcounter) Unlocked emulator screen"