test equipping tools mid tool use removes have baked expression (#5403)

test equiping tools mid tool use removes have baked expression
This commit is contained in:
Kurt Hutten
2025-02-19 07:45:44 +11:00
committed by GitHub
parent 71f701dec7
commit f5c9f84ae9
3 changed files with 97 additions and 11 deletions

View File

@ -1353,6 +1353,99 @@ test.describe(`Sketching with offset planes`, () => {
})
test.describe('multi-profile sketching', () => {
test(
`test it removes half-finished expressions when changing tools in sketch mode`,
{ tag: ['@skipWin'] },
async ({ context, page, scene, toolbar, editor, homePage }) => {
// We seed the scene with a single offset plane
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`yo = 5
sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([121.52, 168.25], sketch001)
|> line(end = [115.04, 113.61])
|> line(end = [130.87, -97.79])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile002 = startProfileAt([117.2, 56.08], sketch001)
|> line(end = [166.82, 25.89])
|> yLine(-107.86, %)
`
)
})
await homePage.goToModelingScene()
await expect(
page.getByRole('button', { name: 'Start Sketch' })
).not.toBeDisabled()
await (await toolbar.getFeatureTreeOperation('Sketch', 0)).dblclick()
await page.waitForTimeout(600)
const [circlePoint1] = scene.makeMouseHelpers(700, 200)
await test.step('equip circle tool and click first point', async () => {
await toolbar.circleBtn.click()
await page.waitForTimeout(100)
await circlePoint1()
await editor.expectEditor.toContain('profile003 = circle({ center = [')
})
await test.step('equip line tool and verify circle code is removed', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.not.toContain('profile003 = circle({')
})
const [circle3Point1] = scene.makeMouseHelpers(650, 200)
const [circle3Point2] = scene.makeMouseHelpers(750, 200)
await test.step('equip three point circle tool and click first two points', async () => {
await toolbar.selectCircleThreePoint()
await page.waitForTimeout(100)
await circle3Point1()
await page.waitForTimeout(100)
await circle3Point2()
await editor.expectEditor.toContain('profile003 = circleThreePoint(')
})
await test.step('equip line tool and verify three point circle code is removed', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.not.toContain(
'profile003 = circleThreePoint('
)
})
const [cornerRectPoint1] = scene.makeMouseHelpers(600, 300)
await test.step('equip corner rectangle tool and click first point', async () => {
await toolbar.rectangleBtn.click()
await page.waitForTimeout(100)
await cornerRectPoint1()
await editor.expectEditor.toContain('profile003 = startProfileAt(')
})
await test.step('equip line tool and verify corner rectangle code is removed', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.not.toContain('profile003 = startProfileAt(')
})
const [centerRectPoint1] = scene.makeMouseHelpers(700, 300)
await test.step('equip center rectangle tool and click first point', async () => {
await toolbar.selectCenterRectangle()
await page.waitForTimeout(100)
await centerRectPoint1()
await editor.expectEditor.toContain('profile003 = startProfileAt(')
})
await test.step('equip line tool and verify center rectangle code is removed', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.not.toContain('profile003 = startProfileAt(')
})
}
)
test(
`snapToProfile start only works for current profile`,
{ tag: ['@skipWin'] },
@ -1885,7 +1978,7 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
)
test(
'Can delete a profile in the editor while is sketch mode, and sketch mode does not break, can ctrl+z to undo after constraint with variable was added',
{ tag: ['@skipWin'] },
{ tag: ['@skipWin', '@skipLinux'] },
async ({ scene, toolbar, editor, cmdBar, page, homePage }) => {
await page.addInitScript(async () => {
localStorage.setItem(
@ -1969,7 +2062,7 @@ profile003 = circle({ center = [6.92, -4.2], radius = 3.16 }, sketch001)
activeLines: ['|>line(end = [-0.41,6.99])'],
highlightedCode: 'line(end = [-0.41,6.99])',
})
}).toPass({ timeout: 10_000, intervals: [1000] })
}).toPass({ timeout: 30_000, intervals: [1500] })
await toolbar.lengthConstraintBtn.click()
await cmdBar.progressCmdBar()