feat(workbench): refine dynamic task collaboration

This commit is contained in:
2026-09-24 16:36:12 +08:00
parent b64d2b78bb
commit 87cc7785da
25 changed files with 1216 additions and 470 deletions
+31 -24
View File
@@ -125,30 +125,29 @@ test.describe("mobile workbench sheet", () => {
await expect(page.getByRole("button", { name: "打开工况任务" })).toBeVisible();
});
test("keeps refresh to the right of schedule on a 320px viewport", async ({ page }) => {
await page.setViewportSize({ width: 320, height: 700 });
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.getByRole("button", { name: "打开工况任务" }).click();
for (const width of [320, 375]) {
test(`keeps refresh accessible without a schedule-create action at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 700 });
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.getByRole("button", { name: "打开工况任务" }).click();
const sheet = page.getByRole("region", { name: "工况任务抽屉" });
const scheduleButton = sheet.getByRole("button", { name: "配置定时流程" });
const refreshButton = sheet.getByRole("button", { name: "刷新工况任务" });
await expect(scheduleButton).toBeVisible();
await expect(refreshButton).toBeVisible();
const sheet = page.getByRole("region", { name: "工况任务抽屉" });
const refreshButton = sheet.getByRole("button", { name: "刷新工况任务" });
await expect(sheet.getByRole("button", { name: "配置定时流程" })).toHaveCount(0);
await expect(refreshButton).toBeVisible();
const [sheetBox, scheduleBox, refreshBox] = await Promise.all([
sheet.boundingBox(),
scheduleButton.boundingBox(),
refreshButton.boundingBox()
]);
expect(sheetBox).not.toBeNull();
expect(scheduleBox).not.toBeNull();
expect(refreshBox).not.toBeNull();
expect(refreshBox!.x).toBeGreaterThan(scheduleBox!.x);
expect(refreshBox!.x + refreshBox!.width).toBeLessThanOrEqual(
sheetBox!.x + sheetBox!.width
);
});
const [sheetBox, refreshBox] = await Promise.all([
sheet.boundingBox(),
refreshButton.boundingBox()
]);
expect(sheetBox).not.toBeNull();
expect(refreshBox).not.toBeNull();
expect(refreshBox!.x).toBeGreaterThanOrEqual(sheetBox!.x);
expect(refreshBox!.x + refreshBox!.width).toBeLessThanOrEqual(
sheetBox!.x + sheetBox!.width
);
});
}
test("keeps condition detail expanded inside the mobile sheet", async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
@@ -162,7 +161,7 @@ test.describe("mobile workbench sheet", () => {
await expect(workflowTitle.locator("..").locator("svg")).toHaveCount(0);
});
test("keeps the waiting-for-reply state readable in the narrow sheet", async ({ page }) => {
test("keeps the waiting-for-reply state readable in the narrow sheet", async ({ page }, testInfo) => {
await mockFlatWorkOrder(page, "reply");
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.getByRole("button", { name: "打开工况任务" }).click();
@@ -179,7 +178,15 @@ test.describe("mobile workbench sheet", () => {
await expect(awaitingReplyWorkOrder.getByText("待复令", { exact: true })).toBeVisible();
await awaitingReplyWorkOrder.click();
await expect(sheet.getByText("确认模型边界已同步更新", { exact: true })).toBeVisible();
await expect(sheet.getByText("活动记录", { exact: true })).toBeVisible();
await expect(sheet.getByText("工单报告", { exact: true })).toBeVisible();
await expect(sheet.getByText("活动记录", { exact: true })).toHaveCount(0);
await page.evaluate(() => document.fonts.ready);
await sheet.getByText("工单报告", { exact: true }).scrollIntoViewIfNeeded();
await sheet.screenshot({ path: testInfo.outputPath("work-order-mobile-report.png") });
await sheet.getByRole("list", { name: "工单进度" }).locator("li").nth(1).scrollIntoViewIfNeeded();
await sheet.screenshot({ path: testInfo.outputPath("work-order-mobile-stages.png") });
await sheet.getByLabel("回执信息").scrollIntoViewIfNeeded();
await sheet.screenshot({ path: testInfo.outputPath("work-order-mobile-receipt.png") });
});
test("clears mobile sheet state when crossing into the desktop layout", async ({ page }) => {