فهرست منبع

Fix avatar tests after changes of UI

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 سال پیش
والد
کامیت
32c7c0560c

+ 1 - 1
scripts/analysis/findbugs-results.txt

@@ -1 +1 @@
-370
+371

+ 1 - 2
src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java

@@ -151,8 +151,7 @@ public class FileDisplayActivityIT extends AbstractIT {
     public void showAccounts() {
         Activity sut = activityRule.launchActivity(null);
 
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_active_user)).perform(click());
+        onView(withId(R.id.switch_account_button)).perform(click());
 
         Screenshot.snapActivity(sut).record();
     }

+ 3 - 3
src/androidTest/java/com/owncloud/android/ScreenshotsIT.java

@@ -29,6 +29,7 @@ import tools.fastlane.screengrab.locale.LocaleTestRule;
 
 import static androidx.test.espresso.Espresso.onData;
 import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.Espresso.pressBack;
 import static androidx.test.espresso.action.ViewActions.click;
 import static androidx.test.espresso.action.ViewActions.swipeUp;
 import static androidx.test.espresso.matcher.ViewMatchers.withId;
@@ -105,12 +106,11 @@ public class ScreenshotsIT extends AbstractIT {
     public void multipleAccountsScreenshot() {
         ActivityScenario.launch(FileDisplayActivity.class);
 
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_active_user)).perform(click());
+        onView(withId(R.id.switch_account_button)).perform(click());
 
         Screengrab.screenshot("04_accounts");
 
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
+        pressBack();
 
         Assert.assertTrue(true); // if we reach this, everything is ok
     }

+ 2 - 22
src/androidTest/java/com/owncloud/android/ui/activity/DrawerActivityIT.java

@@ -39,7 +39,6 @@ import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 
-import androidx.test.espresso.contrib.DrawerActions;
 import androidx.test.espresso.intent.rule.IntentsTestRule;
 import androidx.test.rule.GrantPermissionRule;
 
@@ -93,8 +92,7 @@ public class DrawerActivityIT extends AbstractIT {
 
         assertEquals(account, sut.getUser().get().toPlatformAccount());
 
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_active_user)).perform(click());
+        onView(withId(R.id.switch_account_button)).perform(click());
 
         onView(anyOf(withText(account2Name), withText(account2DisplayName))).perform(click());
 
@@ -102,25 +100,7 @@ public class DrawerActivityIT extends AbstractIT {
 
         assertEquals(account2, sut.getUser().get().toPlatformAccount());
 
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_active_user)).perform(click());
+        onView(withId(R.id.switch_account_button)).perform(click());
         onView(withText(account.name)).perform(click());
     }
-
-    @Test
-    public void switchAccountViaAvatar() {
-        FileDisplayActivity sut = activityRule.launchActivity(null);
-
-        assertEquals(account, sut.getUser().get().toPlatformAccount());
-
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_account_end)).perform(click());
-
-        waitForIdleSync();
-
-        assertEquals(account2, sut.getUser().get().toPlatformAccount());
-
-        onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
-        onView(withId(R.id.drawer_account_end)).perform(click());
-    }
 }