Merge pull request #8791 from alvarobrey/fix-connectedTest-crashes
Fix connected test crashes
This commit is contained in:
commit
7f995726b3
|
@ -86,6 +86,7 @@ public class SettingsActivityIT extends AbstractIT {
|
|||
SettingsActivity sut = activityRule.launchActivity(null);
|
||||
sut.handleMnemonicRequest(intent);
|
||||
|
||||
Looper.myLooper().quitSafely();
|
||||
assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class SyncedFoldersActivityIT extends AbstractIT {
|
|||
false,
|
||||
false,
|
||||
true,
|
||||
"test@https://server.com",
|
||||
"test@https://nextcloud.localhost",
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
|
|
|
@ -38,7 +38,7 @@ class RegisteredUserTest {
|
|||
|
||||
private companion object {
|
||||
fun buildTestUser(accountName: String): RegisteredUser {
|
||||
val uri = Uri.parse("https://nextcloud.localhost.localdomain")
|
||||
val uri = Uri.parse("https://nextcloud.localhost")
|
||||
val credentials = OwnCloudBasicCredentials("user", "pass")
|
||||
val account = Account(accountName, "test-type")
|
||||
val ownCloudAccount = OwnCloudAccount(uri, credentials)
|
||||
|
@ -58,7 +58,7 @@ class RegisteredUserTest {
|
|||
|
||||
@Before
|
||||
fun setUp() {
|
||||
user = buildTestUser("test@nextcloud.localhost.localdomain")
|
||||
user = buildTestUser("test@nextcloud.localhost")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -103,13 +103,13 @@ public abstract class AbstractIT {
|
|||
}
|
||||
}
|
||||
|
||||
Account temp = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account temp = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
platformAccountManager.addAccountExplicitly(temp, "password", null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://nextcloud.localhost");
|
||||
platformAccountManager.setUserData(temp, KEY_USER_ID, "test");
|
||||
|
||||
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
account = userAccountManager.getAccountByName("test@https://server.com");
|
||||
account = userAccountManager.getAccountByName("test@https://nextcloud.localhost");
|
||||
|
||||
if (account == null) {
|
||||
throw new ActivityNotFoundException();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class OCFileUnitTest {
|
|||
private static final long LAST_SYNC_DATE_FOR_PROPERTIES = 5432109876L;
|
||||
private static final long LAST_SYNC_DATE_FOR_DATA = 4321098765L;
|
||||
private static final String ETAG = "adshfas98ferqw8f9yu2";
|
||||
private static final String PUBLIC_LINK = "https://fake.url.net/owncloud/987427448712984sdas29";
|
||||
private static final String PUBLIC_LINK = "https://nextcloud.localhost/owncloud/987427448712984sdas29";
|
||||
private static final String PERMISSIONS = "SRKNVD";
|
||||
private static final String REMOTE_ID = "jadñgiadf8203:9jrp98v2mn3er2089fh";
|
||||
private static final String ETAG_IN_CONFLICT = "2adshfas98ferqw8f9yu";
|
||||
|
|
|
@ -44,6 +44,7 @@ import com.owncloud.android.lib.common.Creator;
|
|||
import com.owncloud.android.lib.common.DirectEditing;
|
||||
import com.owncloud.android.lib.common.Editor;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
|
@ -56,6 +57,7 @@ import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialog;
|
|||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -70,9 +72,19 @@ import androidx.test.espresso.intent.rule.IntentsTestRule;
|
|||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
public class DialogFragmentIT extends AbstractIT {
|
||||
|
||||
private final String SERVER_URL = "https://nextcloud.localhost";
|
||||
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
||||
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
||||
|
||||
@After
|
||||
public void quitLooperIfNeeded() {
|
||||
if (Looper.myLooper() != null) {
|
||||
Looper.myLooper().quitSafely();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRenameFileDialog() {
|
||||
|
@ -164,17 +176,20 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
|
||||
Account newAccount2 = new Account("user1@server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount2 = new Account("user1@nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount2, "password", null);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_USER_ID, "user1");
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_VERSION, "20.0.0");
|
||||
accountManager.setAuthToken(newAccount2, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newAccount,
|
||||
targetContext.getContentResolver());
|
||||
|
@ -187,7 +202,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create("https://server.com"),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
FileDisplayActivity activity = showDialog(sut);
|
||||
|
||||
|
@ -232,10 +247,11 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newAccount,
|
||||
targetContext.getContentResolver());
|
||||
|
@ -248,7 +264,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create("https://server.com"),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
showDialog(sut);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class AvatarIT : AbstractIT() {
|
|||
fragment.addAvatar("winston brent", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("email@server.com", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("email@nextcloud.localhost", avatarRadius, width, targetContext)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
|
|
@ -110,7 +110,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
|||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 3
|
||||
shareType = ShareType.EMAIL
|
||||
sharedWithDisplayName = "admin@nextcloud.server.com"
|
||||
sharedWithDisplayName = "admin@nextcloud.localhost"
|
||||
userId = getUserId(user)
|
||||
activity.storageManager.saveShare(this)
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
|||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 6
|
||||
shareType = ShareType.FEDERATED
|
||||
sharedWithDisplayName = "admin@nextcloud.remoteserver.com"
|
||||
sharedWithDisplayName = "admin@nextcloud.localhost"
|
||||
permissions = OCShare.FEDERATED_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
activity.storageManager.saveShare(this)
|
||||
|
|
|
@ -104,7 +104,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
|
|||
val emailShare = OCFile("/sharedToEmail.jpg").apply {
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("admin@nextcloud.server.com", "admin@nextcloud.server.com", ShareType.EMAIL))
|
||||
sharees = listOf(ShareeUser("admin@nextcloud.localhost", "admin@nextcloud.localhost", ShareType.EMAIL))
|
||||
}
|
||||
sut.storageManager.saveFile(emailShare)
|
||||
|
||||
|
|
|
@ -123,15 +123,15 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
|
||||
@Test
|
||||
fun differentUser() {
|
||||
val temp = Account("differentUser@https://server.com", MainApp.getAccountType(targetContext))
|
||||
val temp = Account("differentUser@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
||||
|
||||
val 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_OC_BASE_URL, "https://nextcloud.localhost")
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, "differentUser")
|
||||
|
||||
val intent = Intent()
|
||||
intent.putExtra(Intent.EXTRA_USER, "differentUser@https://server.com")
|
||||
intent.putExtra(Intent.EXTRA_USER, "differentUser@https://nextcloud.localhost")
|
||||
val sut: TrashbinActivity = activityRule.launchActivity(intent)
|
||||
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
android:maxLines="1"
|
||||
android:text="@string/placeholder_sentence"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="https://server.com/nextcloud" />
|
||||
tools:text="https://nextcloud.localhost/nextcloud" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class ConnectivityServiceTest {
|
|||
return networkInfo
|
||||
}
|
||||
|
||||
const val SERVER_BASE_URL = "https://test.server.com"
|
||||
const val SERVER_BASE_URL = "https://test.nextcloud.localhost"
|
||||
}
|
||||
|
||||
@Mock
|
||||
|
|
|
@ -34,6 +34,6 @@ class TextDrawableTest {
|
|||
assertEquals("WB", TextDrawable.extractCharsFromDisplayName("winston brent"))
|
||||
assertEquals("BJ", TextDrawable.extractCharsFromDisplayName("Baker James Lorena"))
|
||||
assertEquals("BJ", TextDrawable.extractCharsFromDisplayName("Baker James Lorena"))
|
||||
assertEquals("E", TextDrawable.extractCharsFromDisplayName("email@server.com"))
|
||||
assertEquals("E", TextDrawable.extractCharsFromDisplayName("email@nextcloud.localhost"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue