use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class DialogFragmentIT method testRenameFileDialog.
@Test
@ScreenshotTest
public void testRenameFileDialog() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(new OCFile("/Test/"));
showDialog(dialog);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class FolderPickerActivityIT method open.
@Test
@ScreenshotTest
public void open() {
FolderPickerActivity sut = activityRule.getActivity();
OCFile origin = new OCFile("/test/file.txt");
sut.setFile(origin);
screenshot(sut);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class UserInfoActivityIT method fullUserInfoDetail.
@Test
@ScreenshotTest
public void fullUserInfoDetail() {
final Intent intent = new Intent(targetContext, UserInfoActivity.class);
intent.putExtra(UserInfoActivity.KEY_ACCOUNT, user);
UserInfo userInfo = new UserInfo("test", true, "Firstname Familyname", "oss@rocks.com", "+49 7613 672 255", "Awesome Place Av.", "https://www.nextcloud.com", "nextclouders", null, null);
intent.putExtra(UserInfoActivity.KEY_USER_DATA, userInfo);
UserInfoActivity sut = activityRule.launchActivity(intent);
shortSleep();
shortSleep();
screenshot(sut);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class ConflictsResolveActivityIT method keepBoth.
@Test
@ScreenshotTest
public void keepBoth() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt", "/newFile.txt", user.getAccountName());
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.KEEP_BOTH);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
onView(withId(R.id.existing_checkbox)).perform(click());
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
onView(withText("OK")).perform(click());
assertTrue(returnCode);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class ConflictsResolveActivityIT method cancel.
// @Test
// @ScreenshotTest // todo run without real server
// public void screenshotImages() throws IOException {
// FileDataStorageManager storageManager = new FileDataStorageManager(user,
// targetContext.getContentResolver());
//
// OCFile newFile = new OCFile("/newFile.txt");
// newFile.setFileLength(56000);
// newFile.setModificationTimestamp(1522019340);
// newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
//
// File image = getFile("image.jpg");
//
// assertTrue(new UploadFileRemoteOperation(image.getAbsolutePath(),
// "/image.jpg",
// "image/jpg",
// "10000000").execute(client).isSuccess());
//
// assertTrue(new RefreshFolderOperation(storageManager.getFileByPath("/"),
// System.currentTimeMillis(),
// false,
// true,
// storageManager,
// user.toPlatformAccount(),
// targetContext
// ).execute(client).isSuccess());
//
// OCFile existingFile = storageManager.getFileByPath("/image.jpg");
//
// Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
// intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
// intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
//
// ConflictsResolveActivity sut = activityRule.launchActivity(intent);
//
// ConflictsResolveDialog.OnConflictDecisionMadeListener listener = decision -> {
//
// };
//
// ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
// newFile,
// UserAccountManagerImpl
// .fromContext(targetContext)
// .getUser()
// );
// dialog.showDialog(sut);
// dialog.listener = listener;
//
// getInstrumentation().waitForIdleSync();
// shortSleep();
//
// screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
// }
@Test
public void cancel() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt", "/newFile.txt", user.getAccountName());
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.CANCEL);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
shortSleep();
onView(withText("Cancel")).perform(click());
assertTrue(returnCode);
}
Aggregations