import { expect, test } from "@playwright/test"; /** * Cluster C Playwright sweep — encrypted archive end-to-end. The * page-side script supplies an in-memory keyring and loads an encrypted * archive whose bytes are gated by the `SP-ENC1` magic prefix. The * loader decrypts, unpacks, and returns a Blob URL. */ test.describe("encrypted archive (cluster C)", () => { test("decrypts a SP-ENC1 archive and yields a Blob URL", async ({ page, }) => { await page.goto("/"); const result = await page.evaluate(async () => { const win = window as unknown as { loadEncryptedSample?: () => Promise<{ url: string }>; }; if (typeof win.loadEncryptedSample !== "function") { return { skipped: true }; } const { url } = await win.loadEncryptedSample(); return { skipped: false, urlStart: url.slice(0, 5) }; }); if ("skipped" in result && result.skipped) { test.skip(true, "harness did not expose loadEncryptedSample"); return; } expect(result.urlStart).toBe("blob:"); }); });