From 88a609fc0e05a72672af3ef4f317b0de42d613ea Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 20 Jul 2020 11:12:16 +0200 Subject: [PATCH] another try to get tests green Signed-off-by: tobiasKaminsky --- .../owncloud/android/ui/activity/DrawerActivityIT.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.java b/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.java index 494c2fcfe9..52225f9525 100644 --- a/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.java +++ b/src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.java @@ -28,9 +28,10 @@ import android.accounts.AccountManager; import android.net.Uri; import android.os.Bundle; +import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.account.UserAccountManagerImpl; -import com.owncloud.android.AbstractOnServerIT; +import com.owncloud.android.AbstractIT; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.lib.common.accounts.AccountUtils; @@ -49,7 +50,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.anyOf; import static org.junit.Assert.assertEquals; -public class DrawerActivityIT extends AbstractOnServerIT { +public class DrawerActivityIT extends AbstractIT { @Rule public IntentsTestRule activityRule = new IntentsTestRule<>(FileDisplayActivity.class, true, false); @@ -58,6 +59,7 @@ public class DrawerActivityIT extends AbstractOnServerIT { public final GrantPermissionRule permissionRule = GrantPermissionRule.grant( Manifest.permission.WRITE_EXTERNAL_STORAGE); private static Account account1; + private static User user1; private static Account account2; private static String account2Name; private static String account2DisplayName; @@ -86,8 +88,8 @@ public class DrawerActivityIT extends AbstractOnServerIT { platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId account1 = userAccountManager.getAccountByName(loginName + "@" + baseUrl); + user1 = userAccountManager.getUser(account1.name).orElseThrow(IllegalAccessError::new); - baseUrl = Uri.parse("https://server.com"); loginName = "user2"; password = "user2"; @@ -108,6 +110,8 @@ public class DrawerActivityIT extends AbstractOnServerIT { public void switchAccountViaAccountList() { FileDisplayActivity sut = activityRule.launchActivity(null); + sut.setUser(user1); + assertEquals(account1, sut.getUser().get().toPlatformAccount()); onView(withId(R.id.switch_account_button)).perform(click());