fix(workbench): leave completed no-final response empty

This commit is contained in:
lyon
2026-06-19 03:46:37 +08:00
parent 37e4440b04
commit c44461cc35
3 changed files with 133 additions and 5 deletions
@@ -18,6 +18,31 @@ test("SSE terminal event and REST gap fill replay to the same terminal UI", asyn
await expect(page.locator(`${selectors.traceTimeline}[data-status="completed"]`)).toBeVisible();
});
test.describe("terminal completed without final response", () => {
test.use({ scenarioId: "terminal-completed-no-final-response" });
test("keeps the assistant final response area empty", async ({ page }, testInfo) => {
await gotoWorkbench(page);
const agentCard = page.locator(`${selectors.messageCard}[data-role="agent"]`).last();
await expect(agentCard).toHaveAttribute("data-status", "running");
await expect(agentCard).toHaveAttribute("data-status", "completed");
await expect(page.locator(`${selectors.traceTimeline}[data-status="completed"]`)).toBeVisible();
const snapshot = await agentCard.evaluate((element) => {
const placeholder = "Code Agent 已完成,但没有返回可展示的 final response。";
return {
status: element.getAttribute("data-status"),
messageTexts: Array.from(element.querySelectorAll(".message-markdown.message-text")).map((item) => (item.textContent ?? "").trim()),
bodyHasPlaceholder: document.body.textContent?.includes(placeholder) === true
};
});
expect(snapshot.status).toBe("completed");
expect(snapshot.messageTexts.filter(Boolean)).toEqual([]);
expect(snapshot.bodyHasPlaceholder).toBe(false);
await saveScreenshot(page, testInfo, "terminal-completed-no-final-response");
});
});
test("fresh deep link replays completed turn from the session authority", async ({ page }, testInfo) => {
const detail = await page.request.get("/v1/workbench/sessions/ses_completed");
expect(detail.status()).toBe(200);