fix: unify chat process and reply presentation

This commit is contained in:
2026-10-29 17:54:34 +08:00
parent 7621bf0f86
commit 9474788db6
46 changed files with 3160 additions and 500 deletions
+18 -5
View File
@@ -79,7 +79,7 @@ for (const width of [1440, 375, 320]) {
const composer = page.getByRole("textbox", { name: "询问供水问题,或描述需要处理的任务" });
await composer.fill("核对压力变化");
await page.getByRole("button", { name: "发送 Agent 指令" }).click();
const deliveryMode = page.getByRole("button", { name: "运行中消息发送方式" });
const deliveryMode = page.getByRole("button", { name: "消息发送方式", exact: true });
await expect(deliveryMode).toHaveText("引导");
await deliveryMode.focus();
await page.keyboard.press("ArrowDown");
@@ -93,12 +93,21 @@ for (const width of [1440, 375, 320]) {
await expect(deliveryMode).toBeFocused();
await expect(deliveryMode).toHaveText("引导");
await expect(page.getByRole("button", { name: "停止 Agent 指令" })).toBeVisible();
const stopButton = page.getByRole("button", { name: "停止 Agent 指令" });
await expectThemeColor(stopButton, "background-color", "--status-danger-soft");
await expectThemeColor(stopButton, "color", "--status-danger-foreground");
await stopButton.hover();
await expectThemeColor(stopButton, "background-color", "--status-danger-border");
await page.locator("form.agent-panel-input-form").screenshot({ path: testInfo.outputPath("stop-action-hover.png"), animations: "disabled" });
const actionSlot = await page.getByRole("button", { name: "停止 Agent 指令" }).boundingBox();
await composer.fill("补充当前任务");
await expect(page.getByRole("button", { name: "停止 Agent 指令" })).toHaveCount(0);
const sendSlot = await page.getByRole("button", { name: "引导当前 Agent 任务" }).boundingBox();
expect(sendSlot).toEqual(actionSlot);
await page.getByRole("button", { name: "引导当前 Agent 任务" }).click();
const sendButton = page.getByRole("button", { name: "引导当前 Agent 任务" });
await expect(sendButton).toHaveAttribute("data-agent-action", "send");
expect(await sendButton.boundingBox()).toEqual(actionSlot);
await expect(page.getByRole("button", { name: "权限批准模式" })).toHaveText("请求批准");
await page.locator("form.agent-panel-input-form").screenshot({ path: testInfo.outputPath("streaming-composer-with-draft.png"), animations: "disabled" });
await sendButton.click();
const queue = page.getByRole("list", { name: "待处理消息" });
const pendingRow = queue.getByRole("listitem").filter({ hasText: "补充当前任务" });
const pendingMode = pendingRow.getByRole("button", { name: "消息操作:补充当前任务" });
@@ -131,7 +140,11 @@ for (const width of [1440, 375, 320]) {
const expandMessage = longRow.getByRole("button", { name: "展开全文" });
await expect(expandMessage).toBeVisible();
await expect(expandMessage).toHaveAttribute("aria-expanded", "false");
await expect(page.locator("form").getByRole("list", { name: "待处理消息" })).toBeVisible();
await expect(queue).toBeVisible();
await expect(page.locator("form").getByRole("list", { name: "待处理消息" })).toHaveCount(0);
const queueBox = (await page.getByRole("region", { name: "待处理消息队列" }).boundingBox())!;
const editorBox = (await page.locator("form").boundingBox())!;
expect(queueBox.y + queueBox.height).toBeLessThanOrEqual(editorBox.y);
await page.screenshot({ path: testInfo.outputPath("pending-messages-compact.png"), animations: "disabled" });
await expandMessage.click();
await expect(longRow.getByRole("button", { name: "收起全文" })).toHaveAttribute("aria-expanded", "true");