fix(workbench): show junction traffic signals
This commit is contained in:
1 parent
f10a5da325
commit
1f439d98de
15 files changed
+529
-60
No files matched your search
@@ -117,11 +117,14 @@ test.describe('workbench editing shell', () => {
|
||||
await expect(page.getByLabel('路口编辑工作区')).toBeVisible();
|
||||
await expect(page.getByLabel('道路地图')).toBeVisible();
|
||||
expect((await page.getByLabel('道路地图').boundingBox())?.width).toBeGreaterThan(0);
|
||||
await expect(page.getByText(`路口节点 ${nodeId}`)).toBeVisible();
|
||||
await expect(page.getByText('JunctionTools', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText(nodeId, { exact: true })).toHaveCount(0);
|
||||
await expect(page.getByText('设施与验证', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('当前为浏览模式,开启编辑后可调整路口几何参数')).toBeVisible();
|
||||
await page.getByRole('button', { name: '开启编辑模式' }).click();
|
||||
await expect(page.getByLabel('路口编辑工作区').getByText('道路参数', { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel('路口编辑工作区').getByText('路口参数', { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel('路口编辑工作区').getByText('展开单独定制', { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByLabel('路口编辑工作区').getByText('进口收口距离', { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.getByLabel('路口编辑工作区')
|
||||
@@ -129,4 +132,66 @@ test.describe('workbench editing shell', () => {
|
||||
.first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('discards junction drafts and lists each approach road once', 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 page.getByRole('button', { name: '开启编辑模式' }).click();
|
||||
|
||||
const roadsText = await page.locator('.junction-workspace__body dd').nth(1).innerText();
|
||||
const roads = roadsText
|
||||
.split('、')
|
||||
.map((road) => road.trim())
|
||||
.filter(Boolean);
|
||||
expect(new Set(roads).size).toBe(roads.length);
|
||||
|
||||
const input = page.getByLabel('路口编辑工作区').locator('input').first();
|
||||
const original = Number(await input.inputValue());
|
||||
await input.fill(String(original + 0.1));
|
||||
await expect(page.getByRole('button', { name: '放弃草稿' })).toBeEnabled();
|
||||
await page.getByRole('button', { name: '放弃草稿' }).click();
|
||||
await expect(input).toHaveValue(String(original));
|
||||
|
||||
await page.getByRole('button', { name: '展开单独定制' }).first().click();
|
||||
const detailRows = page.locator('.parameter-group__details .parameter');
|
||||
await expect(detailRows.first()).toBeVisible();
|
||||
await expect(detailRows.first().locator('.parameter-label')).toContainText(/进口/);
|
||||
});
|
||||
|
||||
test('opens a junction signal from the local facility list without exposing delete', 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 page.getByRole('button', { name: '开启编辑模式' }).click();
|
||||
|
||||
const signalItem = page
|
||||
.getByLabel('已有设施')
|
||||
.getByRole('button', { name: /信号灯/ })
|
||||
.first();
|
||||
if ((await signalItem.count()) === 0) return;
|
||||
await signalItem.click();
|
||||
const signalSelect = page.getByLabel('检查信号灯');
|
||||
await expect(signalSelect).toHaveValue(/.+/);
|
||||
await expect(page.getByRole('button', { name: '删除信号灯' })).toHaveCount(0);
|
||||
await expect(page.getByText('当前选中:信号灯。可在下方参数中调整。')).toBeVisible();
|
||||
const heading = page.getByLabel('横杆方向(度)');
|
||||
const original = await heading.inputValue();
|
||||
await heading.fill(String((Number(original) + 15) % 360));
|
||||
await expect(page.getByRole('button', { name: '放弃草稿' })).toBeEnabled();
|
||||
await page.getByRole('button', { name: '放弃草稿' }).click();
|
||||
await expect(heading).toHaveValue(original);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user