Files
2026-11-20 12:20:18 +00:00

38 lines
1.5 KiB
TypeScript

import { expect, test } from "@playwright/test";
function largeAnalysis(count: number) {
return {
source: "synthetic-large.evtx",
events: Array.from({ length: count }, (_, index) => ({
id: String(index),
timestamp: "2026-09-09T10:00:00Z",
timestamp_source: "event",
timestamp_valid: true,
provider: "Synthetic Provider",
event_id: index,
level: "warning",
channel: "Application",
computer: "TEST-PC",
category: "other",
summary: `Synthetic event ${index}`,
fields: { message: `Synthetic event ${index}` },
})),
incidents: [],
};
}
test("large timelines virtualize DOM rows and keep search usable", async ({ page }) => {
const analysis = largeAnalysis(10_000);
await page.route("**/api/demo", (route) =>
route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(analysis) }),
);
await page.goto("/#analysis");
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
await expect(page.getByText("10,000", { exact: false }).first()).toBeVisible();
expect(await page.locator(".event-row").count()).toBeLessThan(80);
await page.getByRole("button", { name: "Timeline", exact: false }).click();
await page.getByRole("textbox", { name: "Search normalized evidence" }).fill("Synthetic event 9999");
await expect(page.locator(".event-row")).toHaveCount(1);
await expect(page.locator(".event-row").first()).toContainText("9999");
});