feat(workbench): add manual task refresh
This commit is contained in:
@@ -125,6 +125,31 @@ 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();
|
||||
|
||||
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 [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
|
||||
);
|
||||
});
|
||||
|
||||
test("keeps condition detail expanded inside the mobile sheet", async ({ page }) => {
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
await page.getByRole("button", { name: "打开工况任务" }).click();
|
||||
|
||||
@@ -197,13 +197,15 @@ test("审批动作展示中文参数和证据,viewer 不可审批,冲突后
|
||||
alert_availability: "not_configured", generated_at: "2026-09-23T08:30:00Z",
|
||||
conditions: [], alerts: [], scenarios: [], latest_analysis: null, work_orders: []
|
||||
};
|
||||
await page.route("http://server.test/api/v1/workbench/sync-snapshot", (route) =>
|
||||
route.fulfill({ json: {
|
||||
let snapshotRequests = 0;
|
||||
await page.route("http://server.test/api/v1/workbench/sync-snapshot", (route) => {
|
||||
snapshotRequests += 1;
|
||||
return route.fulfill({ json: {
|
||||
schema: "workbench-sync-snapshot@1", event_cursor: 0, runtime: runtimeSnapshot,
|
||||
tasks: [summary(task), summary(appointmentTask)], notifications: [],
|
||||
generated_at: "2026-09-23T08:30:00Z"
|
||||
} })
|
||||
);
|
||||
} });
|
||||
});
|
||||
await page.route("http://server.test/api/v1/workbench/events**", (route) =>
|
||||
route.fulfill({ contentType: "text/event-stream", body: ": test keepalive\n\n" })
|
||||
);
|
||||
@@ -267,6 +269,10 @@ test("审批动作展示中文参数和证据,viewer 不可审批,冲突后
|
||||
await expect(conditionPanel.getByRole("button", { name: /定时任务/ })).toContainText("模拟数据");
|
||||
await expect(conditionPanel.getByRole("button", { name: /调查任务/ })).toContainText("后端");
|
||||
await expect(conditionPanel.getByRole("button", { name: /预约任务/ })).toContainText("后端");
|
||||
const conditionRefreshButton = conditionPanel.getByRole("button", { name: "刷新工况任务" });
|
||||
await expect(conditionRefreshButton).toBeVisible();
|
||||
await conditionRefreshButton.click();
|
||||
await expect.poll(() => snapshotRequests).toBe(2);
|
||||
await conditionPanel.getByRole("button", { name: "配置定时流程" }).click();
|
||||
await conditionPanel.getByLabel("定时流程名称").fill("夜间阀门巡检");
|
||||
await conditionPanel.getByLabel("任务说明").fill("每十五分钟检查预约维修涉及的边界阀门。");
|
||||
|
||||
Reference in New Issue
Block a user