Add rectangle based sweep test case
This commit is contained in:
@ -1333,7 +1333,41 @@ loft001 = loft([sketch001, sketch002])
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test(`Sweep point-and-click base`, async ({
|
const sweepCases = [
|
||||||
|
{
|
||||||
|
targetType: 'circle',
|
||||||
|
testPoint: { x: 700, y: 250 },
|
||||||
|
initialCode: `sketch001 = startSketchOn('YZ')
|
||||||
|
profile001 = circle(sketch001, center = [0, 0], radius = 500)
|
||||||
|
sketch002 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> xLine(length = -500)
|
||||||
|
|> tangentialArcTo([-2000, 500], %)`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targetType: 'rectangle',
|
||||||
|
testPoint: { x: 710, y: 255 },
|
||||||
|
initialCode: `sketch001 = startSketchOn('YZ')
|
||||||
|
profile001 = startProfileAt([-400, -400], sketch001)
|
||||||
|
|> angledLine([0, 800], %, $rectangleSegmentA001)
|
||||||
|
|> angledLine([
|
||||||
|
segAng(rectangleSegmentA001) + 90,
|
||||||
|
800
|
||||||
|
], %)
|
||||||
|
|> angledLine([
|
||||||
|
segAng(rectangleSegmentA001),
|
||||||
|
-segLen(rectangleSegmentA001)
|
||||||
|
], %)
|
||||||
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|
|> close()
|
||||||
|
sketch002 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> xLine(length = -500)
|
||||||
|
|> tangentialArcTo([-2000, 500], %)`,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
sweepCases.map(({ initialCode, targetType, testPoint }) => {
|
||||||
|
test(`Sweep point-and-click ${targetType}`, async ({
|
||||||
context,
|
context,
|
||||||
page,
|
page,
|
||||||
homePage,
|
homePage,
|
||||||
@ -1342,16 +1376,6 @@ loft001 = loft([sketch001, sketch002])
|
|||||||
toolbar,
|
toolbar,
|
||||||
cmdBar,
|
cmdBar,
|
||||||
}) => {
|
}) => {
|
||||||
const initialCode = `sketch001 = startSketchOn('YZ')
|
|
||||||
|> circle(
|
|
||||||
center = [0, 0],
|
|
||||||
radius = 500
|
|
||||||
)
|
|
||||||
sketch002 = startSketchOn('XZ')
|
|
||||||
|> startProfileAt([0, 0], %)
|
|
||||||
|> xLine(length = -500)
|
|
||||||
|> tangentialArcTo([-2000, 500], %)
|
|
||||||
`
|
|
||||||
await context.addInitScript((initialCode) => {
|
await context.addInitScript((initialCode) => {
|
||||||
localStorage.setItem('persistCode', initialCode)
|
localStorage.setItem('persistCode', initialCode)
|
||||||
}, initialCode)
|
}, initialCode)
|
||||||
@ -1360,16 +1384,15 @@ sketch002 = startSketchOn('XZ')
|
|||||||
await scene.waitForExecutionDone()
|
await scene.waitForExecutionDone()
|
||||||
|
|
||||||
// One dumb hardcoded screen pixel value
|
// One dumb hardcoded screen pixel value
|
||||||
const testPoint = { x: 700, y: 250 }
|
|
||||||
const [clickOnSketch1] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
const [clickOnSketch1] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||||
const [clickOnSketch2] = scene.makeMouseHelpers(
|
const [clickOnSketch2] = scene.makeMouseHelpers(
|
||||||
testPoint.x - 50,
|
testPoint.x - 50,
|
||||||
testPoint.y
|
testPoint.y
|
||||||
)
|
)
|
||||||
const sweepDeclaration =
|
const sweepDeclaration =
|
||||||
'sweep001 = sweep(sketch001, path = sketch002, sectional = false)'
|
'sweep001 = sweep(profile001, path = sketch002, sectional = false)'
|
||||||
const editedSweepDeclaration =
|
const editedSweepDeclaration =
|
||||||
'sweep001 = sweep(sketch001, path = sketch002, sectional = true)'
|
'sweep001 = sweep(profile001, path = sketch002, sectional = true)'
|
||||||
|
|
||||||
await test.step(`Look for sketch001`, async () => {
|
await test.step(`Look for sketch001`, async () => {
|
||||||
await toolbar.closePane('code')
|
await toolbar.closePane('code')
|
||||||
@ -1421,12 +1444,16 @@ sketch002 = startSketchOn('XZ')
|
|||||||
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||||
await toolbar.openPane('code')
|
await toolbar.openPane('code')
|
||||||
await editor.expectEditor.toContain(sweepDeclaration)
|
await editor.expectEditor.toContain(sweepDeclaration)
|
||||||
|
await scene.expectPixelColor([120, 120, 120], testPoint, 40)
|
||||||
await toolbar.closePane('code')
|
await toolbar.closePane('code')
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('Edit sweep via feature tree selection works', async () => {
|
await test.step('Edit sweep via feature tree selection works', async () => {
|
||||||
await toolbar.openPane('feature-tree')
|
await toolbar.openPane('feature-tree')
|
||||||
const operationButton = await toolbar.getFeatureTreeOperation('Sweep', 0)
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Sweep',
|
||||||
|
0
|
||||||
|
)
|
||||||
await operationButton.dblclick({ button: 'left' })
|
await operationButton.dblclick({ button: 'left' })
|
||||||
await cmdBar.expectState({
|
await cmdBar.expectState({
|
||||||
commandName: 'Sweep',
|
commandName: 'Sweep',
|
||||||
@ -1456,7 +1483,10 @@ sketch002 = startSketchOn('XZ')
|
|||||||
await test.step('Delete sweep via feature tree selection', async () => {
|
await test.step('Delete sweep via feature tree selection', async () => {
|
||||||
await toolbar.openPane('feature-tree')
|
await toolbar.openPane('feature-tree')
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
const operationButton = await toolbar.getFeatureTreeOperation('Sweep', 0)
|
const operationButton = await toolbar.getFeatureTreeOperation(
|
||||||
|
'Sweep',
|
||||||
|
0
|
||||||
|
)
|
||||||
await operationButton.click({ button: 'left' })
|
await operationButton.click({ button: 'left' })
|
||||||
await page.keyboard.press('Delete')
|
await page.keyboard.press('Delete')
|
||||||
await page.waitForTimeout(500)
|
await page.waitForTimeout(500)
|
||||||
@ -1464,6 +1494,7 @@ sketch002 = startSketchOn('XZ')
|
|||||||
await scene.expectPixelColor([53, 53, 53], testPoint, 15)
|
await scene.expectPixelColor([53, 53, 53], testPoint, 15)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test(`Sweep point-and-click failing validation`, async ({
|
test(`Sweep point-and-click failing validation`, async ({
|
||||||
context,
|
context,
|
||||||
|
Reference in New Issue
Block a user