Clean up and working pw test

This commit is contained in:
Pierre Jacquier
2024-12-03 13:49:26 -05:00
parent df3e541cdf
commit 4347e0cf84
4 changed files with 23 additions and 43 deletions

View File

@ -687,18 +687,18 @@ test(`Loft point-and-click`, async ({
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn('XZ')
|> circle({ center = [0, 0], radius = 10 }, %)
plane001 = offsetPlane('XZ', 20)
|> circle({ center = [0, 0], radius = 30 }, %)
plane001 = offsetPlane('XZ', 50)
sketch002 = startSketchOn(plane001)
|> circle({ center = [0, 0], radius = 5 }, %)
|> circle({ center = [0, 0], radius = 20 }, %)
`
await app.initialise(initialCode)
// One dumb hardcoded screen pixel value
const testPoint = { x: 575, y: 200 }
const [clickOnSketch1] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const [clickOnSketch2] = scene.makeMouseHelpers(testPoint.x, testPoint.y + 50)
const expectedOutput = `${initialCode}loft001 = loft([sketch001, sketch002])`
const [clickOnSketch2] = scene.makeMouseHelpers(testPoint.x, testPoint.y + 80)
const loftDeclaration = 'loft001 = loft([sketch001, sketch002])'
await test.step(`Look for the white of the sketch001 shape`, async () => {
await scene.expectPixelColor([254, 254, 254], testPoint, 15)
@ -716,6 +716,8 @@ sketch002 = startSketchOn(plane001)
await clickOnSketch1()
await page.keyboard.down('Shift')
await clickOnSketch2()
await app.page.waitForTimeout(500)
await page.keyboard.up('Shift')
await cmdBar.progressCmdBar()
await cmdBar.expectState({
stage: 'review',
@ -726,12 +728,12 @@ sketch002 = startSketchOn(plane001)
})
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
await editor.expectEditor.toContain(expectedOutput)
await editor.expectEditor.toContain(loftDeclaration)
await editor.expectState({
diagnostics: [],
activeLines: [expectedOutput],
activeLines: [loftDeclaration],
highlightedCode: '',
})
await scene.expectPixelColor([74, 74, 74], testPoint, 15)
await scene.expectPixelColor([109, 109, 109], testPoint, 15)
})
})