import { expect, test } from "@playwright/test"; test("demo investigation workflow crosses Analysis, Timeline and Reports", async ({ page }) => { await page.goto("/#analysis"); await expect(page.getByRole("heading", { name: "No event log loaded", exact: true })).toBeVisible(); await page.getByRole("button", { name: "Load demo", exact: true }).first().click(); await expect(page.getByRole("region", { name: "Current investigation context" }).getByText("bundled-demo", { exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Incident windows", exact: true })).toBeVisible(); await expect(page.getByText("Analysis status", { exact: true })).toBeVisible(); await expect(page.getByText("Deterministic demo fixture", { exact: true })).toBeVisible(); await expect(page.getByText("Current source", { exact: true })).toHaveCount(0); await expect(page.getByText("How to continue", { exact: true })).toBeVisible(); await page.getByText("Service failure recorded", { exact: true }).click(); await expect(page).toHaveURL(/#timeline$/); await expect(page.getByRole("heading", { name: "Event timeline", exact: true })).toBeVisible(); await expect(page.getByRole("heading", { name: "Example Sync Service terminated unexpectedly", exact: true })).toBeVisible(); await expect(page.getByText("Focus active", { exact: true })).toBeVisible(); const search = page.getByRole("textbox", { name: "Search normalized evidence" }); await search.fill("DNS name resolution"); await expect(page.locator(".event-row")).toHaveCount(0); await search.fill(""); await page.getByRole("button", { name: "Stop focus", exact: true }).click(); await page.getByLabel("Filter by category").selectOption("network"); await expect(page.locator(".event-row")).toHaveCount(1); await page.getByLabel("Filter by category").selectOption(""); await page.getByRole("button", { name: /Next evidence/ }).click(); await expect(page.getByText(/of [0-9]+/).first()).toBeVisible(); await page.getByRole("button", { name: "Reports", exact: false }).click(); await expect(page.getByRole("heading", { name: "Export report", exact: true })).toBeVisible(); await expect(page.getByText("Redaction preview", { exact: true })).toBeVisible(); const jsonDownload = page.waitForEvent("download"); await page.getByRole("button", { name: "Export JSON", exact: true }).click(); expect((await jsonDownload).suggestedFilename()).toMatch(/eventlens\.json$/); const markdownDownload = page.waitForEvent("download"); await page.getByRole("button", { name: "Export Markdown", exact: true }).click(); expect((await markdownDownload).suggestedFilename()).toMatch(/eventlens\.md$/); });