зеркало из https://github.com/nextcloud/android.git
Fix DialogFragmentIT test
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
Родитель
503d6685a2
Коммит
719551505e
|
@ -80,10 +80,10 @@ else
|
|||
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
||||
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
|
||||
|
||||
if [ -e build/reports/androidTests/connected/flavors/gplayDebugAndroidTest ] ; then
|
||||
if [ -e build/reports/androidTests/connected/flavors/gplay ] ; then
|
||||
TYPE="IT"
|
||||
BRANCH_TYPE=$BRANCH-$TYPE
|
||||
upload "build/reports/androidTests/connected/flavors/gplayDebugAndroidTest"
|
||||
upload "build/reports/androidTests/connected/flavors/gplay"
|
||||
fi
|
||||
|
||||
if [ -e build/reports/tests/testGplayDebugUnitTest ] ; then
|
||||
|
|
|
@ -177,7 +177,8 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
@Test
|
||||
@ScreenshotTest
|
||||
public void testAccountChooserDialog() throws AccountUtils.AccountNotFoundException {
|
||||
UserAccountManager userAccountManager = activityRule.getActivity().getUserAccountManager();
|
||||
FileDisplayActivity activity = activityRule.launchActivity(null);
|
||||
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
||||
AccountManager accountManager = AccountManager.get(targetContext);
|
||||
for (Account account : accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
|
@ -210,7 +211,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
FileDisplayActivity activity = showDialog(sut);
|
||||
activity = showDialog(sut);
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.DND,
|
||||
"Busy fixing 🐛…",
|
||||
|
@ -248,6 +249,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
@Test
|
||||
@ScreenshotTest
|
||||
public void testAccountChooserDialogWithStatusDisabled() throws AccountUtils.AccountNotFoundException {
|
||||
FileDisplayActivity activity = activityRule.launchActivity(null);
|
||||
AccountManager accountManager = AccountManager.get(targetContext);
|
||||
for (Account account : accountManager.getAccounts()) {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
|
@ -259,7 +261,7 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
UserAccountManager userAccountManager = activityRule.getActivity().getUserAccountManager();
|
||||
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
||||
User newUser = userAccountManager.getUser(newAccount.name).get();
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
||||
targetContext.getContentResolver());
|
||||
|
@ -429,7 +431,12 @@ public class DialogFragmentIT extends AbstractIT {
|
|||
|
||||
private FileDisplayActivity showDialog(DialogFragment dialog) {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
FileDisplayActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
FileDisplayActivity sut = activityRule.getActivity();
|
||||
|
||||
if (sut == null) {
|
||||
sut = activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
dialog.show(sut.getSupportFragmentManager(), "");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче