Browse Source

add sort option to UploadFilesActivity and FolderPickerActivity
added UI tests

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>

tobiasKaminsky 4 years ago
parent
commit
bee0c7b4a1

BIN
screenshots/gplay/debug/com.owncloud.android.ui.activity.FolderPickerActivityIT_open.png


BIN
screenshots/gplay/debug/com.owncloud.android.ui.activity.UploadFilesActivityIT_open.png


+ 7 - 0
src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java

@@ -34,6 +34,7 @@ import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.ScreenshotTest;
 
+import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -242,6 +243,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
         OCFile existingFile = new OCFile("/newFile.txt");
         existingFile.setFileLength(1024000);
         existingFile.setModificationTimestamp(1582019340);
+        existingFile.setRemoteId("123abc");
 
         OCFile newFile = new OCFile("/newFile.txt");
         newFile.setFileLength(56000);
@@ -320,4 +322,9 @@ public class ConflictsResolveActivityIT extends AbstractIT {
 
         assertTrue(returnCode);
     }
+
+    @After
+    public void after() {
+        getStorageManager().deleteAllFiles();
+    }
 }

+ 13 - 1
src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityIT.java

@@ -21,7 +21,9 @@ package com.owncloud.android.ui.activity;
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
+import com.owncloud.android.AbstractIT;
 import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.utils.ScreenshotTest;
 
 import org.junit.Assert;
 import org.junit.Rule;
@@ -33,7 +35,7 @@ import androidx.test.rule.ActivityTestRule;
 
 @RunWith(AndroidJUnit4.class)
 //@LargeTest
-public class FolderPickerActivityIT {
+public class FolderPickerActivityIT extends AbstractIT {
     @Rule
     public ActivityTestRule<FolderPickerActivity> activityRule =
         new ActivityTestRule<>(FolderPickerActivity.class);
@@ -118,4 +120,14 @@ public class FolderPickerActivityIT {
         // Assert
         Assert.assertEquals(origin, target);
     }
+
+    @Test
+    @ScreenshotTest
+    public void open() {
+        FolderPickerActivity sut = activityRule.getActivity();
+        OCFile origin = new OCFile("/test/file.txt");
+        sut.setFile(origin);
+
+        screenshot(sut);
+    }
 }

+ 41 - 0
src/androidTest/java/com/owncloud/android/ui/activity/UploadFilesActivityIT.kt

@@ -0,0 +1,41 @@
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2020 Tobias Kaminsky
+ * Copyright (C) 2020 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.ui.activity
+
+import androidx.test.espresso.intent.rule.IntentsTestRule
+import com.facebook.testing.screenshot.Screenshot
+import com.owncloud.android.AbstractIT
+import org.junit.Rule
+import org.junit.Test
+
+class UploadFilesActivityIT : AbstractIT() {
+    @get:Rule
+    var activityRule = IntentsTestRule(UploadFilesActivity::class.java, true, false)
+
+    @Test
+    // @ScreenshotTest // TODO re-enable and make sure that folder content on emulator is the same on all devices
+    fun open() {
+        val sut: UploadFilesActivity = activityRule.launchActivity(null)
+
+        Screenshot.snapActivity(sut).record()
+    }
+}

+ 2 - 0
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -114,6 +114,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
 
         // Action bar setup
         setupToolbar();
+        findViewById(R.id.sort_list_button_group).setVisibility(View.VISIBLE);
+        findViewById(R.id.switch_grid_view_button).setVisibility(View.GONE);
 
         if (getIntent().getStringExtra(EXTRA_ACTION) != null) {
             switch (getIntent().getStringExtra(EXTRA_ACTION)) {

+ 2 - 0
src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -195,6 +195,8 @@ public class UploadFilesActivity extends FileActivity implements LocalFileListFr
 
         // setup the toolbar
         setupToolbar();
+        findViewById(R.id.sort_list_button_group).setVisibility(View.VISIBLE);
+        findViewById(R.id.switch_grid_view_button).setVisibility(View.GONE);
 
         // Action bar setup
         ActionBar actionBar = getSupportActionBar();