import { expect, type Page } from "@playwright/test"; /** Open the app and wait for the authenticated shell (the nav rail) to be ready. */ export async function openApp(page: Page, path = "/"): Promise { await page.goto(path); await expect(page.getByTestId("nav-feed")).toBeVisible(); } /** Click a top-level module in the nav rail and confirm it becomes the active page. */ export async function gotoPage(page: Page, id: string): Promise { await page.getByTestId(`nav-${id}`).click(); await expect(page.getByTestId(`nav-${id}`)).toHaveAttribute("aria-current", "page"); } /** Open the in-app player from the first feed card (clicks its thumbnail link). */ export async function openFirstVideo(page: Page): Promise { await expect(page.getByTestId("video-card").first()).toBeVisible(); await page.getByTestId("video-card").first().getByRole("link").first().click(); await expect(page.getByTestId("player-modal")).toBeVisible(); }