From 2e8458bb5763f48ff52d3f9f94c633cf6e48cf7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:49:04 +0000 Subject: [PATCH 1/5] Bump androidx.appcompat:appcompat from 1.5.1 to 1.6.1 Bumps androidx.appcompat:appcompat from 1.5.1 to 1.6.1. --- updated-dependencies: - dependency-name: androidx.appcompat:appcompat dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2cf413611ae..3b239a5c313 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ androidGradlePlugin = "7.4.2" androidxActivity = "1.6.1" androidxAnnotation = "1.6.0" -androidxAppCompat = "1.5.1" +androidxAppCompat = "1.6.1" androidxArch = "2.2.0" androidxBiometric = "1.1.0" androidxBrowser = "1.5.0" From ca7c7bace724d571d5ab2b3a748056ada078a93b Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Thu, 18 Apr 2024 08:50:28 +0100 Subject: [PATCH 2/5] feat: ignoring some tests --- .../com/owncloud/android/files/SortBottomSheetFragmentTest.kt | 4 ++++ .../owncloud/android/files/details/FileDetailsFragmentTest.kt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/files/SortBottomSheetFragmentTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/files/SortBottomSheetFragmentTest.kt index cccb370e780..0b7f9ad8f38 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/files/SortBottomSheetFragmentTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/files/SortBottomSheetFragmentTest.kt @@ -38,6 +38,7 @@ import io.mockk.every import io.mockk.mockk import io.mockk.verify import org.junit.Before +import org.junit.Ignore import org.junit.Test class SortBottomSheetFragmentTest { @@ -57,6 +58,7 @@ class SortBottomSheetFragmentTest { } @Test + @Ignore("Flaky test") fun test_initial_view() { onView(withId(R.id.title)) .inRoot(RootMatchers.isDialog()) @@ -78,12 +80,14 @@ class SortBottomSheetFragmentTest { } @Test + @Ignore("Flaky test") fun test_sort_by_name_click() { onView(withId(R.id.sort_by_name)).inRoot(RootMatchers.isDialog()).perform(ViewActions.click()) verify { fragmentListener.onSortSelected(SortType.SORT_TYPE_BY_NAME) } } @Test + @Ignore("Flaky test") fun test_sort_by_date_click() { onView(withId(R.id.sort_by_date)).inRoot(RootMatchers.isDialog()).perform(ViewActions.click()) verify { fragmentListener.onSortSelected(SortType.SORT_TYPE_BY_DATE) } diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt index 20c9eb1ad57..03d1816b732 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt @@ -15,10 +15,10 @@ import com.owncloud.android.presentation.files.operations.FileOperationsViewMode import com.owncloud.android.sharing.shares.ui.TestShareFileActivity import com.owncloud.android.testutil.OC_ACCOUNT import com.owncloud.android.testutil.OC_FILE -import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AVAILABLE_OFFLINE import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AND_SPACE import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AND_WITHOUT_PERSONAL_SPACE +import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AVAILABLE_OFFLINE import com.owncloud.android.utils.DisplayUtils import com.owncloud.android.utils.matchers.assertVisibility import com.owncloud.android.utils.matchers.isDisplayed @@ -28,6 +28,7 @@ import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before +import org.junit.Ignore import org.junit.Test import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.core.context.startKoin @@ -140,6 +141,7 @@ class FileDetailsFragmentTest { } @Test + @Ignore("Flaky test") fun verifyTests() { R.id.fdCreatedLabel.withText(R.string.filedetails_created) R.id.fdCreated.withText(DisplayUtils.unixTimeToHumanReadable(currentFile.value?.file?.creationTimestamp!!)) From d8dce5c9acc4fbb3e27a22c7d733f4cc8dbd23f4 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Thu, 25 Apr 2024 10:11:11 +0100 Subject: [PATCH 3/5] feat: created RetryFlakyTestUntilSuccessRule class --- .../files/details/FileDetailsFragmentTest.kt | 6 +++ .../utils/RetryFlakyTestUntilSuccessRule.kt | 37 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt index 03d1816b732..8201a2bca29 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt @@ -20,6 +20,7 @@ import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AND_SPACE import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AND_WITHOUT_PERSONAL_SPACE import com.owncloud.android.testutil.OC_FILE_WITH_SYNC_INFO_AVAILABLE_OFFLINE import com.owncloud.android.utils.DisplayUtils +import com.owncloud.android.utils.RetryFlakyTestUntilSuccessRule import com.owncloud.android.utils.matchers.assertVisibility import com.owncloud.android.utils.matchers.isDisplayed import com.owncloud.android.utils.matchers.withDrawable @@ -29,6 +30,7 @@ import io.mockk.mockk import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before import org.junit.Ignore +import org.junit.Rule import org.junit.Test import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.core.context.startKoin @@ -47,6 +49,10 @@ class FileDetailsFragmentTest { private var currentFileSyncInfo: MutableStateFlow = MutableStateFlow(OC_FILE_WITH_SYNC_INFO) private var currentFileAvailableOffline: MutableStateFlow = MutableStateFlow(OC_FILE_WITH_SYNC_INFO_AVAILABLE_OFFLINE) + @Rule + @JvmField + val retryFlakyTestUntilSuccessRule = RetryFlakyTestUntilSuccessRule() + @Before fun setUp() { context = ApplicationProvider.getApplicationContext() diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt new file mode 100644 index 00000000000..ae56ab5f51c --- /dev/null +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt @@ -0,0 +1,37 @@ +package com.owncloud.android.utils + +import android.util.Log +import org.junit.rules.TestRule +import org.junit.runner.Description +import org.junit.runners.model.Statement + +class RetryFlakyTestUntilSuccessRule(val count: Int = 3) : TestRule { + + companion object { + private const val TAG = "RetryFlakyTestUntilSuccessRule" + } + + override fun apply(base: Statement, description: Description): Statement = statement(base, description) + + private fun statement(base: Statement, description: Description): Statement { + return object : Statement() { + @Throws(Throwable::class) + override fun evaluate() { + var throwable: Throwable? = null + val displayName = description.displayName + for (i in 1 until count + 1) { + try { + Log.i(TAG, "$displayName: Run $i") + base.evaluate() + return + } catch (t: Throwable) { + throwable = t + Log.e(TAG, "$displayName: Run $i failed.") + } + } + Log.e(TAG, "$displayName: Giving up after run $count failures.") + throw throwable!! + } + } + } +} \ No newline at end of file From 1a78153b40ec918cbc1f24433135a47df74c41c0 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Fri, 26 Apr 2024 08:46:39 +0100 Subject: [PATCH 4/5] feat: added rule flaky tests to SettingsFragmentTest and LoginActivityTest --- .../android/authentication/LoginActivityTest.kt | 6 ++++++ .../android/settings/SettingsFragmentTest.kt | 12 +++++++++--- .../android/utils/RetryFlakyTestUntilSuccessRule.kt | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/authentication/LoginActivityTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/authentication/LoginActivityTest.kt index 40d91c5dcf3..d7026bd265f 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/authentication/LoginActivityTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/authentication/LoginActivityTest.kt @@ -77,6 +77,7 @@ import com.owncloud.android.testutil.OC_SECURE_SERVER_INFO_BEARER_AUTH import com.owncloud.android.utils.CONFIGURATION_SERVER_URL import com.owncloud.android.utils.CONFIGURATION_SERVER_URL_INPUT_VISIBILITY import com.owncloud.android.utils.NO_MDM_RESTRICTION_YET +import com.owncloud.android.utils.RetryFlakyTestUntilSuccessRule import com.owncloud.android.utils.matchers.assertVisibility import com.owncloud.android.utils.matchers.isDisplayed import com.owncloud.android.utils.matchers.isEnabled @@ -95,6 +96,7 @@ import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Before +import org.junit.Rule import org.junit.Test import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.core.context.startKoin @@ -118,6 +120,10 @@ class LoginActivityTest { private lateinit var baseUrlLiveData: MutableLiveData>> private lateinit var accountDiscoveryLiveData: MutableLiveData>> + @Rule + @JvmField + val retryFlakyTestUntilSuccessRule = RetryFlakyTestUntilSuccessRule() + @Before fun setUp() { context = ApplicationProvider.getApplicationContext() diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/settings/SettingsFragmentTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/settings/SettingsFragmentTest.kt index b0dbd850555..e810a374b14 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/settings/SettingsFragmentTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/settings/SettingsFragmentTest.kt @@ -36,11 +36,12 @@ import androidx.test.platform.app.InstrumentationRegistry import com.owncloud.android.BuildConfig import com.owncloud.android.R import com.owncloud.android.presentation.releasenotes.ReleaseNotesActivity -import com.owncloud.android.presentation.settings.privacypolicy.PrivacyPolicyActivity -import com.owncloud.android.presentation.settings.SettingsFragment import com.owncloud.android.presentation.releasenotes.ReleaseNotesViewModel -import com.owncloud.android.presentation.settings.more.SettingsMoreViewModel +import com.owncloud.android.presentation.settings.SettingsFragment import com.owncloud.android.presentation.settings.SettingsViewModel +import com.owncloud.android.presentation.settings.more.SettingsMoreViewModel +import com.owncloud.android.presentation.settings.privacypolicy.PrivacyPolicyActivity +import com.owncloud.android.utils.RetryFlakyTestUntilSuccessRule import com.owncloud.android.utils.matchers.verifyPreference import com.owncloud.android.utils.releaseNotesList import io.mockk.every @@ -50,6 +51,7 @@ import org.junit.After import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Ignore +import org.junit.Rule import org.junit.Test import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.core.context.startKoin @@ -76,6 +78,10 @@ class SettingsFragmentTest { private lateinit var version: String + @Rule + @JvmField + val retryFlakyTestUntilSuccessRule = RetryFlakyTestUntilSuccessRule() + @Before fun setUp() { context = InstrumentationRegistry.getInstrumentation().targetContext diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt index ae56ab5f51c..b8b4a38d2b1 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/utils/RetryFlakyTestUntilSuccessRule.kt @@ -5,7 +5,7 @@ import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement -class RetryFlakyTestUntilSuccessRule(val count: Int = 3) : TestRule { +class RetryFlakyTestUntilSuccessRule(val count: Int = 10) : TestRule { companion object { private const val TAG = "RetryFlakyTestUntilSuccessRule" From e970717b3939be35da388f36a22d0f1b3b0d3a74 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Tue, 30 Apr 2024 12:20:05 +0100 Subject: [PATCH 5/5] feat: ignored show_space_personal_when_it_has_value, hide_space_when_it_has_no_value and show_space_not_personal_when_it_has_value --- .../owncloud/android/files/details/FileDetailsFragmentTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt index 8201a2bca29..3a75fa800b1 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/files/details/FileDetailsFragmentTest.kt @@ -94,6 +94,7 @@ class FileDetailsFragmentTest { } @Test + @Ignore("Flaky test") fun show_space_personal_when_it_has_value() { R.id.fdSpace.assertVisibility(ViewMatchers.Visibility.VISIBLE) R.id.fdSpaceLabel.assertVisibility(ViewMatchers.Visibility.VISIBLE) @@ -106,6 +107,7 @@ class FileDetailsFragmentTest { } @Test + @Ignore("Flaky test") fun hide_space_when_it_has_no_value() { every { fileDetailsViewModel.currentFile } returns currentFileSyncInfo @@ -115,6 +117,7 @@ class FileDetailsFragmentTest { } @Test + @Ignore("Flaky test") fun show_space_not_personal_when_it_has_value() { every { fileDetailsViewModel.currentFile } returns currentFileWithoutPersonalSpace