完善建模交互与结果曲线功能
支持元件接口接触吸附、旋转后兼容连接及无连线逻辑边。 完善 AMESim 图标显示、参数双栏、结果曲线待定窗口及相关端到端测试。
This commit is contained in:
1 parent
410ef535e8
commit
503394f3ed
10 files changed
+2542
-389
No files matched your search
@@ -52,14 +52,27 @@ test("恢复自动保存工程后自动适配建模画布", async ({ page }) =>
|
||||
|
||||
test("切换到结果页时自动适配只读系统图", async ({ page }) => {
|
||||
await prepareApp(page);
|
||||
await page.addInitScript((snapshot) => {
|
||||
await page.addInitScript(({ project, snapshot }) => {
|
||||
window.sessionStorage.setItem(
|
||||
"system-simulation-flow:latest-result",
|
||||
JSON.stringify(snapshot),
|
||||
);
|
||||
}, resultSnapshot);
|
||||
window.localStorage.setItem(
|
||||
"system-simulation-flow:project:demo-system",
|
||||
JSON.stringify(project),
|
||||
);
|
||||
}, { project: wideProject, snapshot: resultSnapshot });
|
||||
|
||||
await page.goto("/");
|
||||
await page.getByRole("button", { name: "加载工程" }).click();
|
||||
const freeModelingHandle = page.locator(
|
||||
'.flow-canvas .react-flow__node[data-id="generic_sensor_1"] .port-handle[data-port-name="port_a"]',
|
||||
);
|
||||
await freeModelingHandle.dispatchEvent("click");
|
||||
await expect(freeModelingHandle).toHaveAttribute(
|
||||
"data-connection-state",
|
||||
"origin",
|
||||
);
|
||||
await page.getByRole("tab", { name: /^结果/ }).click();
|
||||
await expectAllNodesInsideCanvas(page, ".results-system-canvas");
|
||||
await expect(
|
||||
@@ -67,6 +80,10 @@ test("切换到结果页时自动适配只读系统图", async ({ page }) => {
|
||||
).toHaveCount(0);
|
||||
|
||||
await page.getByRole("tab", { name: "建模" }).click();
|
||||
await expect(freeModelingHandle).toHaveAttribute(
|
||||
"data-connection-state",
|
||||
"idle",
|
||||
);
|
||||
await expect(
|
||||
page.getByRole("complementary", { name: "仿真控制台", exact: true }),
|
||||
).toBeVisible();
|
||||
@@ -78,4 +95,15 @@ test("切换到结果页时自动适配只读系统图", async ({ page }) => {
|
||||
await expect(page.locator(".results-system-canvas .react-flow__edge")).toHaveCount(
|
||||
wideProject.edges.length,
|
||||
);
|
||||
const connectedResultHandles = page.locator(
|
||||
'.results-system-canvas .port-handle[data-connected="true"]',
|
||||
);
|
||||
const idleResultHandles = page.locator(
|
||||
'.results-system-canvas .port-handle[data-connected="false"]',
|
||||
);
|
||||
await expect(connectedResultHandles).toHaveCount(
|
||||
wideProject.edges.length * 2,
|
||||
);
|
||||
await expect(idleResultHandles).toHaveCount(2);
|
||||
await expect(connectedResultHandles.first()).toHaveCSS("opacity", "0");
|
||||
});
|
||||
Reference in new issue
Block a user