summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2019-12-02 11:45:10 +0100
committerByteHamster <info@bytehamster.com>2019-12-12 09:47:16 +0100
commit44f5cad4e6e8cf46315010e2857b9b3e0f565bef (patch)
treea97ea1c22823c8e6e96c9be1be13ce3a7bdf0e7f /app/src/androidTest/java
parentca16dddef1d451a5583dc5e3f2b31679ee4f628b (diff)
downloadAntennaPod-44f5cad4e6e8cf46315010e2857b9b3e0f565bef.zip
Do not try to click play in off-screen list
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java
index 2133b787c..036eda3aa 100644
--- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java
@@ -15,6 +15,7 @@ import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.service.playback.PlayerStatus;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter;
+import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.core.util.LongList;
import de.test.antennapod.EspressoTestUtils;
import de.test.antennapod.ui.UITestUtils;
@@ -34,6 +35,7 @@ import java.util.concurrent.TimeUnit;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
+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;
@@ -41,8 +43,8 @@ import static de.test.antennapod.EspressoTestUtils.clickChildViewWithId;
import static de.test.antennapod.EspressoTestUtils.onDrawerItem;
import static de.test.antennapod.EspressoTestUtils.openNavDrawer;
import static de.test.antennapod.EspressoTestUtils.waitForView;
-import static de.test.antennapod.NthMatcher.first;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
@@ -218,13 +220,11 @@ public class PlaybackTest {
}
private void skipEpisode() {
- Intent skipIntent = new Intent(PlaybackService.ACTION_SKIP_CURRENT_EPISODE);
- context.sendBroadcast(skipIntent);
+ IntentUtils.sendLocalBroadcast(context, PlaybackService.ACTION_SKIP_CURRENT_EPISODE);
}
protected void pauseEpisode() {
- Intent pauseIntent = new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE);
- context.sendBroadcast(pauseIntent);
+ IntentUtils.sendLocalBroadcast(context, PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE);
}
protected void startLocalPlayback() {
@@ -234,9 +234,9 @@ public class PlaybackTest {
onView(withText(R.string.all_episodes_short_label)).perform(click());
final List<FeedItem> episodes = DBReader.getRecentlyPublishedEpisodes(0, 10);
- onView(isRoot()).perform(waitForView(withId(R.id.butSecondaryAction), 1000));
+ onView(allOf(withId(android.R.id.list), isDisplayed())).perform(
+ actionOnItemAtPosition(0, clickChildViewWithId(R.id.butSecondaryAction)));
- onView(first(withId(R.id.butSecondaryAction))).perform(click());
long mediaId = episodes.get(0).getMedia().getId();
Awaitility.await().atMost(1, TimeUnit.SECONDS).until(() -> {
if (uiTestUtils.getCurrentMedia(getActivity()) != null) {