Files
SystemSimulationApp/frontend/tests/e2e/simulation-timeout.spec.ts
lujingze e18399c022 整合求解器活动监控与步长回归证据
同步远端 PNL0003 诊断和大采样网格能力,语义合并活动感知的 60 秒真停滞判定与旧后端 15 分钟兼容兜底。

纳管热路径优化、15 单元运行证据、浏览器与 API 报告,并补充北京时间更新日志和遗留问题。
2026-08-19 16:24:31 +00:00

33 lines
1.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
import {
SIMULATION_ACTIVITY_STALL_TIMEOUT_MS,
SIMULATION_ACTIVITY_STALL_TIMEOUT_SECONDS,
SIMULATION_SOLVER_STALL_TIMEOUT_MINUTES,
SIMULATION_SOLVER_STALL_TIMEOUT_MS,
solverActivityStallTimeoutMessage,
solverStallTimeoutMessage,
solverStallTimeoutReached,
} from "../../src/simulationTimeout";
test("solver stall watchdog allows the validated long-running window", () => {
expect(SIMULATION_SOLVER_STALL_TIMEOUT_MINUTES).toBe(15);
expect(SIMULATION_SOLVER_STALL_TIMEOUT_MS).toBe(900_000);
expect(solverStallTimeoutReached(1_000, 900_999)).toBe(false);
expect(solverStallTimeoutReached(1_000, 901_000)).toBe(true);
});
test("solver stall messages use the configured duration", () => {
expect(solverStallTimeoutMessage("detected")).toContain("连续 15 分钟");
expect(solverStallTimeoutMessage("recovering")).toContain("连续 15 分钟");
expect(solverStallTimeoutMessage("recovering")).toContain("恢复部分结果");
});
test("activity-aware watchdog keeps its shorter true-stall threshold", () => {
expect(SIMULATION_ACTIVITY_STALL_TIMEOUT_SECONDS).toBe(60);
expect(SIMULATION_ACTIVITY_STALL_TIMEOUT_MS).toBe(60_000);
expect(solverActivityStallTimeoutMessage("detected")).toContain(
"接受步和内部活动均连续 60 秒",
);
});