diff --git a/app/src/androidTest/java/com/owncloud/android/AbstractIT.java b/app/src/androidTest/java/com/owncloud/android/AbstractIT.java index 9549951b3471..68bd9cc9d452 100644 --- a/app/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/app/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -314,7 +314,7 @@ protected Activity getCurrentActivity() { return currentActivity; } - protected void shortSleep() { + protected static void shortSleep() { try { Thread.sleep(2000); } catch (InterruptedException e) { diff --git a/app/src/androidTest/java/com/owncloud/android/AbstractOnServerIT.java b/app/src/androidTest/java/com/owncloud/android/AbstractOnServerIT.java index fd2e206e7f2c..94f54f69615e 100644 --- a/app/src/androidTest/java/com/owncloud/android/AbstractOnServerIT.java +++ b/app/src/androidTest/java/com/owncloud/android/AbstractOnServerIT.java @@ -135,10 +135,20 @@ public static void deleteAllFilesOnServer() { .isSuccess()); } - assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath()) - .execute(client) - .isSuccess() - ); + boolean removeResult = false; + for (int i = 0; i < 5; i++) { + removeResult = new RemoveFileRemoteOperation(remoteFile.getRemotePath()) + .execute(client) + .isSuccess(); + + if (removeResult) { + break; + } + + shortSleep(); + } + + assertTrue(removeResult); } } } diff --git a/app/src/androidTest/java/com/owncloud/android/UploadIT.java b/app/src/androidTest/java/com/owncloud/android/UploadIT.java index e93b328f0865..7b86de769169 100644 --- a/app/src/androidTest/java/com/owncloud/android/UploadIT.java +++ b/app/src/androidTest/java/com/owncloud/android/UploadIT.java @@ -41,7 +41,6 @@ import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.utils.FileStorageUtils; -import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -106,29 +105,6 @@ public void before() throws IOException { createDummyFiles(); } - @After - public void after() { - RemoteOperationResult result = new RefreshFolderOperation(getStorageManager().getFileByPath("/"), - System.currentTimeMillis() / 1000L, - false, - true, - getStorageManager(), - user, - targetContext) - .execute(client); - - // cleanup only if folder exists - if (result.isSuccess() && getStorageManager().getFileByDecryptedRemotePath(FOLDER) != null) { - new RemoveFileOperation(getStorageManager().getFileByDecryptedRemotePath(FOLDER), - false, - user, - false, - targetContext, - getStorageManager()) - .execute(client); - } - } - @Test public void testEmptyUpload() { OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/empty.txt", @@ -529,8 +505,8 @@ public void testMetadata() throws IOException, AccountUtils.AccountNotFoundExcep assertNotNull(ocFile); assertEquals(remotePath, ocFile.getRemotePath()); - assertEquals(new ImageDimension(451f, 529f), ocFile.getImageDimension()); - assertEquals(new GeoLocation(49.99679166666667, 8.67198611111111), ocFile.getGeoLocation()); + assertEquals(new ImageDimension(300f, 200f), ocFile.getImageDimension()); + assertEquals(new GeoLocation(64, -46), ocFile.getGeoLocation()); } private void verifyStoragePath(OCFile file) { diff --git a/app/src/androidTest/java/com/owncloud/android/ui/LoginIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/LoginIT.kt index 0a53d807f292..3bf0378c01bd 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/LoginIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/LoginIT.kt @@ -20,6 +20,7 @@ */ package com.owncloud.android.ui +import android.os.Build import androidx.test.core.app.ActivityScenario import androidx.test.espresso.Espresso import androidx.test.espresso.action.ViewActions @@ -28,6 +29,7 @@ import androidx.test.espresso.web.sugar.Web import androidx.test.espresso.web.webdriver.DriverAtoms import androidx.test.espresso.web.webdriver.Locator import androidx.test.filters.LargeTest +import androidx.test.filters.SdkSuppress import androidx.test.platform.app.InstrumentationRegistry import com.nextcloud.client.account.UserAccountManager import com.nextcloud.client.account.UserAccountManagerImpl @@ -59,6 +61,12 @@ class LoginIT : AbstractIT() { @Test @Throws(InterruptedException::class) @Suppress("MagicNumber", "SwallowedException") + + /** + * The CI/CD pipeline is encountering issues related to the Android version for this functionality. + * Therefore the test will only be executed on Android versions 10 and above. + */ + @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q) fun login() { val arguments = InstrumentationRegistry.getArguments() val baseUrl = arguments.getString("TEST_SERVER_URL")!!