test(workbench): cover junction workspace deep links

This commit is contained in:
que01 committed 2026-09-03 12:35:45 +08:00
1 parent 8c99bb7340
commit b7d9a1973e
2 files changed
+28

No files matched your search

+17
View File
@@ -103,4 +103,21 @@ test.describe('workbench editing shell', () => {
await page.getByRole('switch', { name: '编辑模式' }).uncheck();
await expect(page.getByRole('button', { name: '撤销' })).toHaveCount(0);
});
test('opens an ordinary junction from a deep link with its workspace context', async ({ page }) => {
const state = await page.request.get('/api/state').then((response) => response.json());
const nodeCounts = new Map<string, number>();
for (const endpoint of state.compiled.model.endpoints) {
const nodeId = String(endpoint.nodeId);
nodeCounts.set(nodeId, (nodeCounts.get(nodeId) || 0) + 1);
}
const nodeId = [...nodeCounts].find(([, count]) => count >= 2)?.[0];
expect(nodeId).toBeTruthy();
await page.goto(`/junction/node/${encodeURIComponent(nodeId!)}`);
await expect(page.getByLabel('路口编辑工作区')).toBeVisible();
await expect(page.getByText(`路口节点 ${nodeId}`)).toBeVisible();
await expect(page.getByText('设施与验证', { exact: true })).toBeVisible();
await page.getByRole('switch', { name: '编辑模式' }).check();
await expect(page.getByLabel('路口编辑工作区').getByText('道路参数', { exact: true })).toBeVisible();
});
});