From 257c3bca5e57d3e692d5f8ee086432ec2b6edf82 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 28 Apr 2024 22:11:37 +0200 Subject: [PATCH] Fix tests creating FeedItems just once because of duplicate IDs (#7148) --- .../java/de/test/antennapod/ui/TextOnlyFeedsTest.java | 2 +- .../androidTest/java/de/test/antennapod/ui/UITestUtils.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java b/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java index 60621f058..69a8f98ce 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java @@ -66,7 +66,7 @@ public class TextOnlyFeedsTest { onDrawerItem(withText(feed.getTitle())).perform(click()); onView(withText(feed.getItemAtIndex(0).getTitle())).perform(click()); onView(isRoot()).perform(waitForView(withText(R.string.mark_read_no_media_label), 3000)); - onView(withText(R.string.mark_read_no_media_label)).perform(click()); + onView(allOf(withText(R.string.mark_read_no_media_label), isDisplayed())).perform(click()); onView(isRoot()).perform(waitForView(allOf(withText(R.string.mark_read_no_media_label), not(isDisplayed())), 3000)); } diff --git a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java index 979d527f6..eb681cbca 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java @@ -128,13 +128,13 @@ public class UITestUtils { // create items List items = new ArrayList<>(); for (int j = 0; j < NUM_ITEMS_PER_FEED; j++) { - FeedItem item = new FeedItem(j, "Feed " + (i+1) + ": Item " + (j+1), "item" + j, + FeedItem item = new FeedItem(0, "Feed " + (i+1) + ": Item " + (j+1), "item" + j, "http://example.com/feed" + i + "/item/" + j, new Date(), FeedItem.UNPLAYED, feed); items.add(item); if (!hostTextOnlyFeeds) { File mediaFile = newMediaFile("feed-" + i + "-episode-" + j + ".mp3"); - item.setMedia(new FeedMedia(j, item, 0, 0, mediaFile.length(), "audio/mp3", null, hostFile(mediaFile), false, null, 0, 0)); + item.setMedia(new FeedMedia(0, item, 0, 0, mediaFile.length(), "audio/mp3", null, hostFile(mediaFile), false, null, 0, 0)); } } feed.setItems(items);