|
|
@@ -47,6 +47,40 @@ test("inbox panel closes on Escape inside it and on an outside pointer click", a
|
|
|
await expect(panel).toHaveCount(0)
|
|
|
})
|
|
|
|
|
|
+test("non-active completed chat is recovered from the task index after reload", async ({ page }) => {
|
|
|
+ const connect = async (apiKey: string) => {
|
|
|
+ await page.getByLabel("API Key", { exact: true }).fill(apiKey)
|
|
|
+ await page.getByRole("button", { name: "连接平台", exact: true }).click()
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).waitFor()
|
|
|
+ }
|
|
|
+ await page.goto("/e2e/paas/index.html?completed")
|
|
|
+ await connect("inbox-recover")
|
|
|
+ await page
|
|
|
+ .getByRole("button", { name: /已有研究/ })
|
|
|
+ .first()
|
|
|
+ .click()
|
|
|
+ await expect(page.getByRole("heading", { name: "研究计划", exact: true })).toBeVisible()
|
|
|
+ await expect(page.getByRole("button", { name: "待处理 1 项", exact: true })).toBeVisible()
|
|
|
+
|
|
|
+ // Switch to another chat with a saved draft so the completed chat is persisted but not active.
|
|
|
+ await page.locator(".paas-chat-header-actions").getByRole("button", { name: "新会话", exact: true }).click()
|
|
|
+ await expect(page.locator(".paas-topbar-chat-title")).toHaveText("新会话")
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).fill("让完成会话保持非活动")
|
|
|
+
|
|
|
+ await page.reload()
|
|
|
+ await connect("inbox-recover")
|
|
|
+ // The completed history is never opened here; its cache loads without messages.
|
|
|
+ await expect(page.locator(".paas-topbar-chat-title")).toHaveText("新会话")
|
|
|
+ await expect(page.getByRole("heading", { name: "研究计划", exact: true })).toHaveCount(0)
|
|
|
+
|
|
|
+ await page.locator(".paas-sidebar").getByRole("button", { name: "平台任务", exact: true }).click()
|
|
|
+ await expect(page.locator(".paas-task-title")).toHaveText("分析材料")
|
|
|
+ const inbox = page.getByRole("button", { name: "待处理 1 项", exact: true })
|
|
|
+ await expect(inbox).toBeVisible()
|
|
|
+ await inbox.click()
|
|
|
+ await expect(page.getByRole("dialog", { name: "待处理" }).getByRole("button", { name: /已有研究/ })).toBeVisible()
|
|
|
+})
|
|
|
+
|
|
|
test("opening an approval keeps it listed in inbox", async ({ page }) => {
|
|
|
await page.goto("/e2e/paas/index.html")
|
|
|
await page.getByLabel("API Key", { exact: true }).fill("inbox-approval")
|