From 7d7e2c6146223321515073c776e51d08111f66df Mon Sep 17 00:00:00 2001 From: npeter83 Date: Sat, 18 Jul 2026 18:27:17 +0200 Subject: [PATCH] test(e2e): lock the channel content-filter inherit + no-leak (bug 2) Add feed-content- testids to the toolbar's content pills and two channel specs: the channel view inherits the feed's Live/Upcoming both ways, and a content toggle made in the channel view does not leak back into the feed. --- frontend/e2e/channel.spec.ts | 45 ++++++++++++++++++++++++++++++++ frontend/src/components/Feed.tsx | 1 + 2 files changed, 46 insertions(+) diff --git a/frontend/e2e/channel.spec.ts b/frontend/e2e/channel.spec.ts index ae8b3c1..586e615 100644 --- a/frontend/e2e/channel.spec.ts +++ b/frontend/e2e/channel.spec.ts @@ -56,6 +56,51 @@ test.describe("channel view", () => { .toBeGreaterThan(saved - 500); }); + // Bug 2 (Platform S5): opening a channel no longer FORCES Live/Upcoming on — the channel view + // seeds its content-type prefs (normal / shorts / live) from the global feed. Locked both ways so + // a future refactor can't silently re-hardcode it. + test("the channel view inherits the feed's content filters (no forced Live/Upcoming)", async ({ page }) => { + await openApp(page); + await expect(page.getByTestId("video-card").first()).toBeVisible(); + const feedLive = page.getByTestId("feed-content-includeLive"); + await expect(feedLive).toHaveAttribute("aria-pressed", "false"); + + // Inherit OFF: the channel toolbar's Live/Upcoming stays off, not forced on. + await page.getByTestId("video-card-channel").first().click(); + await expect(page.getByTestId("channel-title")).toBeVisible(); + await expect(page.getByTestId("feed-content-includeLive")).toHaveAttribute("aria-pressed", "false"); + await page.getByTestId("channel-back").click(); + await expect(page.getByTestId("channel-title")).toHaveCount(0); + + // Inherit ON: flip the feed's Live/Upcoming on, reopen the channel → it inherits the on state. + await feedLive.click(); + await expect(feedLive).toHaveAttribute("aria-pressed", "true"); + await expect(page.getByTestId("video-card").first()).toBeVisible(); + await page.getByTestId("video-card-channel").first().click(); + await expect(page.getByTestId("channel-title")).toBeVisible(); + await expect(page.getByTestId("feed-content-includeLive")).toHaveAttribute("aria-pressed", "true"); + }); + + // Bug 2 (Platform S5): the channel view is its OWN filter scope — a content toggle made there + // must NOT leak back into the global feed. (FeedFiltersProvider owns the feed's filters; the + // channel page keeps a separate local cell.) + test("a channel's content toggle does not leak into the feed", async ({ page }) => { + await openApp(page); + await expect(page.getByTestId("video-card").first()).toBeVisible(); + await expect(page.getByTestId("feed-content-includeLive")).toHaveAttribute("aria-pressed", "false"); + + // Turn Live/Upcoming ON inside the channel view. + await page.getByTestId("video-card-channel").first().click(); + await expect(page.getByTestId("channel-title")).toBeVisible(); + await page.getByTestId("feed-content-includeLive").click(); + await expect(page.getByTestId("feed-content-includeLive")).toHaveAttribute("aria-pressed", "true"); + + // Back on the feed, its Live/Upcoming is still off — the channel's change stayed local. + await page.getByTestId("channel-back").click(); + await expect(page.getByTestId("channel-title")).toHaveCount(0); + await expect(page.getByTestId("feed-content-includeLive")).toHaveAttribute("aria-pressed", "false"); + }); + // Platform S4b: the whole channel chrome (banner, identity, tabs, toolbar) is fixed — it stays // put while only the video grid scrolls. test("the channel chrome stays fixed while the video grid scrolls", async ({ page }) => { diff --git a/frontend/src/components/Feed.tsx b/frontend/src/components/Feed.tsx index da29247..c0b10d1 100644 --- a/frontend/src/components/Feed.tsx +++ b/frontend/src/components/Feed.tsx @@ -544,6 +544,7 @@ export default function Feed({ return (