diff --git a/apps/web-e2e/src/stalker.e2e.ts b/apps/web-e2e/src/stalker.e2e.ts index 607c08b99..88a1b81ff 100644 --- a/apps/web-e2e/src/stalker.e2e.ts +++ b/apps/web-e2e/src/stalker.e2e.ts @@ -552,6 +552,44 @@ test('@stalker radio — stations use the inline audio player without EPG', asyn expect(epgRequests).toHaveLength(0); }); +test('@stalker radio playback survives a category switch', async ({ page }) => { + // Radio shares the ITV layout and the same context-panel handler that + // used to clear the selected item on every category click (#1517). The + // inline audio player is gated on that selection, so a category switch + // silenced the station the user never switched away from. + await addStalkerPortal(page); + + await page.getByRole('link', { name: /radio/i }).click(); + await page.waitForURL(/stalker.*radio/); + + const categories = page.locator('.category-item'); + await expect(categories.nth(2)).toBeVisible({ timeout: 10_000 }); + await categories.nth(1).click(); + + const sidebar = page.locator('app-stalker-live-stream-layout .sidebar'); + const sidebarTitle = sidebar.locator('.category-title'); + const stations = page.locator('[data-test-id="channel-item"]'); + await expect(stations.first()).toBeVisible({ timeout: 20_000 }); + const firstCategoryTitle = (await sidebarTitle.textContent())?.trim() ?? ''; + expect(firstCategoryTitle).not.toBe(''); + + await stations.first().click(); + await expect(stations.first()).toHaveClass(/active/, { timeout: 20_000 }); + const audioPlayer = page.locator('app-audio-player'); + await expect(audioPlayer).toBeVisible({ timeout: 20_000 }); + + await categories.nth(2).click(); + + // The sidebar re-filters to the new category (proves the click landed and + // change detection ran)… + await expect(sidebarTitle).not.toHaveText(firstCategoryTitle, { + timeout: 20_000, + }); + await expect(stations.first()).toBeVisible({ timeout: 20_000 }); + // …while the station picked from the previous category keeps playing. + await expect(audioPlayer).toBeVisible(); +}); + test('@stalker PWA skips bulk EPG across channel switches', async ({ page, }) => {