Publish EventLens v1.1.0 (#1)
This commit was merged in pull request #1.
This commit is contained in:
1 parent
c0ade21029
commit
87432f3283
63 files changed
+7381
-1420
No files matched your search
@@ -7,11 +7,13 @@ test("malformed successful analysis keeps the previous investigation", async ({
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await expect(page.getByRole("region", { name: "Current investigation context" })).toContainText("bundled-demo");
|
||||
|
||||
await page.route("**/api/analyze", (route) => route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "bad.evtx", events: [], incidents: [{ id: "broken" }] }),
|
||||
}));
|
||||
await page.route("**/api/analyze", (route) =>
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "bad.evtx", events: [], incidents: [{ id: "broken" }] }),
|
||||
}),
|
||||
);
|
||||
await page.locator('input[type="file"]').setInputFiles(validUpload);
|
||||
|
||||
await expect(page.getByRole("alert")).toContainText("Analysis returned an invalid response.");
|
||||
@@ -21,11 +23,15 @@ test("malformed successful analysis keeps the previous investigation", async ({
|
||||
});
|
||||
|
||||
test("structured parser errors have safe, useful wording", async ({ page }) => {
|
||||
await page.route("**/api/analyze", (route) => route.fulfill({
|
||||
status: 422,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ detail: { code: "no_readable_events", message: "No readable Windows events were found in this file." } }),
|
||||
}));
|
||||
await page.route("**/api/analyze", (route) =>
|
||||
route.fulfill({
|
||||
status: 422,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
detail: { code: "no_readable_events", message: "No readable Windows events were found in this file." },
|
||||
}),
|
||||
}),
|
||||
);
|
||||
await page.goto("/#analysis");
|
||||
await page.locator('input[type="file"]').setInputFiles(validUpload);
|
||||
|
||||
@@ -40,13 +46,21 @@ test("rejecting an invalid file cancels an older pending analysis", async ({ pag
|
||||
|
||||
let routeStarted!: () => void;
|
||||
let releaseRoute!: () => void;
|
||||
const started = new Promise<void>((resolve) => { routeStarted = resolve; });
|
||||
const released = new Promise<void>((resolve) => { releaseRoute = resolve; });
|
||||
const started = new Promise<void>((resolve) => {
|
||||
routeStarted = resolve;
|
||||
});
|
||||
const released = new Promise<void>((resolve) => {
|
||||
releaseRoute = resolve;
|
||||
});
|
||||
await page.route("**/api/analyze", async (route) => {
|
||||
routeStarted();
|
||||
await released;
|
||||
try {
|
||||
await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ source: "late.evtx", events: [], incidents: [] }) });
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "late.evtx", events: [], incidents: [] }),
|
||||
});
|
||||
} catch {
|
||||
// The route can already be cancelled by the browser request abort.
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user