Skip to content

Commit 705f9d8

Browse files
committed
Add E2E test for modify
1 parent 654fec7 commit 705f9d8

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

e2e/draw.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,41 @@ test('clicks to the map produce a fetchable pin coordinate', async ({
4040
expect(drawing.features.length).toBe(1)
4141
expect(drawing.features[0].geometry.coordinates[0].length).toBe(7)
4242
})
43+
44+
test('two features drawn at the same coordinate can be modified separately', async ({
45+
page,
46+
}) => {
47+
await openSnowbox(page)
48+
49+
const canvas = await page.locator('canvas')
50+
const boundingBox = await canvas.boundingBox()
51+
if (boundingBox === null) throw new Error('Canvas not found.')
52+
const { width, height } = boundingBox
53+
let { x, y } = boundingBox
54+
55+
x += width / 2
56+
y += height / 2
57+
58+
await page.getByLabel('Draw tools').click()
59+
await page.getByText('Draw and write').click()
60+
await page.getByText('Point').click()
61+
62+
await page.mouse.click(x, y)
63+
await page.mouse.click(x, y)
64+
65+
await page.getByText('Edit').click()
66+
67+
await page.mouse.move(x, y)
68+
await page.mouse.down()
69+
await page.mouse.move(x + 40, y + 40)
70+
await page.mouse.up()
71+
72+
const drawing = JSON.parse(await page.locator(drawTargetId).innerText())
73+
74+
expect(drawing.type).toBe('FeatureCollection')
75+
expect(drawing.features.length).toBe(2)
76+
expect(drawing.features[0].geometry.coordinates[0]).toBe(x)
77+
expect(drawing.features[0].geometry.coordinates[1]).toBe(y)
78+
expect(drawing.features[1].geometry.coordinates[0]).toBe(x + 40)
79+
expect(drawing.features[1].geometry.coordinates[1]).toBe(y + 40)
80+
})

0 commit comments

Comments
 (0)