feat: refactor artifact analysis workspace

This commit is contained in:
2026-08-19 16:09:51 +08:00
parent bfadc95f93
commit d2f2895c36
26 changed files with 998 additions and 2278 deletions
+24 -31
View File
@@ -1,52 +1,45 @@
import { expect, test } from "@playwright/test";
import { mockAgentApi } from "./support/mock-agent-api";
test("unified workbench navigation collapses and restores the main workspace", async ({ page }) => {
test("the docked Agent collapses and restores the main workspace", async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
const navigation = page.getByRole("complementary", { name: "工作台导航" });
const agentPanel = page.getByRole("complementary", { name: "Agent 命令面板" });
const workspace = page.locator("#main-workspace");
await expect(navigation).toHaveCSS("width", "368px");
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(368);
const expandedWidth = Math.round((await agentPanel.boundingBox())?.width ?? 0);
expect(expandedWidth).toBeGreaterThan(400);
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(expandedWidth);
await page.getByRole("button", { name: "折叠工作台导航" }).click();
await expect(navigation).toHaveCSS("width", "48px");
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(48);
await page.getByRole("button", { name: "折叠 Agent 面板" }).click();
await expect(page.getByLabel("Agent 折叠栏")).toBeVisible();
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(72);
await page.getByRole("button", { name: "展开工作台导航" }).click();
await expect(navigation).toHaveCSS("width", "368px");
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(368);
await page.getByLabel(/展开 Agent 助手面板/).click();
await expect(agentPanel).toBeVisible();
await expect.poll(async () => Math.round((await workspace.boundingBox())?.x ?? 0)).toBe(expandedWidth);
});
test("unified navigation switches between Agent and condition panes", async ({ page }) => {
test("the floating condition feed coordinates with the docked Agent", async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
const mainFrame = page.getByTestId("workbench-main-frame");
await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeVisible();
const prompt = page.getByPlaceholder("输入调度问题,Agent 将通过后端会话流式响应");
await prompt.fill("保留尚未发送的诊断问题");
await mainFrame.getByRole("button", { name: "工况任务", exact: true }).click();
const conditionPanel = page.getByRole("region", { name: "工况任务", exact: true });
await expect(conditionPanel).toBeVisible();
await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeHidden();
await conditionPanel.getByRole("button", { name: "展开工况任务" }).click();
await expect(conditionPanel.getByRole("button", { name: "收起工况任务" })).toBeVisible();
await conditionPanel.getByRole("button", { name: "收起工况任务" }).click();
await mainFrame.getByRole("button", { name: "Agent", exact: true }).click();
await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeVisible();
await expect(prompt).toHaveValue("保留尚未发送的诊断问题");
const topBarConditionToggle = page
const conditionToggle = page
.locator("header.acrylic-navigation")
.getByRole("button", { name: "工况任务", exact: true });
await page.getByRole("button", { name: "折叠工作台导航" }).click();
await expect(page.getByRole("complementary", { name: "工作台导航" })).toHaveCSS("width", "48px");
await topBarConditionToggle.click();
await expect(page.getByRole("complementary", { name: "工作台导航" })).toHaveCSS("width", "368px");
await expect(page.getByRole("region", { name: "工况任务", exact: true })).toBeVisible();
await topBarConditionToggle.click();
await conditionToggle.click();
const conditionPanel = page.getByRole("region", { name: "工况任务", exact: true });
await expect(conditionPanel).toBeVisible();
await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeVisible();
await conditionPanel.getByRole("button", { name: "展开工况任务" }).click();
await expect(page.getByLabel("Agent 折叠栏")).toBeVisible();
await expect(conditionPanel.getByRole("button", { name: "收起工况任务" })).toBeVisible();
await conditionPanel.getByRole("button", { name: "收起工况任务" }).click();
await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeVisible();
await expect(prompt).toHaveValue("保留尚未发送的诊断问题");
await conditionToggle.click();
await expect(conditionPanel).toBeHidden();
});
test("Agent resize handle stays hidden in the mobile layout", async ({ page }) => {