From 4f0de071ec4654c8d0a829d2edb60d9891ce74da Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 17 Mar 2020 00:17:21 +0100 Subject: Converted lists to RecyclerView Also, cleaned up list adapters --- .../test/antennapod/ui/NavigationDrawerTest.java | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'app/src/androidTest/java') diff --git a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java index 973e4da2b..e7fbbcb89 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java @@ -34,6 +34,8 @@ import static androidx.test.espresso.action.ViewActions.scrollTo; import static androidx.test.espresso.action.ViewActions.swipeUp; import static androidx.test.espresso.intent.Intents.intended; import static androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent; +import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isRoot; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; @@ -80,52 +82,51 @@ public class NavigationDrawerTest { uiTestUtils.addLocalFeedData(false); UserPreferences.setHiddenDrawerItems(new ArrayList<>()); activityRule.launchActivity(new Intent()); - MainActivity activity = activityRule.getActivity(); // queue openNavDrawer(); onDrawerItem(withText(R.string.queue_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(R.id.recyclerView), 1000)); - assertEquals(activity.getString(R.string.queue_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.queue_label)), 1000)); // episodes openNavDrawer(); onDrawerItem(withText(R.string.episodes_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(android.R.id.list), 1000)); - assertEquals(activity.getString(R.string.episodes_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.episodes_label), isDisplayed()), 1000)); // Subscriptions openNavDrawer(); onDrawerItem(withText(R.string.subscriptions_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(R.id.subscriptions_grid), 1000)); - assertEquals(activity.getString(R.string.subscriptions_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.subscriptions_label), isDisplayed()), 1000)); // downloads openNavDrawer(); onDrawerItem(withText(R.string.downloads_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(android.R.id.list), 1000)); - assertEquals(activity.getString(R.string.downloads_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.downloads_label), isDisplayed()), 1000)); // playback history openNavDrawer(); onDrawerItem(withText(R.string.playback_history_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(android.R.id.list), 1000)); - assertEquals(activity.getString(R.string.playback_history_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.playback_history_label), isDisplayed()), 1000)); // add podcast openNavDrawer(); onView(withId(R.id.nav_list)).perform(swipeUp()); onDrawerItem(withText(R.string.add_feed_label)).perform(click()); - onView(isRoot()).perform(waitForView(withId(R.id.btn_add_via_url), 1000)); - assertEquals(activity.getString(R.string.add_feed_label), activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.toolbar)), + withText(R.string.add_feed_label), isDisplayed()), 1000)); // podcasts for (int i = 0; i < uiTestUtils.hostedFeeds.size(); i++) { Feed f = uiTestUtils.hostedFeeds.get(i); openNavDrawer(); onDrawerItem(withText(f.getTitle())).perform(scrollTo(), click()); - onView(isRoot()).perform(waitForView(withId(android.R.id.list), 1000)); - assertEquals("", activity.getSupportActionBar().getTitle()); + onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.appBar)), + withText(f.getTitle()), isDisplayed()), 1000)); } } -- cgit v1.2.3