add sort option to UploadFilesActivity and FolderPickerActivity

added UI tests

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-08-07 11:26:49 +02:00
parent 8d82203c15
commit bee0c7b4a1
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
7 changed files with 65 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -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()
}
}

View file

@ -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)) {

View file

@ -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();