|
@@ -84,6 +84,12 @@ public class DialogFragmentIT extends AbstractIT {
|
|
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
|
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
|
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
|
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
|
|
|
|
|
|
|
+ private FileDisplayActivity getFileDisplayActivity() {
|
|
|
|
+ Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
|
|
|
+ return activityRule.launchActivity(intent);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@After
|
|
@After
|
|
public void quitLooperIfNeeded() {
|
|
public void quitLooperIfNeeded() {
|
|
if (Looper.myLooper() != null) {
|
|
if (Looper.myLooper() != null) {
|
|
@@ -177,7 +183,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|
@Test
|
|
@Test
|
|
@ScreenshotTest
|
|
@ScreenshotTest
|
|
public void testAccountChooserDialog() throws AccountUtils.AccountNotFoundException {
|
|
public void testAccountChooserDialog() throws AccountUtils.AccountNotFoundException {
|
|
- FileDisplayActivity activity = activityRule.launchActivity(null);
|
|
|
|
|
|
+ FileDisplayActivity activity = getFileDisplayActivity();
|
|
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
|
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
|
AccountManager accountManager = AccountManager.get(targetContext);
|
|
AccountManager accountManager = AccountManager.get(targetContext);
|
|
for (Account account : accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
|
for (Account account : accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
|
@@ -211,13 +217,14 @@ public class DialogFragmentIT extends AbstractIT {
|
|
new OwnCloudAccount(newAccount, targetContext),
|
|
new OwnCloudAccount(newAccount, targetContext),
|
|
new Server(URI.create(SERVER_URL),
|
|
new Server(URI.create(SERVER_URL),
|
|
OwnCloudVersion.nextcloud_20)));
|
|
OwnCloudVersion.nextcloud_20)));
|
|
- activity = showDialog(sut);
|
|
|
|
|
|
+ showDialog(activity, sut);
|
|
|
|
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.DND,
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.DND,
|
|
"Busy fixing 🐛…",
|
|
"Busy fixing 🐛…",
|
|
"",
|
|
"",
|
|
-1),
|
|
-1),
|
|
targetContext));
|
|
targetContext));
|
|
|
|
+ waitForIdleSync();
|
|
shortSleep();
|
|
shortSleep();
|
|
screenshot(sut, "dnd");
|
|
screenshot(sut, "dnd");
|
|
|
|
|
|
@@ -226,6 +233,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|
"",
|
|
"",
|
|
-1),
|
|
-1),
|
|
targetContext));
|
|
targetContext));
|
|
|
|
+ waitForIdleSync();
|
|
shortSleep();
|
|
shortSleep();
|
|
screenshot(sut, "online");
|
|
screenshot(sut, "online");
|
|
|
|
|
|
@@ -234,14 +242,17 @@ public class DialogFragmentIT extends AbstractIT {
|
|
"🎉",
|
|
"🎉",
|
|
-1),
|
|
-1),
|
|
targetContext));
|
|
targetContext));
|
|
|
|
+ waitForIdleSync();
|
|
shortSleep();
|
|
shortSleep();
|
|
screenshot(sut, "fun");
|
|
screenshot(sut, "fun");
|
|
|
|
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.OFFLINE, "", "", -1), targetContext));
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.OFFLINE, "", "", -1), targetContext));
|
|
|
|
+ waitForIdleSync();
|
|
shortSleep();
|
|
shortSleep();
|
|
screenshot(sut, "offline");
|
|
screenshot(sut, "offline");
|
|
|
|
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.AWAY, "Vacation", "🌴", -1), targetContext));
|
|
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.AWAY, "Vacation", "🌴", -1), targetContext));
|
|
|
|
+ waitForIdleSync();
|
|
shortSleep();
|
|
shortSleep();
|
|
screenshot(sut, "away");
|
|
screenshot(sut, "away");
|
|
}
|
|
}
|
|
@@ -249,7 +260,6 @@ public class DialogFragmentIT extends AbstractIT {
|
|
@Test
|
|
@Test
|
|
@ScreenshotTest
|
|
@ScreenshotTest
|
|
public void testAccountChooserDialogWithStatusDisabled() throws AccountUtils.AccountNotFoundException {
|
|
public void testAccountChooserDialogWithStatusDisabled() throws AccountUtils.AccountNotFoundException {
|
|
- FileDisplayActivity activity = activityRule.launchActivity(null);
|
|
|
|
AccountManager accountManager = AccountManager.get(targetContext);
|
|
AccountManager accountManager = AccountManager.get(targetContext);
|
|
for (Account account : accountManager.getAccounts()) {
|
|
for (Account account : accountManager.getAccounts()) {
|
|
accountManager.removeAccountExplicitly(account);
|
|
accountManager.removeAccountExplicitly(account);
|
|
@@ -261,7 +271,8 @@ public class DialogFragmentIT extends AbstractIT {
|
|
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
|
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
|
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
|
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
|
|
|
|
|
- UserAccountManager userAccountManager = activity.getUserAccountManager();
|
|
|
|
|
|
+ FileDisplayActivity fda = getFileDisplayActivity();
|
|
|
|
+ UserAccountManager userAccountManager = fda.getUserAccountManager();
|
|
User newUser = userAccountManager.getUser(newAccount.name).get();
|
|
User newUser = userAccountManager.getUser(newAccount.name).get();
|
|
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
|
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
|
targetContext.getContentResolver());
|
|
targetContext.getContentResolver());
|
|
@@ -276,7 +287,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|
new OwnCloudAccount(newAccount, targetContext),
|
|
new OwnCloudAccount(newAccount, targetContext),
|
|
new Server(URI.create(SERVER_URL),
|
|
new Server(URI.create(SERVER_URL),
|
|
OwnCloudVersion.nextcloud_20)));
|
|
OwnCloudVersion.nextcloud_20)));
|
|
- showDialog(sut);
|
|
|
|
|
|
+ showDialog(fda, sut);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -438,6 +449,10 @@ public class DialogFragmentIT extends AbstractIT {
|
|
sut = activityRule.launchActivity(intent);
|
|
sut = activityRule.launchActivity(intent);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ return showDialog(sut, dialog);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private FileDisplayActivity showDialog(FileDisplayActivity sut, DialogFragment dialog) {
|
|
dialog.show(sut.getSupportFragmentManager(), "");
|
|
dialog.show(sut.getSupportFragmentManager(), "");
|
|
|
|
|
|
getInstrumentation().waitForIdleSync();
|
|
getInstrumentation().waitForIdleSync();
|