summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-11-11 09:50:42 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-11-11 09:50:42 +0000
commite77fb81d9ec3e4c1b1d6ea2d2103660d121d8ace (patch)
tree57bd0f059cd51099b396e1844931905c2a4abdc9
parent4559946420c4e7317ce68acc34f9ece28492163b (diff)
Two instrumented tests had gone stale, and nothing was running them
Both describe behaviour that was deliberately changed and neither was updated with it, because the instrumented suite is not in the commit gate: it needs a device, so it only runs when someone asks for it. 108 tests, two of them asserting the opposite of what the app now does. The library row asserted a Download button. The row's three became play next, queue and mark played a commit ago -- play is a long press on the line and a queued episode downloads itself -- so the test named a control that no longer exists. Mark played now has a test of its own; it was the one the change was for and the only one of the three with none. The car's resume test seeded an episode with no file, from when playback would fall back to the publisher's copy. That fallback was removed on purpose, so the car now starts a fetch and plays nothing this time round -- the test was asserting a resume against an empty playlist and failing on the position being zero, which is the right answer to the wrong question. Confirmed from the device's own log, "nothing to play for resume-ep from outside the app", rather than inferred. It seeds a downloaded episode now, so the defect it exists for -- the position being dropped at the session boundary -- is what it measures. Whole instrumented suite: 109 tests, no failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
-rw-r--r--app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt7
-rw-r--r--app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt41
2 files changed, 40 insertions, 8 deletions
diff --git a/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt b/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt
index 61ffe6a..807b0d7 100644
--- a/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt
+++ b/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt
@@ -248,7 +248,14 @@ class MediaBrowseTest {
fun anEpisodeStartedFromTheCarResumesWhereItWasLeft() = runBlocking {
val graph = Graph.get(context)
graph.subscriptions.insert(seedShow("resume-show", "Resume Hour"))
+ // Downloaded, because an episode with no file has nothing for a position to apply to:
+ // playback stopped falling back to the publisher's copy on purpose, so the car now
+ // starts a fetch and plays nothing this time round. Seeded without a file, this test
+ // asserted a resume against an empty playlist and failed on the position being zero --
+ // which is the right answer to the wrong question. The defect it guards is the position
+ // being dropped at the session boundary, and that needs something playable to drop it on.
val episode = seedEpisode("resume-ep", "resume-show", 0)
+ .copy(localPath = "${'$'}{context.filesDir}/resume-ep.mp3")
graph.episodes.insertAll(listOf(episode))
graph.playbackState.updatePosition("resume-ep", LEFT_AT_MS)
diff --git a/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt b/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt
index 41dc682..a66337f 100644
--- a/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt
+++ b/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt
@@ -62,7 +62,7 @@ class LibraryRowTest {
compose.onNodeWithText("Zebra Hour").assertIsDisplayed()
compose.onNodeWithText("3").assertIsDisplayed()
compose.onNodeWithText("The one about stripes").assertIsDisplayed()
- compose.onNodeWithContentDescription("Download").assertIsDisplayed()
+ compose.onNodeWithContentDescription("Play The one about stripes next").assertIsDisplayed()
}
/**
@@ -82,24 +82,49 @@ class LibraryRowTest {
compose.onNodeWithText("Caught Up").assertIsDisplayed()
compose.onNodeWithText("—").assertIsDisplayed()
// The controls belong to the episode, so with no episode there is nothing to control.
- compose.onNodeWithContentDescription("Download").assertDoesNotExist()
+ compose.onNodeWithContentDescription("Play The one about stripes next").assertDoesNotExist()
}
- /** The point of the controls: they act on the episode named beside them, not on the show. */
+ /**
+ * The point of the controls: they act on the episode named beside them, not on the show.
+ *
+ * Play next rather than play: the row's three buttons became play next, queue and mark
+ * played, because play is a long press on the line and a queued episode downloads itself.
+ */
+ @Test
+ fun playNextActsOnTheEpisodeTheRowNames() {
+ var queuedNext = 0
+ compose.setContent {
+ SubscriptionRow(
+ listing = SubscriptionListing(show("s", "Zebra Hour"), waiting = 1),
+ latest = episode("e", "s", "The one about stripes"),
+ actions = noActions().copy(playNext = { queuedNext++ }),
+ ) {}
+ }
+
+ compose.onNodeWithContentDescription("Play The one about stripes next").performClick()
+
+ assertEquals(1, queuedNext)
+ }
+
+ /**
+ * Marking it played is the control that was missing, and the reason the row changed: saying
+ * "not now" without opening the show is what sends a long library back to being scrollable.
+ */
@Test
- fun playActsOnTheEpisodeTheRowNames() {
- var played = 0
+ fun markPlayedActsOnTheEpisodeTheRowNames() {
+ var toggled = 0
compose.setContent {
SubscriptionRow(
listing = SubscriptionListing(show("s", "Zebra Hour"), waiting = 1),
latest = episode("e", "s", "The one about stripes"),
- actions = noActions().copy(play = { played++ }),
+ actions = noActions().copy(togglePlayed = { toggled++ }),
) {}
}
- compose.onNodeWithContentDescription("Play The one about stripes").performClick()
+ compose.onNodeWithContentDescription("Mark The one about stripes played").performClick()
- assertEquals(1, played)
+ assertEquals(1, toggled)
}
@Test