Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
acc6d41
WIP: Extend point-and-click edit flows to non-variable sweep declarat…
pierremtb Apr 22, 2025
5119a90
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb Apr 23, 2025
2c5c59c
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb Apr 25, 2025
56dbaa1
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb Apr 28, 2025
8a8678e
Clean up
pierremtb Apr 28, 2025
7c9387d
Clean up more and break out to external hopefully testable function
pierremtb Apr 28, 2025
4450402
Apply the same principles to Revolve
pierremtb Apr 28, 2025
c312420
Add variable insertion for revolve and extrude
pierremtb Apr 28, 2025
1f205bb
More clean up ahead of sweep migration
pierremtb Apr 28, 2025
f37c3ac
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb Apr 28, 2025
f517bd3
Fix more tests
pierremtb Apr 28, 2025
6b0cdb5
Lint
pierremtb Apr 28, 2025
7cdb181
Remove skips on extrude and revolve
pierremtb Apr 29, 2025
8c7c145
Migrate sweep
pierremtb Apr 29, 2025
d756fc6
Fix a few tests
pierremtb Apr 29, 2025
f18cf36
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb Apr 29, 2025
5c766a2
Fix more tests
pierremtb Apr 29, 2025
6b4fae0
Extend point-and-click edit flows to non-variable sweep declarations
pierremtb May 1, 2025
cfa5d6e
Ensure we can edit all three extrude from sample bracket with test
pierremtb May 1, 2025
190701c
Fix all but one test
pierremtb May 1, 2025
0cc704a
One more
pierremtb May 1, 2025
0e2e811
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb May 2, 2025
7420c63
Fix more
pierremtb May 2, 2025
fd3b7b7
Another fix
pierremtb May 2, 2025
630410e
Another fix
pierremtb May 2, 2025
692138c
Update src/lang/modifyAst/addSweep.ts
pierremtb May 2, 2025
92f11ff
Big arg naming alignment with KCL, move Loft into the mix for consist…
pierremtb May 2, 2025
cf0ad74
Fix sweep validation and WIP multi profile tests for all sweeps
pierremtb May 2, 2025
c632304
Fix tests
pierremtb May 2, 2025
b568888
Lint
pierremtb May 2, 2025
be80053
Extend point-and-click edit flows to non-variable sweep declarations
pierremtb May 5, 2025
288e46a
Fix lofts
pierremtb May 5, 2025
86a6ed1
Another oopsie in global replace
pierremtb May 5, 2025
00d2140
Clean up operations.ts
pierremtb May 5, 2025
c939a9b
Merge branch 'main' into pierremtb/issue6434-Extend-point-and-click-e…
pierremtb May 6, 2025
7f060cb
Add Frank's suggestions
pierremtb May 6, 2025
6bb8293
Fix up some messssss
pierremtb May 6, 2025
2d1410e
Last fix hopefully
pierremtb May 6, 2025
a9cf5ec
Lint
pierremtb May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions e2e/playwright/command-bar-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ test.describe('Command bar tests', () => {
test('Extrude from command bar selects extrude line after', async ({
page,
homePage,
toolbar,
cmdBar,
}) => {
await page.addInitScript(async () => {
localStorage.setItem(
Expand All @@ -34,20 +36,35 @@ test.describe('Command bar tests', () => {

// Click the line of code for xLine.
await page.getByText(`close()`).click() // TODO remove this and reinstate // await topHorzSegmentClick()
await page.waitForTimeout(100)

await page.getByRole('button', { name: 'Extrude' }).click()
await page.waitForTimeout(200)
await page.keyboard.press('Enter')
await page.waitForTimeout(200)
await page.keyboard.press('Enter')
await page.waitForTimeout(200)
await toolbar.extrudeButton.click()
await cmdBar.expectState({
stage: 'arguments',
commandName: 'Extrude',
currentArgKey: 'selection',
currentArgValue: '',
headerArguments: {
Selection: '',
Length: '',
},
highlightedHeaderArg: 'selection',
})
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
commandName: 'Extrude',
headerArguments: {
Selection: '1 segment',
Length: '5',
},
})
await cmdBar.progressCmdBar()
Comment on lines +41 to +63

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes here and below are to account for:

  1. the need to press next on selections now that we can select multiple sketches and can't have skip: true
  2. changing "Selection" for "Sketches"

And I took the opportunity to modernize those tests a bit to new fixtures

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🔥

await expect(page.locator('.cm-activeLine')).toHaveText(
`extrude001 = extrude(sketch001, length = ${KCL_DEFAULT_LENGTH})`
)
})

// TODO: fix this test after the electron migration
test('Fillet from command bar', async ({ page, homePage }) => {
await page.addInitScript(async () => {
localStorage.setItem(
Expand Down Expand Up @@ -272,17 +289,18 @@ test.describe('Command bar tests', () => {
// Select a face
await page.mouse.move(700, 200)
await page.mouse.click(700, 200)
await cmdBar.progressCmdBar()

// Assert that we're on the distance step
await expect(
page.getByRole('button', { name: 'distance', exact: false })
page.getByRole('button', { name: 'length', exact: false })
).toBeDisabled()

// Assert that the an alternative variable name is chosen,
// since the default variable name is already in use (distance)
await page.getByRole('button', { name: 'Create new variable' }).click()
await expect(page.getByPlaceholder('Variable name')).toHaveValue(
'distance001'
'length001'
)

const continueButton = page.getByRole('button', { name: 'Continue' })
Expand All @@ -296,7 +314,7 @@ test.describe('Command bar tests', () => {

// Assert we're back on the distance step
await expect(
page.getByRole('button', { name: 'distance', exact: false })
page.getByRole('button', { name: 'length', exact: false })
).toBeDisabled()

await continueButton.click()
Expand All @@ -305,7 +323,7 @@ test.describe('Command bar tests', () => {
await u.waitForCmdReceive('extrude')

await expect(page.locator('.cm-content')).toContainText(
'extrude001 = extrude(sketch001, length = distance001)'
'extrude001 = extrude(sketch001, length = length001)'
)
})

Expand Down
38 changes: 27 additions & 11 deletions e2e/playwright/editor-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,9 @@ sketch001 = startSketchOn(XZ)
page,
context,
homePage,
toolbar,
cmdBar,
scene,
}) => {
const u = await getUtils(page)
await context.addInitScript(async () => {
Expand Down Expand Up @@ -1124,17 +1127,30 @@ sketch001 = startSketchOn(XZ)
await page.waitForTimeout(100)

await page.getByText('startProfile(at = [4.61, -14.01])').click()
await expect(page.getByRole('button', { name: 'Extrude' })).toBeVisible()
await page.getByRole('button', { name: 'Extrude' }).click()

await expect(page.getByTestId('command-bar')).toBeVisible()
await page.waitForTimeout(100)

await page.getByRole('button', { name: 'arrow right Continue' }).click()
await page.waitForTimeout(100)
await expect(page.getByText('Confirm Extrude')).toBeVisible()
await page.getByRole('button', { name: 'checkmark Submit command' }).click()
await page.waitForTimeout(100)
await toolbar.extrudeButton.click()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '5',
headerArguments: {
Selection: '1 face',
Length: '',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Selection: '1 face',
Length: '5',
},
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await scene.settled(cmdBar)

// expect the code to have changed
await expect(page.locator('.cm-content')).toHaveText(
Expand Down
10 changes: 5 additions & 5 deletions e2e/playwright/feature-tree-pane.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ test.describe('Feature Tree pane', () => {
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 5)
renamedExtrude = extrude(sketch001, length = ${initialInput})`
const newConstantName = 'distance001'
const newConstantName = 'length001'
const expectedCode = `${newConstantName} = 23
sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 5)
Expand Down Expand Up @@ -270,12 +270,12 @@ test.describe('Feature Tree pane', () => {
await cmdBar.expectState({
commandName: 'Extrude',
stage: 'arguments',
currentArgKey: 'distance',
currentArgKey: 'length',
currentArgValue: initialInput,
headerArguments: {
Distance: initialInput,
Length: initialInput,
},
highlightedHeaderArg: 'distance',
highlightedHeaderArg: 'length',
})
})

Expand All @@ -290,7 +290,7 @@ test.describe('Feature Tree pane', () => {
stage: 'review',
headerArguments: {
// The calculated value is shown in the argument summary
Distance: initialInput,
Length: initialInput,
},
commandName: 'Extrude',
})
Expand Down
136 changes: 128 additions & 8 deletions e2e/playwright/point-click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { EditorFixture } from '@e2e/playwright/fixtures/editorFixture'
import type { SceneFixture } from '@e2e/playwright/fixtures/sceneFixture'
import type { ToolbarFixture } from '@e2e/playwright/fixtures/toolbarFixture'
import { expect, test } from '@e2e/playwright/zoo-test'
import { bracket } from '@e2e/playwright/fixtures/bracket'

// test file is for testing point an click code gen functionality that's not sketch mode related

Expand Down Expand Up @@ -75,10 +76,19 @@ test.describe('Point-and-click tests', () => {
await toolbar.extrudeButton.click()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'distance',
currentArgKey: 'selection',
currentArgValue: '',
headerArguments: { Selection: '', Length: '' },
highlightedHeaderArg: 'selection',
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '5',
headerArguments: { Selection: '1 face', Distance: '' },
highlightedHeaderArg: 'distance',
headerArguments: { Selection: '1 face', Length: '' },
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
Expand All @@ -88,7 +98,7 @@ test.describe('Point-and-click tests', () => {

await cmdBar.expectState({
stage: 'review',
headerArguments: { Selection: '1 face', Distance: '5' },
headerArguments: { Selection: '1 face', Length: '5' },
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
Expand All @@ -97,6 +107,102 @@ test.describe('Point-and-click tests', () => {
})
})

test('Verify in-pipe extrudes in bracket can be edited', async ({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test to showcase the intent here: edit the extrudes in the real-life onboarding bracket

tronApp,
context,
editor,
homePage,
page,
scene,
toolbar,
cmdBar,
}) => {
await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode)
}, bracket)
await homePage.goToModelingScene()
await scene.settled(cmdBar)

await test.step(`Edit first extrude via feature tree`, async () => {
await (await toolbar.getFeatureTreeOperation('Extrude', 0)).dblclick()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: 'width',
headerArguments: {
Length: '5',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await page.keyboard.insertText('width - 0.001')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Length: '4.999',
},
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await editor.expectEditor.toContain('extrude(length = width - 0.001)')
})

await test.step(`Edit second extrude via feature tree`, async () => {
await (await toolbar.getFeatureTreeOperation('Extrude', 1)).dblclick()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '-thickness - .01',
headerArguments: {
Length: '-0.3949',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await page.keyboard.insertText('-thickness - .01 - 0.001')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Length: '-0.3959',
},
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await editor.expectEditor.toContain(
'extrude(length = -thickness - .01 - 0.001)'
)
})

await test.step(`Edit third extrude via feature tree`, async () => {
await (await toolbar.getFeatureTreeOperation('Extrude', 2)).dblclick()
await cmdBar.expectState({
stage: 'arguments',
currentArgKey: 'length',
currentArgValue: '-thickness - 0.1',
headerArguments: {
Length: '-0.4849',
},
highlightedHeaderArg: 'length',
commandName: 'Extrude',
})
await page.keyboard.insertText('-thickness - 0.1 - 0.001')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
headerArguments: {
Length: '-0.4859',
},
commandName: 'Extrude',
})
await cmdBar.progressCmdBar()
await editor.expectEditor.toContain(
'extrude(length = -thickness - 0.1 - 0.001)'
)
})
})

test.describe('verify sketch on chamfer works', () => {
const _sketchOnAChamfer =
(
Expand Down Expand Up @@ -1681,8 +1787,7 @@ sketch002 = startSketchOn(XZ)
testPoint.x - 50,
testPoint.y
)
const sweepDeclaration =
'sweep001 = sweep(profile001, path = sketch002, sectional = false)'
const sweepDeclaration = 'sweep001 = sweep(profile001, path = sketch002)'
const editedSweepDeclaration =
'sweep001 = sweep(profile001, path = sketch002, sectional = true)'

Expand All @@ -1709,6 +1814,7 @@ sketch002 = startSketchOn(XZ)
stage: 'arguments',
})
await clickOnSketch1()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
commandName: 'Sweep',
currentArgKey: 'trajectory',
Expand All @@ -1722,7 +1828,18 @@ sketch002 = startSketchOn(XZ)
stage: 'arguments',
})
await clickOnSketch2()
await page.waitForTimeout(500)
await cmdBar.expectState({
commandName: 'Sweep',
currentArgKey: 'trajectory',
currentArgValue: '',
headerArguments: {
Sectional: '',
Target: '1 face',
Trajectory: '',
},
highlightedHeaderArg: 'trajectory',
stage: 'arguments',
})
await cmdBar.progressCmdBar()
await cmdBar.expectState({
commandName: 'Sweep',
Expand Down Expand Up @@ -1848,6 +1965,7 @@ sketch002 = startSketchOn(XZ)
stage: 'arguments',
})
await clickOnSketch1()
await cmdBar.progressCmdBar()
await cmdBar.expectState({
commandName: 'Sweep',
currentArgKey: 'trajectory',
Expand All @@ -1861,7 +1979,6 @@ sketch002 = startSketchOn(XZ)
stage: 'arguments',
})
await clickOnSketch2()
await page.waitForTimeout(500)
await cmdBar.progressCmdBar()
await expect(
page.getByText('Unable to sweep with the current selection. Reason:')
Expand Down Expand Up @@ -3513,6 +3630,7 @@ tag=$rectangleSegmentC002,
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar()

const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = X)`
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
Expand Down Expand Up @@ -3585,6 +3703,7 @@ sketch002 = startSketchOn(extrude001, face = rectangleSegmentA001)
await editor.scrollToText(codeToSelection)
await page.getByText(codeToSelection).click()
await toolbar.revolveButton.click()
await cmdBar.progressCmdBar()
await page.getByText('Edge', { exact: true }).click()
const lineCodeToSelection = `angledLine(angle = 0, length = 202.6, tag = $rectangleSegmentA001)`
await page.getByText(lineCodeToSelection).click()
Expand Down Expand Up @@ -3677,6 +3796,7 @@ sketch002 = startSketchOn(extrude001, face = rectangleSegmentA001)
await page.waitForTimeout(1000)
await editor.scrollToText(codeToSelection)
await page.getByText(codeToSelection).click()
await cmdBar.progressCmdBar()
await expect.poll(() => page.getByText('AxisOrEdge').count()).toBe(2)
await page.getByText('Edge', { exact: true }).click()
const lineCodeToSelection = `length = 2.6`
Expand Down
Loading