Add bidirectional and twist optional args to point-and-click Extrude (#7496)

* WIP: Add bidirectional args to point-and-click Extrude
Will eventually close #7495

* Wire up edit flow for symmetric

* Show skip true args in header in review phase

* Add bidirectionalLength

* Make currentArg always part of header

* WIP

* Add twistAng

* Proper optional args line in review

* Labels in progress button and option arg section heading

* Clean up extrude specific changes

* Clean up to separate from #7506

* Clean up to separate from #7506

* More clean up across branches

* More UI polish

* Remove options bool icon

* Fix labels for tests

* Upgrade e2e tests to cmdBar fixtures with fixes

* More fixes

* Fixed up more tests related to sweep behavior change

* Fix nodeToEdit not having hidden: true on Shell

* Add typecheck

* WIP: footer buttons

* back to reg width

* Clean up

* Update snapshots

* Update snapshots

* Clean up

* Fix tests and remove label

* Refactor

* Fix offset plane test

* Add CommandBarDivider

* Fix step back

* Update snapshots

* Add comment

* Fix it, thanks bot

* Clean up and inline optional heading

* Little case tweak

* Update src/components/CommandBar/CommandBarReview.tsx

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>

* Rename to CommandBarHeaderFooter

* Rename to CommandBarHeaderFooter

* Clean things up and fix edit

* Add test

* Revert something quick

* Reorg args to match kcl order

* Clean up edit arg retrieval error checks

* Lint

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
Pierre Jacquier
2025-06-23 10:53:01 -04:00
committed by GitHub
parent c584d942d4
commit 599ab33e40
9 changed files with 302 additions and 15 deletions

View File

@ -187,6 +187,13 @@ export class CmdBarFixture {
return this.page.getByRole('option', options)
}
/**
* Select an optional argument from the command bar during review
*/
clickOptionalArgument = async (argName: string) => {
await this.page.getByTestId(`cmd-bar-add-optional-arg-${argName}`).click()
}
/**
* Clicks the Create new variable button for kcl input
*/

View File

@ -4923,4 +4923,154 @@ extrude001 = extrude(profile001 length = 1)`
await editor.expectEditor.toContain(badCode, { shouldNormalise: true })
})
})
test('Point-and-click extrude with optional args', async ({
context,
page,
homePage,
scene,
editor,
toolbar,
cmdBar,
}) => {
const squareProfileCode = `length001 = 100
sketch001 = startSketchOn(XY)
profile001 = startProfile(sketch001, at = [0, 0])
|> yLine(length = length001)
|> xLine(length = length001)
|> yLine(length = -length001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
`
await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode)
}, squareProfileCode)
await homePage.goToModelingScene()
await scene.settled(cmdBar)
await test.step('Select through code', async () => {
await editor.selectText('startProfile(sketch001, at = [0, 0])')
})
await test.step('Go through command bar flow', async () => {
await toolbar.extrudeButton.click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'sketches',
currentArgValue: '',
headerArguments: {
Profiles: '',
Length: '',
},
highlightedHeaderArg: 'Profiles',
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '5',
headerArguments: {
Profiles: '1 profile',
Length: '',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Profiles: '1 profile',
Length: '5',
},
commandName: 'Extrude',
})
await cmdBar.clickOptionalArgument('bidirectionalLength')
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'bidirectionalLength',
currentArgValue: '',
headerArguments: {
Profiles: '1 profile',
Length: '5',
BidirectionalLength: '',
},
highlightedHeaderArg: 'bidirectionalLength',
commandName: 'Extrude',
})
await page.keyboard.insertText('10')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Profiles: '1 profile',
Length: '5',
BidirectionalLength: '10',
},
commandName: 'Extrude',
})
await cmdBar.submit()
})
await test.step('Check that the code has changed', async () => {
await scene.settled(cmdBar)
await editor.expectEditor.toContain(
`extrude001 = extrude(profile001, length = 5, bidirectionalLength = 10)`,
{ shouldNormalise: true }
)
})
await test.step('Go through the edit flow via feature tree', async () => {
await toolbar.openPane('feature-tree')
const op = await toolbar.getFeatureTreeOperation('Extrude', 0)
await op.dblclick()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '5',
headerArguments: {
Length: '5',
BidirectionalLength: '10',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await page.keyboard.insertText('10')
await cmdBar.progressCmdBar()
await page.getByRole('button', { name: 'BidirectionalLength' }).click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'bidirectionalLength',
currentArgValue: '10',
headerArguments: {
Length: '10',
BidirectionalLength: '10',
},
highlightedHeaderArg: 'bidirectionalLength',
commandName: 'Extrude',
})
await page.keyboard.insertText('20')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Length: '10',
BidirectionalLength: '20',
},
commandName: 'Extrude',
})
await cmdBar.submit()
})
await test.step('Check that the code has changed again', async () => {
await scene.settled(cmdBar)
await toolbar.closePane('feature-tree')
await toolbar.openPane('code')
await editor.expectEditor.toContain(
`extrude001 = extrude(profile001, length = 10, bidirectionalLength = 20)`,
{ shouldNormalise: true }
)
})
})
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB