feat: add workspace task view
This commit is contained in:
@@ -87,6 +87,37 @@ test("the test control cycles through three trusted document profiles", async ({
|
||||
await expect(page.getByText("3 / 6 个临时分析窗")).toBeVisible();
|
||||
});
|
||||
|
||||
test("task view shows every window and fills the workspace with the selected one", async ({ page }) => {
|
||||
await prepareMainFrame(page);
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
const testButton = page.getByRole("button", { name: "测试打开 Agent 多图表窗口" }).first();
|
||||
|
||||
await testButton.click();
|
||||
await testButton.click();
|
||||
await openWindowOperationMenu(page, "北辰分区压力异常诊断");
|
||||
await page.getByRole("menuitem", { name: "最小化" }).click();
|
||||
await page.getByRole("button", { name: "任务视图" }).click();
|
||||
|
||||
await expect(page.getByRole("dialog", { name: "任务视图" })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: /打开供水管网地图并铺满主视图/ })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: /打开北辰分区压力异常诊断并铺满主视图,当前已最小化/ })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: /打开供水服务分区平衡分析并铺满主视图/ })).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: /打开供水服务分区平衡分析并铺满主视图/ }).click();
|
||||
await expect(page.getByRole("dialog", { name: "任务视图" })).toHaveCount(0);
|
||||
const workspaceBox = await page.locator("#main-workspace").boundingBox();
|
||||
const selectedBox = await page.locator("section[aria-label='供水服务分区平衡分析']").boundingBox();
|
||||
expect(workspaceBox).not.toBeNull();
|
||||
expect(selectedBox).not.toBeNull();
|
||||
expect(Math.abs(selectedBox!.width - workspaceBox!.width)).toBeLessThanOrEqual(2);
|
||||
expect(Math.abs(selectedBox!.height - workspaceBox!.height)).toBeLessThanOrEqual(2);
|
||||
|
||||
await page.getByRole("button", { name: "任务视图" }).click();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByRole("dialog", { name: "任务视图" })).toHaveCount(0);
|
||||
await expect(page.getByRole("button", { name: "任务视图" })).toBeFocused();
|
||||
});
|
||||
|
||||
test("temporary documents survive a mobile breakpoint round trip", async ({ page }) => {
|
||||
await prepareMainFrame(page);
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
@@ -113,8 +144,7 @@ test("layout presets arrange transient windows and keep the map visible", async
|
||||
await testButton.click();
|
||||
await testButton.click();
|
||||
await testButton.click();
|
||||
await page.getByRole("button", { name: "设置窗口布局,当前自由排列" }).click();
|
||||
await page.getByRole("menuitemradio", { name: /主次/ }).click();
|
||||
await applyTaskViewLayout(page, "主次");
|
||||
|
||||
const workspace = page.locator("#main-workspace");
|
||||
await expect(workspace).toHaveAttribute("data-layout-mode", "primary");
|
||||
@@ -140,8 +170,7 @@ test("dragging a small window onto the primary window swaps their complete slots
|
||||
await prepareMainFrame(page);
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
await page.getByRole("button", { name: "测试打开 Agent 多图表窗口" }).first().click();
|
||||
await page.getByRole("button", { name: "设置窗口布局,当前自由排列" }).click();
|
||||
await page.getByRole("menuitemradio", { name: /主次/ }).click();
|
||||
await applyTaskViewLayout(page, "主次");
|
||||
|
||||
const mapWindow = page.locator("#workspace-map");
|
||||
const analysisWindow = page.locator("section[aria-label='北辰分区压力异常诊断']");
|
||||
@@ -177,8 +206,7 @@ test("dropping on blank workspace exits auto layout and Escape cancels a drag",
|
||||
await prepareMainFrame(page);
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
await page.getByRole("button", { name: "测试打开 Agent 多图表窗口" }).first().click();
|
||||
await page.getByRole("button", { name: "设置窗口布局,当前自由排列" }).click();
|
||||
await page.getByRole("menuitemradio", { name: /双栏/ }).click();
|
||||
await applyTaskViewLayout(page, "双栏");
|
||||
|
||||
const workspace = page.locator("#main-workspace");
|
||||
const analysisWindow = page.locator("section[aria-label='北辰分区压力异常诊断']");
|
||||
@@ -214,6 +242,11 @@ async function openWindowOperationMenu(page: Page, title: string) {
|
||||
await page.getByRole("button", { name: `打开${title}窗口操作` }).click();
|
||||
}
|
||||
|
||||
async function applyTaskViewLayout(page: Page, layoutName: string) {
|
||||
await page.getByRole("button", { name: "任务视图" }).click();
|
||||
await page.getByRole("button", { name: new RegExp(`^${layoutName}:`) }).click();
|
||||
}
|
||||
|
||||
async function prepareMainFrame(page: Page) {
|
||||
await mockAgentApi(page);
|
||||
await page.route("**/runtime-config.js", async (route) => {
|
||||
|
||||
Reference in New Issue
Block a user