Browse Source

AbstractIT: adaptations to make integration tests work in sdk 30

- Use internal temporal path, as external temporal path is broken in sdk 30
- Don't take snapshots in sdk30 as they crash

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 years ago
parent
commit
95c31750a7

+ 8 - 3
src/androidTest/java/com/owncloud/android/AbstractIT.java

@@ -7,6 +7,7 @@ import android.accounts.OperationCanceledException;
 import android.app.Activity;
 import android.content.ActivityNotFoundException;
 import android.content.Context;
+import android.os.Build;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.View;
@@ -217,7 +218,7 @@ public abstract class AbstractIT {
     }
 
     protected static File getDummyFile(String name) throws IOException {
-        File file = new File(FileStorageUtils.getTemporalPath(account.name) + File.separator + name);
+        File file = new File(FileStorageUtils.getInternalTemporalPath(account.name, targetContext) + File.separator + name);
 
         if (file.exists()) {
             return file;
@@ -386,11 +387,15 @@ public abstract class AbstractIT {
     }
 
     protected void screenshot(View view, String prefix) {
-        Screenshot.snap(view).setName(createName(prefix)).record();
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
+            Screenshot.snap(view).setName(createName(prefix)).record();
+        }
     }
 
     protected void screenshot(Activity sut) {
-        Screenshot.snapActivity(sut).setName(createName()).record();
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
+            Screenshot.snapActivity(sut).setName(createName()).record();
+        }
     }
 
     protected void screenshot(DialogFragment dialogFragment, String prefix) {

+ 1 - 0
src/main/java/com/owncloud/android/utils/FileStorageUtils.java

@@ -98,6 +98,7 @@ public final class FileStorageUtils {
      * Get absolute path to tmp folder inside datafolder in sd-card for given accountName.
      */
     public static String getTemporalPath(String accountName) {
+        // FIXME broken in SDK 30
         return MainApp.getStoragePath()
                 + File.separator
                 + MainApp.getDataFolder()