${title}
Loading conversation
' : 'Saved note is ready
'}import { expect, test } from "@playwright/test";
import { captureLoadedContinuation } from "./continuation-screenshot.js";
const shell = (busy: boolean, title = "Continuation example") => `
Saved note is ready
${busy ? '${title}
Loading conversation' : '
App loading
`); let captured = ""; await captureLoadedContinuation(page, "Continuation example", async () => { captured = await page.locator("body").innerText(); await page.screenshot(); }, 3000); expect(captured).toContain("Saved note is ready"); expect(captured).not.toContain("Loading"); }); for (const state of ["app-loader", "history-loader", "wrong-task"] as const) { test(`does not capture ${state} as a successful checkpoint`, async ({ page }) => { await page.setContent(state === "app-loader" ? "App loading
" : shell(state === "history-loader", state === "wrong-task" ? "Unrelated task" : undefined)); let captures = 0; await expect(captureLoadedContinuation(page, "Continuation example", async () => { captures++; }, 250)).rejects.toThrow(); expect(captures).toBe(0); }); }