From 9455e0db6550ecbf2c46da346e762167d848df29 Mon Sep 17 00:00:00 2001 From: 4gray <4gray@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:27:15 +0200 Subject: [PATCH] test(stalker): cover radio playback surviving a category switch in web E2E (#1522) The E2E added in #1517 proved the ITV case only. Radio shares the live layout and the same context-panel handler, and its inline audio player is gated on the store selection just like the ITV player, so a regression in `onStalkerCategoryClicked` would silence a station the user never switched away from. The new scenario mirrors the ITV one: play a station, pick another category, wait for the sidebar title to change, and assert the audio player is still mounted. Closes #1521 Co-authored-by: Claude Fable 5.1 --- apps/web-e2e/src/stalker.e2e.ts | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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, }) => {