feat(workbench): expand SCADA monitoring and investigation presentation
This commit is contained in:
@@ -120,3 +120,42 @@ test("project loading failure can retry without retaining a loading animation",
|
||||
await expect(page.getByTestId("workbench-main-frame")).toBeVisible();
|
||||
} finally { retry.release(); }
|
||||
});
|
||||
|
||||
for (const width of [1440, 375]) {
|
||||
test(`project timeout shows readiness diagnosis and can retry at ${width}px`, async ({ page }, testInfo) => {
|
||||
test.setTimeout(40_000);
|
||||
let fail = true;
|
||||
const pending = gate();
|
||||
await page.setViewportSize({ width, height: width === 1440 ? 900 : 740 });
|
||||
await mockWorkbenchContext(page);
|
||||
await mockAgentApi(page);
|
||||
await page.route("**/ready", (route) => route.fulfill({ status: 503, headers, json: {
|
||||
status: "not_ready", checks: { startup: "ready", metadata_database: "unavailable", mcp_transport: "ready" }
|
||||
} }));
|
||||
await page.route("**/api/v1/projects?**", async (route) => {
|
||||
if (route.request().method() === "OPTIONS") return route.fallback();
|
||||
if (fail) {
|
||||
await pending.ready;
|
||||
return route.abort().catch(() => undefined);
|
||||
}
|
||||
return route.fulfill({ headers, json: { items: [project], total: 1, limit: 1000, offset: 0 } });
|
||||
});
|
||||
try {
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
const startup = page.getByRole("main", { name: "应用启动" });
|
||||
const error = startup.getByRole("alert");
|
||||
await expect(error).toContainText("读取授权项目超时(已等待 15 秒)", { timeout: 20_000 });
|
||||
await expect(error).toContainText("项目元数据库暂不可用");
|
||||
await expect(error).not.toContainText("signal timed out");
|
||||
await expect(startup.locator('[data-activity="loading"]')).toHaveCount(0);
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
|
||||
await testInfo.attach(`project-timeout-${width}`, {
|
||||
body: await page.screenshot({ path: testInfo.outputPath("project-timeout.png") }), contentType: "image/png"
|
||||
});
|
||||
fail = false;
|
||||
pending.release();
|
||||
await startup.getByRole("button", { name: "重新加载" }).click();
|
||||
await expect(page.getByTestId("workbench-main-frame")).toBeVisible();
|
||||
} finally { pending.release(); }
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user