瀏覽代碼

Merge pull request #6132 from nextcloud/disableOrchestrator

disabling test_orchestrator for testing purpose
Tobias Kaminsky 4 年之前
父節點
當前提交
ca17f165bb

+ 0 - 2
build.gradle

@@ -192,8 +192,6 @@ android {
 
         testOptions {
             unitTests.returnDefaultValues = true
-            // comment out if you run androidTests in Android Studio experiencing test runner crashes
-            execution 'ANDROIDX_TEST_ORCHESTRATOR'
             animationsDisabled true
         }
     }

+ 8 - 0
scripts/analysis/findbugs-up.rb

@@ -48,6 +48,14 @@ require 'xmlsimple'
 # run FindBugs
 puts "running FindBugs..."
 system './gradlew assembleGplayDebug'
+
+# confirm that assemble ran w/out error
+result = $?.to_i
+if result != 0
+    puts "FAIL: failed to run ./gradlew assembleGplayDebug"
+    exit 1
+end
+
 system './gradlew spotbugsGplayDebug'
 
 # find FindBugs report file

+ 14 - 0
src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java

@@ -43,6 +43,7 @@ import com.owncloud.android.utils.FileStorageUtils;
 
 import net.bytebuddy.utility.RandomString;
 
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -53,8 +54,10 @@ import java.security.PrivateKey;
 import java.util.ArrayList;
 import java.util.Random;
 
+import static com.owncloud.android.lib.resources.status.OwnCloudVersion.nextcloud_19;
 import static junit.framework.TestCase.assertNotNull;
 import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 public class EndToEndRandomIT extends AbstractIT {
     public enum Action {
@@ -75,6 +78,17 @@ public class EndToEndRandomIT extends AbstractIT {
         arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
     }
 
+    @Before
+    public void before() {
+        // tests only for NC19+
+        assumeTrue(getStorageManager()
+                       .getCapability(account.name)
+                       .getVersion()
+                       .isNewerOrEqual(nextcloud_19)
+                  );
+
+    }
+
     @Test
     public void run() throws Exception {
         init();

+ 1 - 2
src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java

@@ -40,7 +40,6 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.events.SearchEvent;
 
 import org.greenrobot.eventbus.EventBus;
-import org.json.JSONException;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -86,7 +85,7 @@ public class FileDisplayActivityIT extends AbstractIT {
     }
 
     @Test
-    public void showShares() throws JSONException {
+    public void showShares() {
         assertTrue(new ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
         assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
         assertTrue(new CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess());

+ 3 - 17
src/androidTest/java/com/owncloud/android/ScreenshotsIT.java

@@ -17,8 +17,6 @@ import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
 import androidx.test.core.app.ActivityScenario;
-import androidx.test.espresso.Espresso;
-import androidx.test.espresso.NoActivityResumedException;
 import androidx.test.espresso.action.ViewActions;
 import androidx.test.espresso.contrib.DrawerActions;
 import androidx.test.espresso.contrib.RecyclerViewActions;
@@ -54,32 +52,20 @@ public class ScreenshotsIT extends AbstractIT {
     }
 
     @Test
-    public void gridViewScreenshot() throws InterruptedException {
+    public void gridViewScreenshot() {
         ActivityScenario.launch(FileDisplayActivity.class);
 
-        openOverflowMenu();
-        onView(anyOf(withText(R.string.action_switch_grid_view), withId(R.id.action_switch_view))).perform(click());
+        onView(anyOf(withText(R.string.action_switch_grid_view), withId(R.id.switch_grid_view_button))).perform(click());
 
         shortSleep();
 
         Screengrab.screenshot("01_gridView");
 
-        openOverflowMenu();
-        onView(anyOf(withText(R.string.action_switch_list_view), withId(R.id.action_switch_view))).perform(click());
+        onView(anyOf(withText(R.string.action_switch_list_view), withId(R.id.switch_grid_view_button))).perform(click());
 
         Assert.assertTrue(true); // if we reach this, everything is ok
     }
 
-    private void openOverflowMenu() {
-        try {
-            Espresso.openContextualActionModeOverflowMenu();
-        } catch (NoActivityResumedException e) {
-            ActivityScenario.launch(FileDisplayActivity.class);
-            shortSleep();
-            Espresso.openContextualActionModeOverflowMenu();
-        }
-    }
-
     @Test
     public void listViewScreenshot() {
         String path = "/Camera/";

+ 5 - 1
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -2228,7 +2228,11 @@ public class FileDisplayActivity extends FileActivity
                                         null
                                 );
 
-                                getListOfFilesFragment().setLoading(true);
+                                OCFileListFragment fragment = getListOfFilesFragment();
+
+                                if (fragment != null) {
+                                    fragment.setLoading(true);
+                                }
 
                                 setBackgroundText();