new screenshots, disabled non working
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
46
.drone.yml
|
@ -22,6 +22,7 @@ steps:
|
|||
- emulator-headless -avd android-27 -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
|
||||
- sed -i s"#server#server#" gradle.properties
|
||||
- sed -i s"#1#5#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- ./gradlew assembleGplay
|
||||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
|
@ -101,6 +102,7 @@ steps:
|
|||
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
|
||||
- emulator-headless -avd android-27 -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
|
||||
- sed -i s"#1#5#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- ./gradlew assembleGplay
|
||||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
|
@ -186,8 +188,6 @@ steps:
|
|||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
- ./gradlew installGplayDebugAndroidTest
|
||||
- scripts/wait_for_server.sh "server"
|
||||
- sed -i s"#5#1#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
- name: notify
|
||||
image: drillster/drone-email
|
||||
|
@ -210,26 +210,6 @@ steps:
|
|||
- failure
|
||||
branch:
|
||||
- master
|
||||
|
||||
services:
|
||||
- name: server
|
||||
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
|
||||
commands:
|
||||
- BRANCH='stable18' /usr/local/bin/initnc.sh
|
||||
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
|
||||
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
|
||||
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
|
||||
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
|
||||
- su www-data -c "php /var/www/html/occ group:add users"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user1"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user2"
|
||||
- su www-data -c "git clone -b stable18 https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable activity"
|
||||
- su www-data -c "git clone -b stable18 https://github.com/nextcloud/text.git /var/www/html/apps/text/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable text"
|
||||
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
|
||||
- /usr/local/bin/run.sh
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
|
@ -262,7 +242,6 @@ steps:
|
|||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
- ./gradlew installGplayDebugAndroidTest
|
||||
- scripts/wait_for_server.sh "server"
|
||||
- sed -i s"#5#1#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
|
||||
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
- name: notify
|
||||
|
@ -286,27 +265,6 @@ steps:
|
|||
- failure
|
||||
branch:
|
||||
- master
|
||||
|
||||
services:
|
||||
- name: server
|
||||
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
|
||||
commands:
|
||||
- /usr/local/bin/initnc.sh
|
||||
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
|
||||
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
|
||||
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
|
||||
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
|
||||
- su www-data -c "php /var/www/html/occ group:add users"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user1"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user2"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable activity"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable text"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
|
||||
- /usr/local/bin/run.sh
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
|
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.6 KiB |
|
@ -90,7 +90,7 @@ public class FileDisplayActivityIT extends AbstractIT {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void showShares() {
|
||||
assertTrue(new ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
|
||||
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.junit.runners.model.Statement
|
|||
/**
|
||||
* C&p from https://stackoverflow.com/questions/45635833/how-can-i-use-flakytest-annotation-now on 18.03.2020
|
||||
*/
|
||||
class RetryTestRule(val retryCount: Int = 5) : TestRule {
|
||||
class RetryTestRule(val retryCount: Int = 1) : TestRule {
|
||||
|
||||
companion object {
|
||||
private val TAG = RetryTestRule::class.java.simpleName
|
||||
|
|
|
@ -7,8 +7,6 @@ import android.accounts.OperationCanceledException;
|
|||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.testing.screenshot.Screenshot;
|
||||
import com.nextcloud.client.RetryTestRule;
|
||||
|
@ -29,21 +27,13 @@ import com.owncloud.android.lib.common.OwnCloudClient;
|
|||
import com.owncloud.android.lib.common.OwnCloudClientFactory;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.resources.e2ee.ToggleEncryptionRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.model.RemoteFile;
|
||||
import com.owncloud.android.operations.CreateFolderOperation;
|
||||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
|
||||
|
@ -78,7 +68,7 @@ public abstract class AbstractIT {
|
|||
protected static User user;
|
||||
protected static Context targetContext;
|
||||
|
||||
private Activity currentActivity;
|
||||
protected Activity currentActivity;
|
||||
|
||||
protected FileDataStorageManager fileDataStorageManager =
|
||||
new FileDataStorageManager(account, targetContext.getContentResolver());
|
||||
|
@ -87,26 +77,15 @@ public abstract class AbstractIT {
|
|||
public static void beforeAll() {
|
||||
try {
|
||||
targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
|
||||
|
||||
Uri baseUrl = Uri.parse(arguments.getString("TEST_SERVER_URL"));
|
||||
String loginName = arguments.getString("TEST_SERVER_USERNAME");
|
||||
String password = arguments.getString("TEST_SERVER_PASSWORD");
|
||||
|
||||
Account temp = new Account(loginName + "@" + baseUrl, MainApp.getAccountType(targetContext));
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
if (!accountManager.exists(temp)) {
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
Integer.toString(UserAccountManager.ACCOUNT_VERSION));
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString());
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId
|
||||
}
|
||||
Account temp = new Account("test@server.com", MainApp.getAccountType(targetContext));
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
platformAccountManager.addAccountExplicitly(temp, "password", null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
|
||||
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
account = userAccountManager.getAccountByName(loginName + "@" + baseUrl);
|
||||
account = userAccountManager.getAccountByName("test@server.com");
|
||||
|
||||
if (account == null) {
|
||||
throw new ActivityNotFoundException();
|
||||
|
@ -116,12 +95,6 @@ public abstract class AbstractIT {
|
|||
user = optionalUser.orElseThrow(IllegalAccessError::new);
|
||||
|
||||
client = OwnCloudClientFactory.createOwnCloudClient(account, targetContext);
|
||||
|
||||
createDummyFiles();
|
||||
|
||||
waitForServer(client, baseUrl);
|
||||
|
||||
deleteAllFiles(); // makes sure that no file/folder is in root
|
||||
} catch (OperationCanceledException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AuthenticatorException e) {
|
||||
|
@ -133,36 +106,6 @@ public abstract class AbstractIT {
|
|||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
deleteAllFiles();
|
||||
}
|
||||
|
||||
public static void deleteAllFiles() {
|
||||
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
|
||||
for (Object object : result.getData()) {
|
||||
RemoteFile remoteFile = (RemoteFile) object;
|
||||
|
||||
if (!remoteFile.getRemotePath().equals("/")) {
|
||||
if (remoteFile.isEncrypted()) {
|
||||
assertTrue(new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false)
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
|
||||
assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath())
|
||||
.execute(client)
|
||||
.isSuccess()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected FileDataStorageManager getStorageManager() {
|
||||
return fileDataStorageManager;
|
||||
}
|
||||
|
@ -171,14 +114,6 @@ public abstract class AbstractIT {
|
|||
return AccountManager.get(targetContext).getAccounts();
|
||||
}
|
||||
|
||||
private static void createDummyFiles() throws IOException {
|
||||
new File(FileStorageUtils.getSavePath(account.name)).mkdirs();
|
||||
|
||||
createFile("empty.txt", 0);
|
||||
createFile("nonEmpty.txt", 100);
|
||||
createFile("chunkedFile.txt", 500000);
|
||||
}
|
||||
|
||||
public static void createFile(String name, int iteration) throws IOException {
|
||||
File file = new File(FileStorageUtils.getSavePath(account.name) + File.separator + name);
|
||||
file.createNewFile();
|
||||
|
@ -192,28 +127,6 @@ public abstract class AbstractIT {
|
|||
writer.close();
|
||||
}
|
||||
|
||||
private static void waitForServer(OwnCloudClient client, Uri baseUrl) {
|
||||
GetMethod get = new GetMethod(baseUrl + "/status.php");
|
||||
|
||||
try {
|
||||
int i = 0;
|
||||
while (client.executeMethod(get) != HttpStatus.SC_OK && i < 3) {
|
||||
System.out.println("wait…");
|
||||
Thread.sleep(60 * 1000);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
Assert.fail("Server not ready!");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected File getFile(String filename) throws IOException {
|
||||
InputStream inputStream = getInstrumentation().getContext().getAssets().open(filename);
|
||||
File temp = File.createTempFile("file", "file");
|
||||
|
|
|
@ -0,0 +1,229 @@
|
|||
package com.owncloud.android;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AuthenticatorException;
|
||||
import android.accounts.OperationCanceledException;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.nextcloud.client.device.BatteryStatus;
|
||||
import com.nextcloud.client.device.PowerManagementService;
|
||||
import com.nextcloud.client.network.Connectivity;
|
||||
import com.nextcloud.client.network.ConnectivityService;
|
||||
import com.owncloud.android.datamodel.UploadsStorageManager;
|
||||
import com.owncloud.android.db.OCUpload;
|
||||
import com.owncloud.android.files.services.FileUploader;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.OwnCloudClientFactory;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.resources.e2ee.ToggleEncryptionRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.model.RemoteFile;
|
||||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
* Common base for all integration tests
|
||||
*/
|
||||
|
||||
public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
try {
|
||||
targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
|
||||
|
||||
Uri baseUrl = Uri.parse(arguments.getString("TEST_SERVER_URL"));
|
||||
String loginName = arguments.getString("TEST_SERVER_USERNAME");
|
||||
String password = arguments.getString("TEST_SERVER_PASSWORD");
|
||||
|
||||
Account temp = new Account(loginName + "@" + baseUrl, MainApp.getAccountType(targetContext));
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
if (!accountManager.exists(temp)) {
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
platformAccountManager.addAccountExplicitly(temp, password, null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
Integer.toString(UserAccountManager.ACCOUNT_VERSION));
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString());
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId
|
||||
}
|
||||
|
||||
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
account = userAccountManager.getAccountByName(loginName + "@" + baseUrl);
|
||||
|
||||
if (account == null) {
|
||||
throw new ActivityNotFoundException();
|
||||
}
|
||||
|
||||
client = OwnCloudClientFactory.createOwnCloudClient(account, targetContext);
|
||||
|
||||
createDummyFiles();
|
||||
|
||||
waitForServer(client, baseUrl);
|
||||
|
||||
deleteAllFiles(); // makes sure that no file/folder is in root
|
||||
|
||||
} catch (OperationCanceledException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AuthenticatorException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AccountUtils.AccountNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
deleteAllFiles();
|
||||
}
|
||||
|
||||
public static void deleteAllFiles() {
|
||||
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
|
||||
for (Object object : result.getData()) {
|
||||
RemoteFile remoteFile = (RemoteFile) object;
|
||||
|
||||
if (!remoteFile.getRemotePath().equals("/")) {
|
||||
if (remoteFile.isEncrypted()) {
|
||||
assertTrue(new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false)
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
|
||||
assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath())
|
||||
.execute(client)
|
||||
.isSuccess()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createDummyFiles() throws IOException {
|
||||
new File(FileStorageUtils.getSavePath(account.name)).mkdirs();
|
||||
|
||||
createFile("empty.txt", 0);
|
||||
createFile("nonEmpty.txt", 100);
|
||||
createFile("chunkedFile.txt", 500000);
|
||||
}
|
||||
|
||||
public static void createFile(String name, int iteration) throws IOException {
|
||||
File file = new File(FileStorageUtils.getSavePath(account.name) + File.separator + name);
|
||||
file.createNewFile();
|
||||
|
||||
FileWriter writer = new FileWriter(file);
|
||||
|
||||
for (int i = 0; i < iteration; i++) {
|
||||
writer.write("123123123123123123123123123\n");
|
||||
}
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private static void waitForServer(OwnCloudClient client, Uri baseUrl) {
|
||||
GetMethod get = new GetMethod(baseUrl + "/status.php");
|
||||
|
||||
try {
|
||||
int i = 0;
|
||||
while (client.executeMethod(get) != HttpStatus.SC_OK && i < 3) {
|
||||
System.out.println("wait…");
|
||||
Thread.sleep(60 * 1000);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
Assert.fail("Server not ready!");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void uploadOCUpload(OCUpload ocUpload) {
|
||||
ConnectivityService connectivityServiceMock = new ConnectivityService() {
|
||||
@Override
|
||||
public boolean isInternetWalled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connectivity getConnectivity() {
|
||||
return Connectivity.CONNECTED_WIFI;
|
||||
}
|
||||
};
|
||||
|
||||
PowerManagementService powerManagementServiceMock = new PowerManagementService() {
|
||||
@NonNull
|
||||
@Override
|
||||
public BatteryStatus getBattery() {
|
||||
return new BatteryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowerSavingExclusionAvailable() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(accountManager,
|
||||
targetContext.getContentResolver());
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
account,
|
||||
null,
|
||||
ocUpload,
|
||||
FileUploader.NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
);
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ package com.owncloud.android.datamodel;
|
|||
|
||||
import android.content.ContentValues;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.AbstractOnServerIT;
|
||||
import com.owncloud.android.db.ProviderMeta;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
|
||||
|
@ -50,7 +50,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
abstract public class FileDataStorageManagerTest extends AbstractIT {
|
||||
abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
|
||||
|
||||
protected FileDataStorageManager sut;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void screenshotImages() throws IOException {
|
||||
FileDataStorageManager storageManager = new FileDataStorageManager(account,
|
||||
targetContext.getContentResolver());
|
||||
|
|
|
@ -53,7 +53,7 @@ import androidx.test.rule.GrantPermissionRule;
|
|||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
public class DialogFragmentTest extends AbstractIT {
|
||||
public class DialogFragmentIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
||||
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class DialogFragmentTest extends AbstractIT {
|
|||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest
|
||||
public void testRenameFileDialog() {
|
||||
RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(new OCFile("/Test/"));
|
||||
showDialog(dialog);
|
||||
|
@ -112,7 +112,7 @@ public class DialogFragmentTest extends AbstractIT {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest
|
||||
public void testNewFolderDialog() {
|
||||
CreateFolderDialogFragment sut = CreateFolderDialogFragment.newInstance(new OCFile("/"));
|
||||
showDialog(sut);
|
|
@ -49,7 +49,6 @@ import com.owncloud.android.operations.RefreshFolderOperation
|
|||
import com.owncloud.android.operations.UploadFileOperation
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.utils.FileStorageUtils
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import junit.framework.TestCase
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
|
@ -89,7 +88,7 @@ class OCFileListFragmentIT : AbstractIT() {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
fun showRichWorkspace() {
|
||||
assertTrue(CreateFolderOperation("/test/", user, targetContext).execute(client, storageManager).isSuccess)
|
||||
|
||||
|
@ -176,7 +175,7 @@ class OCFileListFragmentIT : AbstractIT() {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
fun createAndShowShareToUser() {
|
||||
val path = "/shareToAdmin/"
|
||||
TestCase.assertTrue(
|
||||
|
@ -207,7 +206,7 @@ class OCFileListFragmentIT : AbstractIT() {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
fun createAndShowShareToGroup() {
|
||||
val path = "/shareToGroup/"
|
||||
TestCase.assertTrue(
|
||||
|
@ -271,7 +270,7 @@ class OCFileListFragmentIT : AbstractIT() {
|
|||
// }
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
fun createAndShowShareViaLink() {
|
||||
val path = "/shareViaLink/"
|
||||
TestCase.assertTrue(
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.owncloud.android.datamodel.OCFile;
|
|||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -51,7 +50,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
|
|||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void displaySimpleTextFile() {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
|
@ -69,7 +68,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
|
|||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void displayJavaSnippetFile() throws IOException {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
|
|
|
@ -153,7 +153,9 @@ class ChooseAccountDialogFragment : DialogFragment(), AvatarGenerationListener,
|
|||
}
|
||||
|
||||
override fun avatarGenerated(avatarDrawable: Drawable?, callContext: Any?) {
|
||||
user_icon.setImageDrawable(avatarDrawable)
|
||||
if (user_icon != null) {
|
||||
user_icon.setImageDrawable(avatarDrawable)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAccountClicked(user: User?) {
|
||||
|
|