import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { describe, expect, it } from "vitest"; import { Workbench } from "../../src/components/Workbench"; describe("authentication workbench", () => { it("switches independent workspaces and clears sensitive session state", async () => { const user = userEvent.setup(); render(); expect( screen.getByRole("heading", { name: "Credential parameters" }), ).toBeInTheDocument(); await user.click(screen.getByRole("button", { name: /OCRA challenge/iu })); expect( screen.getByRole("heading", { name: "OCRA suite and key" }), ).toBeInTheDocument(); await user.click( screen.getByRole("button", { name: /WebAuthn \/ Passkeys/iu }), ); expect( screen.getByRole("heading", { name: "WebAuthn structure" }), ).toBeInTheDocument(); await user.click(screen.getByRole("button", { name: "Clear session" })); expect( screen.getByRole("heading", { name: "WebAuthn structure" }), ).toBeInTheDocument(); }); it("keeps live ceremonies disabled on the shared/non-dedicated origin", async () => { const user = userEvent.setup(); render(); await user.click( screen.getByRole("button", { name: /WebAuthn \/ Passkeys/iu }), ); await user.click(screen.getByRole("button", { name: "Live ceremony" })); expect(screen.getByText("Inspect only")).toBeInTheDocument(); expect( screen.getByRole("button", { name: "Create test credential" }), ).toBeDisabled(); }); });