-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13517 from nextcloud/bugfix/ss-test-after-offline…
…-folder-creation Fix ScreenShot Tests After Offline Folder Creation Operations
- Loading branch information
Showing
85 changed files
with
116 additions
and
132 deletions.
There are no files selected for viewing
Binary file modified
BIN
-23 Bytes
(100%)
app/screenshots/gplay/debug/com.nextcloud.client.SyncedFoldersActivityIT_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.91 KB
(76%)
...ts/gplay/debug/com.nextcloud.client.UploadListActivityActivityIT_openDrawer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.67 KB
(90%)
.../debug/com.owncloud.android.ui.activity.ConflictsResolveActivityIT_keepBoth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.82 KB
(89%)
...ug/com.owncloud.android.ui.activity.ConflictsResolveActivityIT_keepExisting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.46 KB
(91%)
...y/debug/com.owncloud.android.ui.activity.ConflictsResolveActivityIT_keepNew.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.81 KB
(89%)
...owncloud.android.ui.activity.ConflictsResolveActivityIT_screenshotTextFiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.7 KB
(81%)
...oud.android.ui.activity.ContactsPreferenceActivityIT_openContactsPreference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+152 Bytes
(100%)
...debug/com.owncloud.android.ui.activity.ContactsPreferenceActivityIT_openVCF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.72 KB
(84%)
...ts/gplay/debug/com.owncloud.android.ui.activity.FolderPickerActivityIT_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.7 KB
(84%)
...wncloud.android.ui.activity.FolderPickerActivityIT_testChooseLocationAction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.97 KB
(83%)
...ebug/com.owncloud.android.ui.activity.FolderPickerActivityIT_testMoveOrCopy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.75 KB
(87%)
.../gplay/debug/com.owncloud.android.ui.activity.ManageAccountsActivityIT_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.39 KB
(90%)
.../debug/com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.38 KB
(90%)
...wncloud.android.ui.activity.ReceiveExternalFilesActivityIT_openMultiAccount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.66 KB
(82%)
.../com.owncloud.android.ui.dialog.DialogFragmentIT_testFileActionsBottomSheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.11 KB
(91%)
...ebug/com.owncloud.android.ui.fragment.BackupListFragmentIT_showCalendarList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.42 KB
(88%)
...debug/com.owncloud.android.ui.fragment.BackupListFragmentIT_showContactList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+152 Bytes
(100%)
...lay/debug/com.owncloud.android.ui.fragment.BackupListFragmentIT_showLoading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9.76 KB
(80%)
...ncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showSharedFiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-87 Bytes
(100%)
...cloud.android.ui.preview.PreviewTextFileFragmentTest_displayJavaSnippetFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-28 Bytes
(100%)
...ncloud.android.ui.preview.PreviewTextFileFragmentTest_displaySimpleTextFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/* | ||
* Nextcloud - Android Client | ||
* | ||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]> | ||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH | ||
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only | ||
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]> | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
package com.nextcloud.client.jobs | ||
|
||
import android.Manifest | ||
import androidx.test.rule.GrantPermissionRule | ||
import androidx.work.WorkManager | ||
import com.nextcloud.client.core.ClockImpl | ||
import com.nextcloud.client.preferences.AppPreferences | ||
import com.nextcloud.client.preferences.AppPreferencesImpl | ||
import com.nextcloud.test.RetryTestRule | ||
import com.owncloud.android.AbstractIT | ||
|
@@ -20,24 +20,25 @@ import com.owncloud.android.datamodel.OCFile | |
import com.owncloud.android.operations.DownloadFileOperation | ||
import ezvcard.Ezvcard | ||
import ezvcard.VCard | ||
import junit.framework.Assert.assertEquals | ||
import junit.framework.Assert.assertTrue | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Assert.fail | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import java.io.BufferedInputStream | ||
import java.io.File | ||
import java.io.FileInputStream | ||
|
||
class ContactsBackupIT : AbstractOnServerIT() { | ||
val workmanager = WorkManager.getInstance(targetContext) | ||
val preferences = AppPreferencesImpl.fromContext(targetContext) | ||
private val backgroundJobManager = BackgroundJobManagerImpl(workmanager, ClockImpl(), preferences) | ||
private val workManager = WorkManager.getInstance(targetContext) | ||
private val preferences: AppPreferences = AppPreferencesImpl.fromContext(targetContext) | ||
private val backgroundJobManager = BackgroundJobManagerImpl(workManager, ClockImpl(), preferences) | ||
|
||
@get:Rule | ||
val writeContactsRule = GrantPermissionRule.grant(Manifest.permission.WRITE_CONTACTS) | ||
val writeContactsRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_CONTACTS) | ||
|
||
@get:Rule | ||
val readContactsRule = GrantPermissionRule.grant(Manifest.permission.READ_CONTACTS) | ||
val readContactsRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.READ_CONTACTS) | ||
|
||
@get:Rule | ||
val retryTestRule = RetryTestRule() // flaky test | ||
|
@@ -46,38 +47,54 @@ class ContactsBackupIT : AbstractOnServerIT() { | |
|
||
@Test | ||
fun importExport() { | ||
val intArray = IntArray(1) | ||
intArray[0] = 0 | ||
val intArray = intArrayOf(0) | ||
|
||
// import file to local contacts | ||
backgroundJobManager.startImmediateContactsImport(null, null, getFile(vcard).absolutePath, intArray) | ||
|
||
shortSleep() | ||
longSleep() | ||
|
||
// export contact | ||
backgroundJobManager.startImmediateContactsBackup(user) | ||
|
||
longSleep() | ||
|
||
val backupFolder: String = targetContext.resources.getString(R.string.contacts_backup_folder) + | ||
val folderPath: String = targetContext.resources.getString(R.string.contacts_backup_folder) + | ||
OCFile.PATH_SEPARATOR | ||
|
||
refreshFolder("/") | ||
longSleep() | ||
longSleep() | ||
|
||
refreshFolder(backupFolder) | ||
refreshFolder(folderPath) | ||
longSleep() | ||
longSleep() | ||
|
||
val backupOCFile = storageManager.getFolderContent( | ||
storageManager.getFileByDecryptedRemotePath(backupFolder), | ||
false | ||
)[0] | ||
if (folderPath.isEmpty()) { | ||
fail("folderPath cannot be empty") | ||
} | ||
|
||
val folder = fileDataStorageManager.getFileByDecryptedRemotePath(folderPath) | ||
if (folder == null) { | ||
fail("folder cannot be null") | ||
} | ||
|
||
assertTrue(DownloadFileOperation(user, backupOCFile, AbstractIT.targetContext).execute(client).isSuccess) | ||
val ocFile = storageManager.getFolderContent(folder, false).firstOrNull() | ||
if (ocFile == null) { | ||
fail("ocFile cannot be null") | ||
} | ||
|
||
if (ocFile?.storagePath == null) { | ||
fail("ocFile.storagePath cannot be null") | ||
} | ||
|
||
assertTrue(DownloadFileOperation(user, ocFile, AbstractIT.targetContext).execute(client).isSuccess) | ||
|
||
val file = ocFile?.storagePath?.let { File(it) } | ||
if (file == null) { | ||
fail("file cannot be null") | ||
} | ||
|
||
val backupFile = File(backupOCFile.storagePath) | ||
val vcardInputStream = BufferedInputStream(FileInputStream(getFile(vcard))) | ||
val backupFileInputStream = BufferedInputStream(FileInputStream(backupFile)) | ||
val backupFileInputStream = BufferedInputStream(FileInputStream(file)) | ||
|
||
// verify same | ||
val originalCards: ArrayList<VCard> = ArrayList() | ||
|
@@ -87,6 +104,17 @@ class ContactsBackupIT : AbstractOnServerIT() { | |
backupCards.addAll(Ezvcard.parse(backupFileInputStream).all()) | ||
|
||
assertEquals(originalCards.size, backupCards.size) | ||
assertEquals(originalCards[0].formattedName.toString(), backupCards[0].formattedName.toString()) | ||
|
||
val originalCardFormattedName = originalCards.firstOrNull()?.formattedName | ||
if (originalCardFormattedName == null) { | ||
fail("originalCardFormattedName cannot be null") | ||
} | ||
|
||
val backupCardFormattedName = backupCards.firstOrNull()?.formattedName | ||
if (backupCardFormattedName == null) { | ||
fail("backupCardFormattedName cannot be null") | ||
} | ||
|
||
assertEquals(originalCardFormattedName.toString(), backupCardFormattedName.toString()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
val sut = testActivityRule.launchActivity(null) | ||
|
||
OCFile("/1.png").apply { | ||
remoteId = "00000001" | ||
mimeType = "image/png" | ||
fileLength = 1024000 | ||
modificationTimestamp = 1188206955000 | ||
|
@@ -43,6 +44,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/image.png").apply { | ||
remoteId = "00000002" | ||
mimeType = "image/png" | ||
isPreviewAvailable = false | ||
fileLength = 3072000 | ||
|
@@ -53,6 +55,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/live photo.png").apply { | ||
remoteId = "00000003" | ||
mimeType = "image/png" | ||
isPreviewAvailable = false | ||
fileLength = 3072000 | ||
|
@@ -63,6 +66,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/video.mp4").apply { | ||
remoteId = "00000004" | ||
mimeType = "video/mp4" | ||
isPreviewAvailable = false | ||
fileLength = 12092000 | ||
|
@@ -96,6 +100,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
val fragment = OCFileListFragment() | ||
|
||
OCFile("/sharedToUser.jpg").apply { | ||
remoteId = "00000001" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("Admin", "Server Admin", ShareType.USER)) | ||
|
@@ -104,6 +109,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/sharedToGroup.jpg").apply { | ||
remoteId = "00000002" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("group", "Group", ShareType.GROUP)) | ||
|
@@ -112,6 +118,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/sharedToEmail.jpg").apply { | ||
remoteId = "00000003" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("[email protected]", "[email protected]", ShareType.EMAIL)) | ||
|
@@ -120,13 +127,15 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/publicLink.jpg").apply { | ||
remoteId = "00000004" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedViaLink = true | ||
modificationTimestamp = 1000 | ||
sut.storageManager.saveFile(this) | ||
} | ||
|
||
OCFile("/sharedToFederatedUser.jpg").apply { | ||
remoteId = "00000005" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf( | ||
|
@@ -137,6 +146,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/sharedToPersonalCircle.jpg").apply { | ||
remoteId = "00000006" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("circle", "Circle (Personal circle)", ShareType.CIRCLE)) | ||
|
@@ -170,6 +180,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
// } | ||
|
||
OCFile("/sharedToUserRoom.jpg").apply { | ||
remoteId = "00000007" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("Conversation", "Admin", ShareType.ROOM)) | ||
|
@@ -178,6 +189,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/sharedToGroupRoom.jpg").apply { | ||
remoteId = "00000008" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf(ShareeUser("Conversation", "Meeting", ShareType.ROOM)) | ||
|
@@ -186,6 +198,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/sharedToUsers.jpg").apply { | ||
remoteId = "00000009" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
isSharedWithSharee = true | ||
sharees = listOf( | ||
|
@@ -198,6 +211,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/notShared.jpg").apply { | ||
remoteId = "000000010" | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
modificationTimestamp = 1000 | ||
sut.storageManager.saveFile(this) | ||
|
@@ -232,13 +246,15 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
val fragment = OCFileListFragment() | ||
|
||
OCFile("/normal/").apply { | ||
remoteId = "00000001" | ||
mimeType = MimeType.DIRECTORY | ||
modificationTimestamp = 1624003571000 | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
sut.storageManager.saveFile(this) | ||
} | ||
|
||
OCFile("/sharedViaLink/").apply { | ||
remoteId = "00000002" | ||
mimeType = MimeType.DIRECTORY | ||
isSharedViaLink = true | ||
modificationTimestamp = 1619003571000 | ||
|
@@ -247,6 +263,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/share/").apply { | ||
remoteId = "00000003" | ||
mimeType = MimeType.DIRECTORY | ||
isSharedWithSharee = true | ||
modificationTimestamp = 1619303571000 | ||
|
@@ -255,6 +272,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/groupFolder/").apply { | ||
remoteId = "00000004" | ||
mimeType = MimeType.DIRECTORY | ||
modificationTimestamp = 1615003571000 | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId | ||
|
@@ -263,6 +281,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/encrypted/").apply { | ||
remoteId = "00000005" | ||
mimeType = MimeType.DIRECTORY | ||
isEncrypted = true | ||
decryptedRemotePath = "/encrypted/" | ||
|
@@ -272,6 +291,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
} | ||
|
||
OCFile("/locked/").apply { | ||
remoteId = "00000006" | ||
mimeType = MimeType.DIRECTORY | ||
isLocked = true | ||
decryptedRemotePath = "/locked/" | ||
|
@@ -310,12 +330,15 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
folder.setFolder() | ||
sut.storageManager.saveFile(folder) | ||
|
||
val imageFile = OCFile("/test/image.png") | ||
imageFile.mimeType = "image/png" | ||
imageFile.fileLength = 1024000 | ||
imageFile.modificationTimestamp = 1188206955000 | ||
imageFile.parentId = sut.storageManager.getFileByEncryptedRemotePath("/test/").fileId | ||
imageFile.storagePath = getFile("java.md").absolutePath | ||
val imageFile = OCFile("/test/image.png").apply { | ||
remoteId = "00000001" | ||
mimeType = "image/png" | ||
fileLength = 1024000 | ||
modificationTimestamp = 1188206955000 | ||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/test/").fileId | ||
storagePath = getFile("java.md").absolutePath | ||
} | ||
|
||
sut.storageManager.saveFile(imageFile) | ||
|
||
sut.addFragment(fragment) | ||
|
@@ -334,8 +357,11 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
val activity = testActivityRule.launchActivity(null) | ||
val sut = OCFileListFragment() | ||
|
||
val folder = OCFile("/test/") | ||
folder.setFolder() | ||
val folder = OCFile("/test/").apply { | ||
remoteId = "000001" | ||
setFolder() | ||
} | ||
|
||
activity.storageManager.saveFile(folder) | ||
|
||
activity.addFragment(sut) | ||
|
@@ -357,7 +383,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() { | |
|
||
testFolder.richWorkspace = "1" | ||
activity.storageManager.saveFile(testFolder) | ||
sut.adapter.setCurrentDirectory(testFolder) | ||
sut.adapter.currentDirectory = testFolder | ||
Assert.assertTrue(sut.adapter.shouldShowHeader()) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.