Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/src/androidTest/java/com/nextcloud/test/Flaky.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.nextcloud.test

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)
annotation class Flaky(val reason: String)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.rule.GrantPermissionRule
import com.nextcloud.test.Flaky
import com.nextcloud.test.GrantTestPermissionRule
import com.owncloud.android.AbstractIT
import com.owncloud.android.R
Expand All @@ -31,6 +32,7 @@ class SetStatusMessageBottomSheetIT : AbstractIT() {
val permissionRule: GrantPermissionRule = GrantTestPermissionRule.grantStorageAndNotification()

@Test
@Flaky(reason = "Bottom sheet is occasionally not rendered before the assertions run")
fun open() {
launchActivity<FileDisplayActivity>().use { scenario ->
onView(isRoot()).check(matches(isDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.test.rule.GrantPermissionRule
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.account.UserAccountManagerImpl
import com.nextcloud.test.Flaky
import com.nextcloud.test.GrantTestPermissionRule
import com.nextcloud.test.RetryTestRule
import com.owncloud.android.AbstractIT
Expand All @@ -42,6 +43,7 @@ class DrawerActivityIT : AbstractIT() {
val permissionRule: GrantPermissionRule = GrantTestPermissionRule.grantStorageAndNotification()

@Test
@Flaky(reason = "Account switch relaunches FileDisplayActivity, which races with the drawer assertions")
fun switchAccountViaAccountList() {
// Switching accounts finishes and relaunches FileDisplayActivity (see
// FileDisplayActivity.handleRestartIntent). That self-relaunch is incompatible with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.facebook.testing.screenshot.internal.TestNameDetector
import com.nextcloud.client.preferences.AppPreferencesImpl
import com.nextcloud.test.Flaky
import com.nextcloud.test.GrantStoragePermissionRule
import com.nextcloud.test.withSelectedText
import com.nextcloud.utils.extensions.removeFileExtension
Expand Down Expand Up @@ -104,6 +105,7 @@ class ReceiveExternalFilesActivityIT : AbstractIT() {
}

@Test
@Flaky(reason = "Rename dialog text selection is not settled when the assertions run")
fun renameSingleFileUpload() {
val imageFile = getDummyFile("image.jpg")
val intent = createSendIntent(imageFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.google.android.apps.common.testing.accessibility.framework.Accessibil
import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckResultUtils.matchesViews
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.nextcloud.android.lib.resources.files.FileDownloadLimit
import com.nextcloud.test.Flaky
import com.nextcloud.test.RetryTestRule
import com.nextcloud.test.TestActivity
import com.owncloud.android.AbstractIT
Expand Down Expand Up @@ -636,6 +637,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
// for send new email
@Test
@Suppress("MagicNumber")
@Flaky("not stable")
fun userOptionMenuFileSendNewEmail() {
launchActivity<TestActivity>().use { scenario ->
lateinit var sut: FileDetailSharingFragment
Expand All @@ -662,6 +664,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
// for advanced permissions
@Test
@Suppress("MagicNumber")
@Flaky("not stable")
fun userOptionMenuFolderAdvancePermission() {
launchActivity<TestActivity>().use { scenario ->
lateinit var sut: FileDetailSharingFragment
Expand Down Expand Up @@ -757,6 +760,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
// for send new email
@Test
@Suppress("MagicNumber")
@Flaky(reason = "Share option menu occasionally does not open before the assertions run")
fun userOptionMenuFolderSendNewEmail() {
launchActivity<TestActivity>().use { scenario ->
lateinit var sut: FileDetailSharingFragment
Expand Down
6 changes: 5 additions & 1 deletion scripts/runCombinedTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ scripts/wait_for_emulator.sh || exit 1
adb logcat -c
adb logcat > logcat.txt &
LOGCAT_PID=$!
# Screenshot tests only run when updating/testing screenshots, tests annotated with
# com.nextcloud.test.Flaky are known to be unstable and must not block a pull request.
EXCLUDED_ANNOTATIONS="com.owncloud.android.utils.ScreenshotTest,com.nextcloud.test.Flaky"

./gradlew createGplayDebugCoverageReport \
-Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest \
-Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation="$EXCLUDED_ANNOTATIONS" \
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"

stat=$?
Expand Down
Loading