import type { Page } from "@playwright/test"; // The Options / Advanced disclosures (components/ui/disclosure.tsx, lane/ui-simplify): a control // folded into one is clicked after the panel is opened. `id` narrows to one page's panel ("cut", // "take-card", "play"); without it every folded panel of that kind on the page opens. export async function openPanel(page: Page, kind: "options" | "advanced", id?: string) { const sel = `details[data-panel-disclosure="${kind}"]${id ? `[data-panel-id="${id}"]` : ""}`; await page.locator(sel).first().waitFor({ state: "attached" }); const n = await page.locator(sel).count(); for (let i = 0; i < n; i++) { const d = page.locator(sel).nth(i); if (!(await d.evaluate((el) => (el as HTMLDetailsElement).open))) await d.locator(":scope > summary").click(); } }