import { test, expect } from "@playwright/test"; import { openApp, openFirstVideo } from "./helpers"; // Locks the in-app player's open/close contract. The player is a portaled overlay whose // inconsistent mounting caused an E3 regression — exactly the kind of thing the refactor's // overlay-root convention must not break. We assert the modal shell, not YouTube playback. test.describe("player modal", () => { test.beforeEach(async ({ page }) => { // Hermetic: don't actually load the YouTube iframe/player. await page.route(/youtube\.com/, (route) => route.abort()); }); test("opens from a card and closes via the close button", async ({ page }) => { await openApp(page); await openFirstVideo(page); await page.getByTestId("player-close").click(); await expect(page.getByTestId("player-modal")).toHaveCount(0); }); test("closes on Escape", async ({ page }) => { await openApp(page); await openFirstVideo(page); await page.keyboard.press("Escape"); await expect(page.getByTestId("player-modal")).toHaveCount(0); }); });