Skip to content

Commit

Permalink
change circle in all test js files
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Feb 27, 2025
1 parent 8d8fb5e commit 8e60b55
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 81 deletions.
2 changes: 1 addition & 1 deletion e2e/playwright/editor-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
await page.keyboard.type(`extrusion = startSketchOn('XY')
|> circle({ center: [0, 0], radius: dia/2 }, %)
|> circle(center: [0, 0], radius: dia/2)
|> hole(squareHole(length, width, height), %)
|> extrude(length = height)`)

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 @@ -50,13 +50,13 @@ const FEATURE_TREE_SKETCH_CODE = `sketch001 = startSketchOn('XZ')
|> close(%)
extrude001 = extrude(sketch001, length = 10)
sketch002 = startSketchOn(extrude001, rectangleSegmentB001)
|> circle({
|> circle(
center = [-1, 2],
radius = .5
}, %)
)
plane001 = offsetPlane('XZ', offset = -5)
sketch003 = startSketchOn(plane001)
|> circle({ center = [0, 0], radius = 5 }, %)
|> circle(center = [0, 0], radius = 5)
`

test.describe('Feature Tree pane', () => {
Expand Down Expand Up @@ -234,11 +234,11 @@ test.describe('Feature Tree pane', () => {
}) => {
const initialInput = '23'
const initialCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 5 }, %)
|> circle(center = [0, 0], radius = 5)
renamedExtrude = extrude(sketch001, length = ${initialInput})`
const newConstantName = 'distance001'
const expectedCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 5 }, %)
|> circle(center = [0, 0], radius = 5)
${newConstantName} = 23
renamedExtrude = extrude(sketch001, length = ${newConstantName})`

Expand Down
57 changes: 29 additions & 28 deletions e2e/playwright/point-click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe('Point-and-click tests', () => {
await test.step('check code model connection works and that button is still enable once circle is selected ', async () => {
await moveToCircle()
const circleSnippet =
'circle({ center = [318.33, 168.1], radius = 182.8 }, %)'
'circle(center = [318.33, 168.1], radius = 182.8)'
await editor.expectState({
activeLines: ["constsketch002=startSketchOn('XZ')"],
highlightedCode: circleSnippet,
Expand All @@ -53,7 +53,7 @@ test.describe('Point-and-click tests', () => {
await test.step('check code model connection works and that button is still enable once circle is selected ', async () => {
await moveToCircle()
const circleSnippet =
'circle({ center = [318.33, 168.1], radius = 182.8 }, %)'
'circle(center = [318.33, 168.1], radius = 182.8)'
await editor.expectState({
activeLines: ["constsketch002=startSketchOn('XZ')"],
highlightedCode: circleSnippet,
Expand Down Expand Up @@ -581,7 +581,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
const u = await getUtils(page)

const initialCode = `closedSketch = startSketchOn('XZ')
|> circle({ center = [8, 5], radius = 2 }, %)
|> circle(center = [8, 5], radius = 2)
openSketch = startSketchOn('XY')
|> startProfileAt([-5, 0], %)
|> line(endAbsolute = [0, 5])
Expand Down Expand Up @@ -633,8 +633,8 @@ openSketch = startSketchOn('XY')
await expect(toolbar.startSketchBtn).not.toBeVisible()
await expect(toolbar.exitSketchBtn).toBeVisible()
await editor.expectState({
activeLines: [`|>circle({center=[8,5],radius=2},%)`],
highlightedCode: 'circle({center=[8,5],radius=2},%)',
activeLines: [`|>circle(center=[8,5],radius=2)`],
highlightedCode: 'circle(center=[8,5],radius=2)',
diagnostics: [],
})
})
Expand Down Expand Up @@ -1192,10 +1192,10 @@ openSketch = startSketchOn('XY')
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 30 }, %)
|> circle(center = [0, 0], radius = 30)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
|> circle({ center = [0, 0], radius = 20 }, %)
|> circle(center = [0, 0], radius = 20)
`
await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode)
Expand Down Expand Up @@ -1278,10 +1278,10 @@ openSketch = startSketchOn('XY')
scene,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 30 }, %)
|> circle(center = [0, 0], radius = 30)
plane001 = offsetPlane('XZ', offset = 50)
sketch002 = startSketchOn(plane001)
|> circle({ center = [0, 0], radius = 20 }, %)
|> circle(center = [0, 0], radius = 20)
loft001 = loft([sketch001, sketch002])
`
await context.addInitScript((initialCode) => {
Expand All @@ -1304,7 +1304,7 @@ loft001 = loft([sketch001, sketch002])
await scene.expectPixelColor([89, 89, 89], testPoint, 15)
await clickOnSketch1()
await expect(page.locator('.cm-activeLine')).toHaveText(`
|> circle({ center = [0, 0], radius = 30 }, %)
|> circle(center = [0, 0], radius = 30)
`)
await page.keyboard.press('Delete')
// Check for sketch 1
Expand All @@ -1315,7 +1315,7 @@ loft001 = loft([sketch001, sketch002])
await page.waitForTimeout(1000)
await clickOnSketch2()
await expect(page.locator('.cm-activeLine')).toHaveText(`
|> circle({ center = [0, 0], radius = 20 }, %)
|> circle(center = [0, 0], radius = 20)
`)
await page.keyboard.press('Delete')
// Check for plane001
Expand Down Expand Up @@ -1344,10 +1344,10 @@ loft001 = loft([sketch001, sketch002])
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
|> circle({
|> circle(
center = [0, 0],
radius = 500
}, %)
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
Expand Down Expand Up @@ -1438,10 +1438,10 @@ sketch002 = startSketchOn('XZ')
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
|> circle({
|> circle(
center = [0, 0],
radius = 500
}, %)
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-500, %)
Expand Down Expand Up @@ -2270,7 +2270,7 @@ chamfer04 = chamfer(extrude001, length = 5, tags = [getOppositeEdge(seg02)])
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 30 }, %)
|> circle(center = [0, 0], radius = 30)
extrude001 = extrude(sketch001, length = 30)
`
await context.addInitScript((initialCode) => {
Expand Down Expand Up @@ -2445,19 +2445,19 @@ extrude001 = extrude(sketch001, length = 40)

const shellSketchOnFacesCases = [
`sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 100 }, %)
|> circle(center = [0, 0], radius = 100)
|> extrude(length = 100)
sketch002 = startSketchOn(sketch001, 'END')
|> circle({ center = [0, 0], radius = 50 }, %)
|> circle(center = [0, 0], radius = 50)
|> extrude(length = 50)
`,
`sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 100 }, %)
|> circle(center = [0, 0], radius = 100)
extrude001 = extrude(sketch001, length = 100)
sketch002 = startSketchOn(extrude001, 'END')
|> circle({ center = [0, 0], radius = 50 }, %)
|> circle(center = [0, 0], radius = 50)
extrude002 = extrude(sketch002, length = 50)
`,
]
Expand Down Expand Up @@ -2631,10 +2631,10 @@ profile001 = startProfileAt([-20, 20], sketch001)
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('YZ')
|> circle({
|> circle(
center = [0, 0],
radius = 500
}, %)
)
sketch002 = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> xLine(-2000, %)
Expand Down Expand Up @@ -2761,10 +2761,10 @@ segAng(rectangleSegmentA001),
|> close()
extrude001 = extrude(sketch001, length = 50)
sketch002 = startSketchOn(extrude001, rectangleSegmentA001)
|> circle({
|> circle(
center = [-11.34, 10.0],
radius = 8.69
}, %)
)
`
await context.addInitScript((initialCode) => {
localStorage.setItem('persistCode', initialCode)
Expand Down Expand Up @@ -2811,10 +2811,10 @@ radius = 8.69
|> close()
extrude001 = extrude(sketch001, length = 5)
sketch003 = startSketchOn(extrude001, 'START')
|> circle({
|> circle(
center = [-0.69, 0.56],
radius = 0.28
}, %)
)
`

await context.addInitScript((initialCode) => {
Expand Down Expand Up @@ -2849,10 +2849,11 @@ radius = 8.69
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
profile001 = circle({
profile001 = circle(
sketch001,
center = [0, 0],
radius = 100
}, sketch001)
)
extrude001 = extrude(profile001, length = 100)
`
await context.addInitScript((initialCode) => {
Expand Down
37 changes: 20 additions & 17 deletions e2e/playwright/sketch-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
|> circle({ center = [4.61, -5.01], radius = 8 }, %)`
|> circle(center = [4.61, -5.01], radius = 8 )`
)
})

Expand Down Expand Up @@ -404,7 +404,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
const dragPX = 40

await page
.getByText('circle({ center = [4.61, -5.01], radius = 8 }, %)')
.getByText('circle(center = [4.61, -5.01], radius = 8)')
.click()
await expect(
page.getByRole('button', { name: 'Edit Sketch' })
Expand Down Expand Up @@ -444,7 +444,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')
|> circle({ center = [7.26, -2.37], radius = 11.44 }, %)`,
|> circle(center = [7.26, -2.37], radius = 11.44)`,
{ shouldNormalise: true }
)
})
Expand Down Expand Up @@ -1390,12 +1390,12 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
await toolbar.circleBtn.click()
await page.waitForTimeout(100)
await circlePoint1()
await editor.expectEditor.toContain('profile003 = circle({ center = [')
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({')
await editor.expectEditor.not.toContain('profile003 = circle(')
})

const [circle3Point1] = scene.makeMouseHelpers(650, 200)
Expand Down Expand Up @@ -1649,7 +1649,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await circle1Radius({ delay: 500 })
await page.waitForTimeout(300)
await editor.expectEditor.toContain(
`profile003 = circle({ center = [23.19, 6.98], radius = 2.5 }, sketch001)`
`profile003 = circle(sketch001, center = [23.19, 6.98], radius = 2.5)`
)

await test.step('hover in empty space to wait for overlays to get out of the way', async () => {
Expand All @@ -1661,7 +1661,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await page.waitForTimeout(300)
await circle2Radius()
await editor.expectEditor.toContain(
`profile004 = circle({ center = [23.74, 1.9], radius = 0.72 }, sketch001)`
`profile004 = circle(sketch001, center = [23.74, 1.9], radius = 0.72)`
)
})
await test.step('create two corner rectangles in a row without unequip', async () => {
Expand Down Expand Up @@ -1855,7 +1855,7 @@ profile002 = startProfileAt([11.19, 5.02], sketch001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile003 = circle({ center = [6.92, -4.2], radius = 3.16 }, sketch001)
profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07], p3 = [18.75, -4.41])
`
)
Expand Down Expand Up @@ -1931,7 +1931,7 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await dragCircleTo()
await page.mouse.up()
await editor.expectEditor.toContain(
`profile003 = circle({ center = [6.92, -4.2], radius = 4.81 }, sketch001)`
`profile003 = circle(sketch001, center = [6.92, -4.2], radius = 4.81)`
)
})

Expand Down Expand Up @@ -2000,7 +2000,7 @@ profile002 = startProfileAt([11.19, 5.02], sketch001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile003 = circle({ center = [6.92, -4.2], radius = 3.16 }, sketch001)
profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
`
)
})
Expand Down Expand Up @@ -2108,10 +2108,11 @@ profile003 = startProfileAt([16.79, 38.24], sketch001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile004 = circle({
profile004 = circle(
sketch001,
center = [280.45, 47.57],
radius = 55.26
}, sketch001)
)
extrude002 = extrude(profile001, length = 50)
extrude001 = extrude(profile003, length = 5)
`
Expand Down Expand Up @@ -2173,10 +2174,11 @@ extrude001 = extrude(profile003, length = 5)
'myVar = 5',
`myVar = 5
sketch001 = startSketchOn('XZ')
profile001 = circle({
profile001 = circle(
sketch001,
center = [12.41, 3.87],
radius = myVar
}, sketch001)`
)`
)

await scene.expectPixelColor([255, 255, 255], { x: 633, y: 211 }, 15)
Expand Down Expand Up @@ -2320,7 +2322,7 @@ profile004 = startProfileAt([3.15, 9.39], sketch002)
|> line(end = [-7.41, -2.85])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile005 = circle({ center = [5.15, 4.34], radius = 1.66 }, sketch002)
profile005 = circle(sketch002, center = [5.15, 4.34], radius = 1.66)
profile006 = startProfileAt([9.65, 3.82], sketch002)
|> line(end = [2.38, 5.62])
|> line(end = [2.13, -5.57])
Expand All @@ -2345,10 +2347,11 @@ profile009 = startProfileAt([5.23, 1.95], sketch003)
|> line(end = [7.34, -2.75])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
profile010 = circle({
profile010 = circle(
sketch003,
center = [7.18, -2.11],
radius = 2.67
}, sketch003)
)
profile011 = startProfileAt([5.07, -6.39], sketch003)
|> angledLine([0, 4.54], %, $rectangleSegmentA002)
|> angledLine([
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/snapshot-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ test(
mask: [page.getByTestId('model-state-indicator')],
})
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('XZ')profile001 = circle({ center = [14.44, -2.44], radius = 1 }, sketch001)`
`sketch001 = startSketchOn('XZ')profile001 = circle(sketch001, center = [14.44, -2.44], radius = 1)`
)
}
)
Expand Down
Loading

0 comments on commit 8e60b55

Please sign in to comment.