test(e2e): expand smart-actions spec to 9 tests (G15)

This commit is contained in:
saravanakumardb1 2026-04-06 13:36:39 -07:00
parent 406153eeda
commit 63ee00037e

View File

@ -130,4 +130,70 @@ test.describe("Smart Actions", () => {
);
expect(realErrors).toHaveLength(0);
});
test("prompts page loads with template list", async ({ page }) => {
await page.goto("/prompts");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("body")).toBeVisible();
});
test("knowledge gaps page loads", async ({ page }) => {
await page.route("**/api/workspaces/ws-1/knowledge-gaps", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({ gaps: [], topicMap: {} }),
})
);
await page.goto("/workspaces/ws-1/gaps");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("body")).toBeVisible();
});
test("search page loads without JS errors", async ({ page }) => {
const errors: string[] = [];
page.on("pageerror", (err) => errors.push(err.message));
await page.goto("/search");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("body")).toBeVisible();
const realErrors = errors.filter(
(e) =>
!e.includes("fetch") &&
!e.includes("Failed") &&
!e.includes("Unexpected") &&
!e.includes("hydration")
);
expect(realErrors).toHaveLength(0);
});
test("workspaces page loads", async ({ page }) => {
await page.goto("/workspaces");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("body")).toBeVisible();
});
test("reviews page loads", async ({ page }) => {
await page.goto("/reviews");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("body")).toBeVisible();
});
test("history API mock returns items", async ({ page }) => {
await page.route("**/api/note-prompts/history**", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
items: [{ id: "h1", noteId: "n1", workspaceId: "ws1", toolName: "summarize", state: "applied", createdAt: "2026-01-01T00:00:00Z" }],
total: 1,
}),
})
);
const response = await page.request.get("/api/note-prompts/history?workspaceId=ws1");
expect(response.status()).toBe(200);
const data = await response.json();
expect(data.items).toHaveLength(1);
});
});