diff options
author | ByteHamster <info@bytehamster.com> | 2020-03-17 00:17:21 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-03-17 14:35:06 +0100 |
commit | 4f0de071ec4654c8d0a829d2edb60d9891ce74da (patch) | |
tree | db1dcd0b128841f6f9303ec71efdcf46dc348b57 /app/src/androidTest/java | |
parent | 4e0e4baa056509536f34078bf15031d8c0c97053 (diff) | |
download | AntennaPod-4f0de071ec4654c8d0a829d2edb60d9891ce74da.zip |
Converted lists to RecyclerView
Also, cleaned up list adapters
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java | 31 |
1 files changed, 16 insertions, 15 deletions
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)); } } |