test(e2e): lock the channel content-filter inherit + no-leak (bug 2)

Add feed-content-<key> 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.
This commit is contained in:
2026-07-18 18:27:17 +02:00
parent ae7d893a3e
commit 7d7e2c6146
2 changed files with 46 additions and 0 deletions
+45
View File
@@ -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 }) => {
+1
View File
@@ -544,6 +544,7 @@ export default function Feed({
return (
<button
key={c.key}
data-testid={`feed-content-${c.key}`}
onClick={() => setFilters({ ...filters, [c.key]: !on })}
aria-pressed={on}
className={`text-xs px-3 py-1.5 rounded-full border transition ${