Pārlūkot izejas kodu

Change test so that it does not need server

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 gadi atpakaļ
vecāks
revīzija
cbf80a7422

BIN
screenshots/gplay/debug/com.nextcloud.client.FileDisplayActivityIT_showMediaThenAllFiles.png


BIN
screenshots/gplay/debug/com.nextcloud.client.FileDisplayActivityScreenshotIT_showMediaThenAllFiles.png


+ 0 - 29
src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java

@@ -37,7 +37,6 @@ import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.events.SearchEvent;
-import com.owncloud.android.utils.ScreenshotTest;
 
 import org.greenrobot.eventbus.EventBus;
 import org.junit.Assert;
@@ -45,7 +44,6 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import androidx.test.espresso.Espresso;
-import androidx.test.espresso.action.ViewActions;
 import androidx.test.espresso.contrib.DrawerActions;
 import androidx.test.espresso.contrib.NavigationViewActions;
 import androidx.test.espresso.intent.rule.IntentsTestRule;
@@ -177,31 +175,4 @@ public class FileDisplayActivityIT extends AbstractOnServerIT {
 
         Espresso.onView(withId(R.id.switch_account_button)).perform(click());
     }
-
-    @Test
-    @ScreenshotTest
-    public void showMediaThenAllFiles() {
-        FileDisplayActivity sut = activityRule.launchActivity(null);
-
-        // open drawer
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-
-        // click "all files"
-        onView(withId(R.id.nav_view))
-            .perform(NavigationViewActions.navigateTo(R.id.nav_gallery));
-
-        // wait
-        shortSleep();
-        waitForIdleSync();
-
-        // click "all files"
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.nav_view)).perform(ViewActions.swipeUp());
-        onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_all_files));
-
-        // then compare screenshot
-        shortSleep();
-        shortSleep();
-        screenshot(sut);
-    }
 }

+ 35 - 0
src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.java

@@ -33,6 +33,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import androidx.test.espresso.contrib.DrawerActions;
+import androidx.test.espresso.contrib.NavigationViewActions;
 import androidx.test.espresso.intent.rule.IntentsTestRule;
 import androidx.test.rule.GrantPermissionRule;
 
@@ -58,6 +59,40 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT {
         sut.getListOfFilesFragment().setLoading(false);
         waitForIdleSync();
 
+        shortSleep();
+
+        screenshot(sut);
+    }
+
+    @Test
+    @ScreenshotTest
+    public void showMediaThenAllFiles() {
+        FileDisplayActivity sut = activityRule.launchActivity(null);
+
+        sut.getListOfFilesFragment().setFabEnabled(false);
+        sut.getListOfFilesFragment().setEmptyListLoadingMessage(false);
+        sut.getListOfFilesFragment().setLoading(false);
+
+        // open drawer
+        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
+
+        // click "all files"
+        onView(withId(R.id.nav_view))
+            .perform(NavigationViewActions.navigateTo(R.id.nav_gallery));
+
+        // wait
+        shortSleep();
+
+        // click "all files"
+        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
+        onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_all_files));
+
+        // then compare screenshot
+        shortSleep();
+        sut.getListOfFilesFragment().setFabEnabled(false);
+        sut.getListOfFilesFragment().setEmptyListLoadingMessage(false);
+        sut.getListOfFilesFragment().setLoading(false);
+        shortSleep();
         screenshot(sut);
     }