fix: improve mobile workbench controls

This commit is contained in:
2026-07-21 12:35:36 +08:00
parent caf06a8a82
commit ebe6cdc7f1
11 changed files with 144 additions and 62 deletions
+30 -1
View File
@@ -1,7 +1,7 @@
import { expect, test } from "playwright/test";
test("Agent panel resizes by drag without exceeding half the viewport", async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.goto("/", { waitUntil: "networkidle" });
const panel = page.locator('aside[aria-label="Agent 命令面板"]');
const resizeHandle = page.getByRole("separator", { name: "调整 Agent 面板宽度" });
@@ -31,3 +31,32 @@ test("Agent resize handle stays hidden in the mobile layout", async ({ page }) =
await expect(page.getByRole("separator", { name: "调整 Agent 面板宽度" })).toBeHidden();
});
test.describe("mobile touch layout", () => {
test.use({ hasTouch: true, isMobile: true, viewport: { width: 375, height: 812 } });
test("mobile Agent toggle opens the conversation panel by touch", async ({ page }) => {
await page.goto("/", { waitUntil: "networkidle" });
const openButton = page.getByRole("button", { name: "打开 Agent 面板" });
const buttonBox = await openButton.boundingBox();
expect(buttonBox).not.toBeNull();
await page.touchscreen.tap(buttonBox!.x + buttonBox!.width / 2, buttonBox!.y + buttonBox!.height / 2);
await expect(page.locator('aside[aria-label="Agent 命令面板"]').filter({ visible: true })).toBeVisible();
await expect(page.getByRole("button", { name: "关闭 Agent 面板" })).toHaveCount(0);
});
});
test("mobile alert summary opens the Agent conversation panel", async ({ page }) => {
await page.clock.setFixedTime(new Date("2026-07-21T10:40:00+08:00"));
await page.setViewportSize({ width: 375, height: 812 });
await page.goto("/", { waitUntil: "networkidle" });
await page.getByRole("button", { name: /查看异常处置面板/ }).click();
await page.getByRole("button", { name: "工况汇总" }).click();
await expect(page.locator('aside[aria-label="Agent 命令面板"]').filter({ visible: true })).toBeVisible();
await expect(page.getByRole("button", { name: "关闭 Agent 面板" })).toHaveCount(0);
});