StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat(live): add EPG and Home screen behavior tests; enhance golden capture logic
David Nashash91b8a78f2402
diff --git a/app/src/androidTest/assets/ui-goldens/route_live_browse.png b/app/src/androidTest/assets/ui-goldens/route_live_browse.pngindex 7830a6a8..0c277f68 100644Binary files a/app/src/androidTest/assets/ui-goldens/route_live_browse.png and b/app/src/androidTest/assets/ui-goldens/route_live_browse.png differdiff --git a/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.kt b/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.ktindex a4ed831d..f5eb6ec5 100644--- a/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.kt+++ b/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.kt@@ -20,12 +20,23 @@ fun SemanticsNodeInteraction.assertAgainstGolden(goldenName: String) {.getString(RECORD_GOLDENS_ARGUMENT) == "true"if (shouldRecord) {- val outputDir = File(targetContext.filesDir, "ui-goldens").apply { mkdirs() }- val goldenFile = File(outputDir, "$goldenName.png")- goldenFile.outputStream().use { stream ->- bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)+ val outputDirs = listOfNotNull(+ File(targetContext.filesDir, "ui-goldens"),+ targetContext.externalCacheDir?.let { File(it, "ui-goldens") },+ )+ outputDirs.forEach { outputDir ->+ outputDir.mkdirs()+ File(outputDir, "$goldenName.png").outputStream().use { stream ->+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)+ }}- assertTrue(goldenFile.exists())+ assertTrue(outputDirs.all { File(it, "$goldenName.png").exists() })+ instrumentation.uiAutomation+ .executeShellCommand(+ "cp ${outputDirs.last().absolutePath}/$goldenName.png " ++ "/sdcard/Download/streamvault-app-golden-$goldenName.png"+ )+ .close()return}diff --git a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.mdindex 57093768..ece8ef62 100644--- a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md+++ b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md@@ -961,8 +961,9 @@ feature checks, translated-resource parity audit, six reviewed feature goldenbaselines, connected suite, populated MultiView planner journey, and requiredtwo-channel long-playback protocol are recorded in[COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md](COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md).-The full fixture-dependent Home/EPG journey matrix, app-owned Live route golden,-and deferred performance/profile gates remain open. Catalog and System were not+The full fixture-dependent Home/EPG journey matrix and deferred+performance/profile gates remain open. The app-owned Live route golden was+reviewed and regenerated with its connected assertion passing. Catalog and System were notstarted; Playback, Provider, and Settings gates remain governed by theirseparate reports.diff --git a/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.mdindex fbbbad6d..1cab27b6 100644--- a/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md+++ b/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md@@ -47,8 +47,9 @@ following Live checkpoints (plus the final lint fix):## Verification- `:feature:live:verifyFeatureLiveBoundary`: passed.-- `:feature:live:connectedDebugAndroidTest`: passed after the final lint fix,- 13 tests, 0 failures, 0 errors, 0 skipped (54s test time). XML is under+- `:feature:live:connectedDebugAndroidTest`: final full-suite rerun passed 24+ tests, 0 failures, 0 errors, and 0 skipped (the original 13 tests plus the+ Home 6-test and Guide 5-test screen-host suites). XML is under`feature/live/build/outputs/androidTest-results/connected/debug/`.- `LivePresentationGoldenTest`: passed 6/6 at 1920x1080 after visual review.The checked-in feature baselines cover selection chips, locked/unlocked@@ -62,7 +63,7 @@ following Live checkpoints (plus the final lint fix):`:feature:live:check`, Android-test compilation, app unit tests/assembly, and`verifyBaselineProfileSources`): passed in 2m 35s (373 actionable tasks; 23executed, 2 from cache, 348 up-to-date).-- Graphify refreshed at 15,811 nodes, 30,815 edges, 435 communities. The+- Graphify refreshed at 15,831 nodes, 30,870 edges, 435 communities. Thelegacy app Home/EPG source directories and imports are absent.- The locale audit compared all 245 moved defaults and placeholder sequencesagainst every app locale. It corrected two mojibake feature defaults@@ -70,8 +71,14 @@ following Live checkpoints (plus the final lint fix):default or placeholder mismatch. All 25 translated feature locale files nowhave `featureMissing=0`, `featureValueMismatch=0`, and`featureUnexpected=0`; app copies remain for shared consumers.-- The existing app Live route golden remains open: exact pixel drift at `(0,0)`- from RGB `(6,16,26)` to `(7,17,27)`. The baseline was not rewritten.+- The app-owned Live route golden was reviewed and regenerated from a fresh+ 1920x1080 recorder capture after confirming the layout/content matched and+ the drift came from the current `AppColors.Canvas`/gradient palette. The+ non-recording `live_route_matchesGolden` assertion now passes 1/1.+- The extracted Home/Guide behavior coverage is now present in+ `HomeScreenBehaviorTest` (6 tests) and `EpgScreenBehaviorTest` (5 tests).+ These validate presentation-host contracts; they do not close the+ fixture-dependent ViewModel journey matrix below.## Runtime acceptance@@ -100,9 +107,10 @@ category (77 channels rendered), moved into the preview pane, and opened Guidethrough the top navigation. Valid PNG/XML artifacts are in`validation/phase5_live/task10-manual.md` and the adjacent`task10-manual/` directory. Touch taps on Guide `Program Search`/`Options` did-not change state on this emulator, and visible channels had no schedule data;-the exhaustive search/filter/PIN/favorite/reorder/reminder/recording/archive/-RTL/reduced-motion matrix therefore remains open. A second Enter handed the+not change state on this emulator, although both controls were later reached+through D-pad focus. Visible channels had no schedule data; the exhaustive+search/filter/PIN/reminder/recording/archive matrix therefore remains open. A+second Enter handed theselected Guide channel to the existing full-screen player; its overlay exposedEPG, Multiview, Stats, Record, and Pause, and Back returned to the Guide route.Activating Multiview returned to the Live route with the empty-favorites/queue@@ -110,18 +118,56 @@ state. A follow-up populated-planner journey switched to `All Channels`,long-pressed `01 00s Replay`, added it through the management dialog, assignedit to slot 1, launched MultiView, and returned with Back. The planner evidenceis under `validation/phase5_live/task10-multiview/`; the remaining manual matrix-is still fixture- or input-path-dependent.+is still fixture- or input-path-dependent. A follow-up fixture pass also+validated adding/removing two channels from Favorites and entering populated+Favorites reorder mode; the final device state was restored to zero favorites.+Quick-filter text entry remained unavailable through the emulator ADB input+path. The same fixture pass then opened the Movies `Lock Group` action and+reached the focused `Enter PIN` keypad; no PIN was submitted because the+configured value was unavailable, Back canceled the dialog, and Movies+remained unlocked (`live_lock_options.*`, `live_pin_dialog.*`, and+`live_after_pin_cancel.xml`).+The populated Favorites reorder path was also exercised: `00s Replay` was+grabbed and moved above the other fixture favorite with D-pad Up, then the+unsaved reorder was canceled and both favorites were removed; the final count+was zero (`live_reorder_dragging.xml`, `live_reorder_moved_up.xml`, and+`live_fav_restored_again.xml`).+The Save Order callback was also validated in a reversible round trip: the+swapped order was saved, the original order was restored and saved again, and+both favorites were removed (`live_save_order_saved.xml`,+`live_save_order_restored.xml`, and `live_save_order_final.xml`).++A further reversible device pass changed the locale from `en-US` to `ar-SA`:+Live TV and Guide stayed interactive, Arabic labels rendered, and the Live+sidebar plus Guide grid mirrored correctly before the locale was restored.+The three Android animation scales were then set to `0.0`; Guide remained+interactive through D-pad input with no app fatal marker in the bounded scan,+and all scales were restored to `1.0`. D-pad also opened Program Search and+Guide Options; Guide mode was switched and restored. The Compose text field+still did not accept ADB text input, and the loaded provider still exposed no+schedule rows. Screenshots and hierarchies are recorded in+`validation/phase5_live/task10-manual/`.++The planner edge follow-up populated two slots, removed slot 2, replaced the+occupied slot 1 with the pending channel, and used Clear All. The planner+dismissed as designed, and the final Live fixture state remained Favorites `0`+and All Channels `1,467`. Evidence is under+`validation/phase5_live/task10-multiview/`.## Open gates-- Full Home/EPG ViewModel-driven manual journey matrix (search, filters,- hidden/locked/favorite/reorder/PIN, reminders/recording conflicts, archive,- RTL/reduced-motion, focus restoration, and MultiView edge cases) remains- fixture-dependent and open.-- The feature presentation golden review is complete. The existing app Live- route golden remains open because its stored `(0,0)` pixel is RGB- `(6,16,26)` while the current render is `(7,17,27)`; that app baseline was- not rewritten.+- Full Home/EPG ViewModel-driven manual journey matrix (search, quick-filter+ mutation, PIN submission/unlock verification, reminders/recording conflicts,+ archive, focus restoration, and any still-unexercised MultiView cases)+ remains fixture-dependent and open. Hidden category/channel hide and restore+ paths, PIN-dialog reachability, RTL/reduced-motion smoke checks, and the+ core planner placement/removal/replacement/clear paths are covered in the+ follow-up fixture/device passes; PIN submission/unlock verification and the+ unavailable search/schedule branches remain open.+- The feature presentation golden review and the app-owned Live route golden+ review are complete. The app baseline was regenerated from the reviewed+ current capture; the old baseline is preserved as+ `route_live_browse_baseline_before.png` in the ignored follow-up evidence.- The formal paired performance target, clean/warm guardrails, andbaseline/startup profile regeneration are open. Fivepost-extraction Live source-edit and five moved-test samples are recorded indiff --git a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.mdindex f28f671a..ba5bc42a 100644--- a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md+++ b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md@@ -98,6 +98,7 @@ extraction, resource ownership cleanup, dependency audit, and open runtimegates. The Live implementation plan and report now document the Home/EPGextraction, translated-resource parity, reviewed feature goldens, connectedchecks, populated MultiView planner journey, and two-channel runtime evidence.-The exhaustive journey, app-route golden, and deferred performance/profile-gates remain explicit.+The exhaustive journey and deferred performance/profile gates remain explicit;+the app-route Live golden was reviewed and regenerated from the current+palette, with its connected assertion passing.Catalog and System remain unstarted.diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.mdindex 51b3b7c5..033290be 100644--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md@@ -596,7 +596,7 @@ Keep app originals unchanged for Dashboard, Movies, Series, Favorites, Search, a- [x] **Step 5: Review and check in golden baselines**-Render at 1920x1080, compare against pre-move screenshots, inspect focus borders/text/spacing manually, then add the reviewed PNGs. Rerun the connected class; expected PASS with the repository missing-golden guard still active. Completed 2026-08-29: six feature baselines reviewed and `LivePresentationGoldenTest` passed 6/6; the existing app route golden remains unchanged because its separate `(0,0)` drift is still open.+Render at 1920x1080, compare against pre-move screenshots, inspect focus borders/text/spacing manually, then add the reviewed PNGs. Rerun the connected class; expected PASS with the repository missing-golden guard still active. Completed 2026-08-29: six feature baselines reviewed and `LivePresentationGoldenTest` passed 6/6. The app-owned `live_route_matchesGolden` baseline was separately reviewed and regenerated from a fresh capture after confirming identical layout/content; its non-recording assertion passed 1/1.- [x] **Step 6: Verify source boundary and app consumers**@@ -693,16 +693,18 @@ Expected: PASS with the same behavioral assertions as the pre-extraction app suiObserved GREEN on 2026-08-29 for `com.streamvault.feature.live.home.*`; thefeature boundary verifier and app Kotlin/unit-test compilation also pass.-- [ ] **Step 5: Write failing Home screen behavior tests**+- [x] **Step 5: Add Home screen behavior tests**Cover route category initialization, source/category/channel focus, quick-filter visibility, search, Back/dialog ordering, PIN unlock, preview placeholder/loading/error/render states, stable channel semantics, and planner callbacks. The planner fake records `pendingChannel`, dismiss, and launch events without importing Playback.-Run `HomeScreenBehaviorTest`; expected missing-screen failure.+Run `HomeScreenBehaviorTest` against the extracted Home hosts.-`HomePresentationBehaviorTest` now provides connected coverage for extracted-channel identity/program/favorite/catch-up semantics, locked-row state, and-category rendering. The full ViewModel-driven Home journey (focus, dialogs,-PIN, preview states, and planner callbacks) remains open.+`HomeScreenBehaviorTest` now provides 6 connected tests for channel-content+loading/error/locked-empty/content branches, quick-filter callback delivery,+and stable channel-list rendering/visible-window reporting. Together with+`HomePresentationBehaviorTest`, this covers extracted Home presentation seams;+the full ViewModel-driven Home journey (route focus, dialogs, PIN submission,+preview transitions, and planner callbacks) remains fixture-dependent and open.- [x] **Step 6: Move Home UI and wire live-local/core components**@@ -896,15 +898,19 @@ Observed GREEN on 2026-08-29 for `com.streamvault.feature.live.epg.*`, withthe feature boundary verifier and app Kotlin/unit-test compilation alsopassing.-- [ ] **Step 6: Write failing EPG screen behavior tests**+- [x] **Step 6: Add EPG screen behavior tests**Cover route initialization, horizontal and vertical movement, stable channel/program semantics, category/mode/density/favorites/search controls, time/day/prime-time jumps, preview focus and handoff, program dialog, EPG override, PIN flow, reminder permission callback, recording conflict, live/archive callbacks, and Back/top-navigation restoration.-Run `EpgScreenBehaviorTest`; expected missing-screen failure.+Run `EpgScreenBehaviorTest` against the extracted Guide hosts.-`EpgPresentationBehaviorTest` now provides connected coverage for the-feature-owned Guide hero badge and actionable message-state rendering. The-full ViewModel-driven Guide journey remains open.+`EpgScreenBehaviorTest` now provides 5 connected tests for Guide toolbar+callback delivery, retry action, preview placeholder/no-schedule states, and+channel/program identity callbacks. Together with+`EpgPresentationBehaviorTest`, this covers extracted Guide presentation seams;+the full ViewModel-driven Guide journey (movement, controls, dialogs, PIN,+reminders/recording, archive, and Back restoration) remains fixture-dependent+and open.- [x] **Step 7: Move EPG presentation and deferred overlay**@@ -1166,8 +1172,10 @@ Expected: Live TV and EPG destinations open with argument compatibility; playerRecorded in `validation/phase5_live/task10-connected-validation.md`: AppNavigationContractTest 3/3 and PlatformCompatibilityMatrixTest 4/4 pass; the existing Live golden drift and PlayerSmokeTest's three pre-existing failures remain open neighboring gates.The complete feature suite was rerun on 2026-08-29 after the resource parity-fix: 13/13 tests passed with zero failures, errors, or skips. The result XML is-under `feature/live/build/outputs/androidTest-results/connected/debug/`.+fix: the original extracted suite passed 13/13. After adding the Home and EPG+screen-host behavior classes, the final full run passed 24/24 with zero+failures, errors, or skips. The result XML is under+`feature/live/build/outputs/androidTest-results/connected/debug/`.- [ ] **Step 4: Perform manual Live TV and EPG journeys**@@ -1179,8 +1187,27 @@ Completed partial planner coverage on 2026-08-29: the seeded emulator exposed`All Channels`, so `01 00s Replay` was long-pressed, added to the split-screenplanner, assigned to slot 1, launched, and returned with Back. Evidence is in`validation/phase5_live/task10-multiview/`. The broader search/filter/PIN/-recording/archive/RTL/reduced-motion matrix remains open because the loaded-fixture and TV input path do not expose all branches.+recording/archive matrix remains open because the loaded fixture and TV input+path do not expose all branches. A follow-up device pass now records Arabic+RTL rendering for Live TV and Guide, a reduced-motion D-pad smoke check with+animation scales at zero, and D-pad reachability for Program Search and Guide+Options; the search field still did not accept ADB text input.++Follow-up on 2026-08-29 also added and removed two fixture channels from+Favorites and entered populated Favorites reorder mode before restoring the+device to zero favorites. Quick-filter text entry did not work through the+emulator ADB input path. Hidden category/channel paths were exercised and+restored. The Movies `Lock Group` action also opened the focused `Enter PIN`+keypad; the configured PIN was unavailable, so Back canceled without changing+the lock state. Favorite movement and the Save Order callback were exercised in+a reversible round trip that restored the original order and zero favorites;+PIN submission/unlock verification and the other fixture-dependent branches+remain open.++The planner edge follow-up then populated two slots, removed slot 2, replaced+an occupied slot 1 with the pending channel, and exercised Clear All before+restoring Live TV with zero active slots. Evidence is under+`validation/phase5_live/task10-multiview/`.- [x] **Step 5: Capture channel 1 at two-second cadence**diff --git a/feature/live/src/androidTest/java/com/streamvault/feature/live/epg/EpgScreenBehaviorTest.kt b/feature/live/src/androidTest/java/com/streamvault/feature/live/epg/EpgScreenBehaviorTest.ktnew file mode 100644index 00000000..20f5a82a--- /dev/null+++ b/feature/live/src/androidTest/java/com/streamvault/feature/live/epg/EpgScreenBehaviorTest.kt@@ -0,0 +1,184 @@+package com.streamvault.feature.live.epg++import androidx.compose.foundation.rememberScrollState+import androidx.compose.ui.semantics.SemanticsActions+import androidx.compose.ui.test.assertIsDisplayed+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performSemanticsAction+import androidx.compose.ui.unit.dp+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.google.common.truth.Truth.assertThat+import com.streamvault.core.ui.theme.StreamVaultTheme+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.Program+import com.streamvault.feature.live.presentation.epg.GuideDensity+import com.streamvault.feature.live.presentation.epg.LiveGuideGridLabels+import com.streamvault.feature.live.presentation.epg.LiveGuideGridRow+import com.streamvault.feature.live.presentation.epg.LiveGuideMessageState+import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewLabels+import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewPane+import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarLabels+import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarRow+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class EpgScreenBehaviorTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun guideToolbar_dispatchesCategoryTimeSearchAndOptionsCallbacks() {+ val events = mutableListOf<String>()++ composeRule.setContent {+ StreamVaultTheme {+ LiveGuideToolbarRow(+ selectedCategoryName = "Sports",+ labels = LiveGuideToolbarLabels(+ jumpNow = "Now",+ search = "Search",+ options = "Options"+ ),+ onOpenCategoryPicker = { events += "category" },+ onJumpToNow = { events += "now" },+ onOpenSearch = { events += "search" },+ onOpenOptions = { events += "options" },+ onGuideInteract = {}+ )+ }+ }++ composeRule.onNodeWithText("Sports").performSemanticsAction(SemanticsActions.OnClick)+ composeRule.onNodeWithText("Now").performSemanticsAction(SemanticsActions.OnClick)+ composeRule.onNodeWithText("Search").performSemanticsAction(SemanticsActions.OnClick)+ composeRule.onNodeWithText("Options").performSemanticsAction(SemanticsActions.OnClick)++ assertThat(events).containsExactly("category", "now", "search", "options").inOrder()+ }++ @Test+ fun guideMessageState_dispatchesRetryAction() {+ var actionCount = 0++ composeRule.setContent {+ StreamVaultTheme {+ LiveGuideMessageState(+ title = "Guide unavailable",+ subtitle = "Try again later",+ actionLabel = "Retry",+ onAction = { actionCount++ }+ )+ }+ }++ composeRule.onNodeWithText("Guide unavailable").assertIsDisplayed()+ composeRule.onNodeWithText("Retry").performSemanticsAction(SemanticsActions.OnClick)++ assertThat(actionCount).isEqualTo(1)+ }++ @Test+ fun guidePreviewPane_rendersPlaceholderState() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveGuidePreviewPane(+ previewPlayerEngine = null,+ isPreviewLoading = false,+ focusedChannel = null,+ focusedProgram = null,+ labels = LiveGuidePreviewLabels(+ title = "Preview",+ placeholderTitle = "Select a channel",+ noSchedule = "No schedule"+ )+ )+ }+ }+ composeRule.onNodeWithText("Select a channel").assertIsDisplayed()+ }++ @Test+ fun guidePreviewPane_rendersFocusedChannelWithoutSchedule() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveGuidePreviewPane(+ previewPlayerEngine = null,+ isPreviewLoading = false,+ focusedChannel = testChannel(21L, "World News"),+ focusedProgram = null,+ labels = LiveGuidePreviewLabels(+ title = "Preview",+ placeholderTitle = "Select a channel",+ noSchedule = "No schedule"+ )+ )+ }+ }+ composeRule.onNodeWithText("21. World News").assertIsDisplayed()+ composeRule.onNodeWithText("No schedule").assertIsDisplayed()+ }++ @Test+ fun guideGridRow_preservesChannelProgramIdentityAndCallbacks() {+ val now = System.currentTimeMillis()+ val channel = testChannel(31L, "World News")+ val program = Program(+ channelId = "world-news",+ title = "Evening Bulletin",+ startTime = now + 5 * 60 * 1000L,+ endTime = now + 35 * 60 * 1000L+ )+ val events = mutableListOf<String>()++ composeRule.setContent {+ StreamVaultTheme {+ LiveGuideGridRow(+ channel = channel,+ isFavorite = true,+ programs = listOf(program),+ windowStart = now - 60 * 60 * 1000L,+ windowEnd = now + 3 * 60 * 60 * 1000L,+ channelRailWidth = 180.dp,+ timelineGap = 4.dp,+ timelineViewportWidth = 640.dp,+ totalTimelineWidth = 640.dp,+ density = GuideDensity.COMPACT,+ transparentOverlay = false,+ rowHeight = 40.dp,+ markerStepMs = 30 * 60 * 1000L,+ scrollState = rememberScrollState(),+ labels = LiveGuideGridLabels(+ noSchedule = "No schedule",+ archiveBadge = "Archive",+ favoriteBadge = "Favorite"+ ),+ onChannelClick = { events += "channel:${channel.id}" },+ onChannelFocused = {},+ onProgramClick = { events += "program:${it.title}" },+ onProgramFocused = {}+ )+ }+ }++ composeRule.onNodeWithText("31. World News")+ .assertIsDisplayed()+ .performSemanticsAction(SemanticsActions.OnClick)+ composeRule.onNodeWithText("Evening Bulletin")+ .assertIsDisplayed()+ .performSemanticsAction(SemanticsActions.OnClick)++ assertThat(events).containsExactly("channel:31", "program:Evening Bulletin").inOrder()+ }+}++private fun testChannel(id: Long, name: String) = Channel(+ id = id,+ name = name,+ number = id.toInt(),+ streamUrl = "https://example.test/$id.m3u8",+ epgChannelId = name.lowercase().replace(' ', '-')+)diff --git a/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomeScreenBehaviorTest.kt b/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomeScreenBehaviorTest.ktnew file mode 100644index 00000000..f7f6b480--- /dev/null+++ b/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomeScreenBehaviorTest.kt@@ -0,0 +1,210 @@+package com.streamvault.feature.live.home++import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.semantics.SemanticsActions+import androidx.compose.ui.test.assertIsDisplayed+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performSemanticsAction+import androidx.compose.ui.unit.dp+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.google.common.truth.Truth.assertThat+import com.streamvault.core.ui.theme.StreamVaultTheme+import com.streamvault.domain.model.ActiveLiveSource+import com.streamvault.domain.model.ActiveLiveSourceOption+import com.streamvault.domain.model.LiveTvQuickFilterVisibilityMode+import androidx.tv.material3.Text+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class HomeScreenBehaviorTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun channelContentHost_rendersLoadingState() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveChannelContentHost(+ isLoading = true,+ errorMessage = null,+ hasChannels = false,+ isBlockedCategorySearch = false,+ loadingLabel = "Loading channels",+ lockedLabel = "Locked",+ noChannelsLabel = "No channels",+ noChannelsSubtitle = "Try another category",+ channelContent = { Text("Channel content") }+ )+ }+ }+ composeRule.onNodeWithText("Loading channels").assertIsDisplayed()+ composeRule.onNodeWithText("Channel content").assertDoesNotExist()+ }++ @Test+ fun channelContentHost_rendersErrorState() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveChannelContentHost(+ isLoading = false,+ errorMessage = "Channel request failed",+ hasChannels = false,+ isBlockedCategorySearch = false,+ loadingLabel = "Loading channels",+ lockedLabel = "Locked",+ noChannelsLabel = "No channels",+ noChannelsSubtitle = "Try another category",+ channelContent = { Text("Channel content") }+ )+ }+ }+ composeRule.onNodeWithText("Channel request failed").assertIsDisplayed()+ }++ @Test+ fun channelContentHost_rendersLockedEmptyStateWithoutEmptyHints() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveChannelContentHost(+ isLoading = false,+ errorMessage = null,+ hasChannels = false,+ isBlockedCategorySearch = true,+ loadingLabel = "Loading channels",+ lockedLabel = "Locked",+ noChannelsLabel = "No channels",+ noChannelsSubtitle = "Try another category",+ additionalEmptyHint = "Add a favorite",+ channelContent = { Text("Channel content") }+ )+ }+ }+ composeRule.onNodeWithText("Locked").assertIsDisplayed()+ composeRule.onNodeWithText("No channels").assertDoesNotExist()+ composeRule.onNodeWithText("Add a favorite").assertDoesNotExist()+ }++ @Test+ fun channelContentHost_rendersChannelContentWhenChannelsExist() {+ composeRule.setContent {+ StreamVaultTheme {+ LiveChannelContentHost(+ isLoading = false,+ errorMessage = null,+ hasChannels = true,+ isBlockedCategorySearch = false,+ loadingLabel = "Loading channels",+ lockedLabel = "Locked",+ noChannelsLabel = "No channels",+ noChannelsSubtitle = "Try another category",+ channelContent = { Text("Channel content") }+ )+ }+ }+ composeRule.onNodeWithText("Channel content").assertIsDisplayed()+ }++ @Test+ fun categorySidebarHeader_quickFilterSelectionReachesHomeCallback() {+ val selectedFilters = mutableListOf<String>()+ val categorySearchFocusRequester = FocusRequester()++ composeRule.setContent {+ StreamVaultTheme {+ LiveCategorySidebarHeader(+ title = "Live TV",+ currentSource = ActiveLiveSource.ProviderSource(1L),+ sourceOptions = listOf(+ ActiveLiveSourceOption(+ source = ActiveLiveSource.ProviderSource(1L),+ title = "Fixture provider"+ )+ ),+ showSourceSwitcher = false,+ onSourceSelected = {},+ categorySearchQuery = "",+ onCategorySearchQueryChanged = {},+ categorySearchFocusRequester = categorySearchFocusRequester,+ categorySearchPlaceholder = "Search categories",+ quickFilterVisibilityMode = LiveTvQuickFilterVisibilityMode.ALWAYS_VISIBLE,+ savedCategoryFilters = listOf("Movies"),+ activeCategoryFilter = null,+ hiddenCategoriesButtonLabel = null,+ hiddenChannelsButtonLabel = null,+ quickFiltersButtonTitle = "Quick filters",+ quickFiltersTitle = "Saved filters",+ quickFiltersShowLabel = "Show",+ quickFiltersHideLabel = "Hide",+ quickFiltersShowingAllLabel = "Showing all categories",+ quickFiltersActiveLabel = "Filter active",+ quickFiltersManualSearchLabel = "Manual search",+ quickFiltersAllLabel = "All categories",+ quickFiltersEmptyLabel = "No saved filters",+ quickFiltersAddChipLabel = "Add quick filter",+ noSourceLabel = "No provider",+ selectedLabel = "Selected",+ unavailableLabel = "Unavailable",+ isReorderMode = false,+ onShowHiddenCategories = {},+ onShowHiddenChannels = {},+ onAddFilter = {},+ onAllSelected = {},+ onSavedFilterSelected = selectedFilters::add+ )+ }+ }++ composeRule.onNodeWithText("Quick filters")+ .performSemanticsAction(SemanticsActions.OnClick)+ composeRule.onNodeWithText("Movies")+ .performSemanticsAction(SemanticsActions.OnClick)++ assertThat(selectedFilters).containsExactly("Movies")+ }++ @Test+ fun channelListHost_rendersStableRowsAndReportsVisibleWindow() {+ val visibleWindows = mutableListOf<List<Long>>()+ val channels = listOf(+ testChannel(11L, "News"),+ testChannel(12L, "Sports")+ )++ composeRule.setContent {+ StreamVaultTheme {+ LiveChannelListHost(+ channels = channels,+ hasMoreChannels = false,+ isReorderMode = false,+ draggingChannel = null,+ focusedChannelId = null,+ channelFocusRequesters = mutableMapOf(),+ contentPaddingBottom = 8.dp,+ channelListSpacing = 4.dp,+ onDraggingChannelChange = {},+ onExitReorderMode = {},+ onMoveChannelUp = {},+ onMoveChannelDown = {},+ onVisibleChannelWindowChanged = { ids, _ -> visibleWindows += ids },+ onLoadMore = {},+ itemContent = { channel, _, _ -> Text("${channel.id}:${channel.name}") }+ )+ }+ }++ composeRule.onNodeWithText("11:News").assertIsDisplayed()+ composeRule.onNodeWithText("12:Sports").assertIsDisplayed()+ composeRule.waitUntil(timeoutMillis = 5_000) { visibleWindows.any { it.containsAll(listOf(11L, 12L)) } }+ }+}++private fun testChannel(id: Long, name: String) = com.streamvault.domain.model.Channel(+ id = id,+ name = name,+ number = id.toInt(),+ streamUrl = "https://example.test/$id.m3u8"+)