Allow users to delete sketches on offset planes via feature tree (#5641)
* Add sketch-on-offset plane deletion cleanup logic * Add an E2E test for this behavior
This commit is contained in:
@ -388,4 +388,52 @@ test.describe('Feature Tree pane', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test(`Delete sketch on offset plane and all profiles from feature tree`, async ({
|
||||
context,
|
||||
page,
|
||||
homePage,
|
||||
scene,
|
||||
editor,
|
||||
toolbar,
|
||||
cmdBar,
|
||||
}) => {
|
||||
const beforeKclCode = `plane001 = offsetPlane('XY', offset = 5)
|
||||
sketch001 = startSketchOn(plane001)
|
||||
profile001 = circle(sketch001, center = [0, 20], radius = 12)
|
||||
profile002 = startProfileAt([0, 7.25], sketch001)
|
||||
|> xLine(13.3, %)
|
||||
profile003 = startProfileAt([0, -4.93], sketch001)
|
||||
|> line(endAbsolute = [-5.56, 0])`
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
const testProject = join(dir, 'test-sample')
|
||||
await fsp.mkdir(testProject, { recursive: true })
|
||||
await fsp.writeFile(join(testProject, 'main.kcl'), beforeKclCode, 'utf-8')
|
||||
})
|
||||
// One dumb hardcoded screen pixel value
|
||||
const testPoint = { x: 650, y: 250 }
|
||||
const sketchColor: [number, number, number] = [149, 149, 149]
|
||||
const planeColor: [number, number, number] = [74, 74, 74]
|
||||
|
||||
await homePage.openProject('test-sample')
|
||||
// FIXME: @lf94 has a better way to verify execution completion, in a PR rn
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
await test.step(`Verify we see the sketch`, async () => {
|
||||
await scene.expectPixelColor(sketchColor, testPoint, 10)
|
||||
})
|
||||
|
||||
await test.step('Delete sketch via feature tree selection', async () => {
|
||||
const operationButton = await toolbar.getFeatureTreeOperation('Sketch', 0)
|
||||
await operationButton.click({ button: 'left' })
|
||||
await page.keyboard.press('Delete')
|
||||
await scene.expectPixelColor(planeColor, testPoint, 10)
|
||||
})
|
||||
|
||||
await test.step(`Verify the code changed`, async () => {
|
||||
await editor.expectEditor.toContain('plane001 =')
|
||||
await editor.expectEditor.not.toContain('sketch001 =')
|
||||
await editor.expectEditor.not.toContain('profile002 = ')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user