Skip to content

Commit 47dfd7b

Browse files
andrewvargagithub-actions[bot]franknoirotdavreev
authored
#8737 Align ortho camera to new engine camera (#8772)
* align ortho camera to new engine camera * Update snapshots * use viewHeightFactor * fmt * Fix up "drag to edit circle" test * Fix up "multiple sketches" test * Fix up "and can be continued" test * Fix up distance between constraint test * Fix up "perpendicular distance" test * Fix "scale other than default in sketch mode" test * fix test: Shift-click to select and deselect sketch segments * fmt * snap-to-grid test fixed * fix clickYAxis (broke with new camera zoom * fix some constraint tests * Test Length constraint fixes * Update two segment horizontal align test * Update two segment constraint tests * Fix Many segments - no modal constraints tests * fix Snap To X/Y constraint tests: clicking on axis broke --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <[email protected]> Co-authored-by: David Reeves <[email protected]>
1 parent 545804c commit 47dfd7b

9 files changed

+110
-146
lines changed

e2e/playwright/fixtures/sceneFixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export class SceneFixture {
318318
clickYAxis = async () => {
319319
const pointOnYAxis = await this.convertPagePositionToStream(
320320
0.5,
321-
0.25,
321+
0.7,
322322
'ratio'
323323
)
324324
await this.page.mouse.click(pointOnYAxis.x, pointOnYAxis.y)

e2e/playwright/point-click.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,8 @@ openSketch = startSketchOn(XY)
653653
// Colors
654654
// @pierremtb: had to tone these colors down a bit after the engine zoom fix
655655
// in https://github.com/KittyCAD/engine/pull/3804, unclear why
656-
const edgeColorWhite: [number, number, number] = [150, 150, 150]
657-
const edgeColorBlue: [number, number, number] = [10, 10, 150]
656+
const edgeColorWhite: [number, number, number] = [230, 230, 230]
657+
const edgeColorBlue: [number, number, number] = [23, 10, 247]
658658
const backgroundColor: [number, number, number] = [30, 30, 30]
659659
const tolerance = 50
660660
const timeout = 150

e2e/playwright/regression-tests.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as fsp from 'fs/promises'
77
import { TEST_CODE_TRIGGER_ENGINE_EXPORT_ERROR } from '@e2e/playwright/storageStates'
88
import type { TestColor } from '@e2e/playwright/test-utils'
99
import {
10+
NUMBER_REGEXP,
1011
TEST_COLORS,
1112
executorInputPath,
1213
getUtils,
@@ -822,7 +823,9 @@ washer = extrude(washerSketch, length = thicknessMax)`
822823

823824
// Just verify that the radius is the correct order of magnitude
824825
await editor.expectEditor.toContain(
825-
/circle\(sketch001, center = \[0\.04, -0\.06\], radius = 0\.\d+/
826+
new RegExp(
827+
`circle\\(sketch001, center = \\[${NUMBER_REGEXP}, ${NUMBER_REGEXP}\\], radius = 0\\.\\d+`
828+
)
826829
)
827830
})
828831

e2e/playwright/sketch-tests.spec.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,23 +307,21 @@ profile001 = startProfile(sketch001, at = [0.0, 0.0])`
307307
})
308308

309309
await test.step('drag circle radius handle', async () => {
310-
const magicYOnCircle = 0.8
310+
const magicYOnCircle = 0.68
311311
const fromPoint = { x: 0.5, y: magicYOnCircle }
312312
const toPoint = [fromPoint.x / 2, magicYOnCircle] as const
313313
const [dragRadiusHandle] = scene.makeDragHelpers(...toPoint, {
314314
debug: true,
315315
format: 'ratio',
316316
})
317317
await dragRadiusHandle({ fromPoint })
318-
await editor.expectEditor.not.toContain(prevContent)
319-
prevContent = await editor.getCurrentCode()
320318
})
321319

322320
await test.step('expect the code to have changed', async () => {
321+
await editor.expectEditor.not.toContain(prevContent)
323322
await editor.expectEditor.toContain(
324-
`sketch001 = startSketchOn(XZ)
325-
|> circle(center = [-0.18, 0.12], radius = 0.54)`,
326-
{ shouldNormalise: true }
323+
new RegExp(`sketch001 = startSketchOn(XZ)
324+
|> circle\\(center = \\[${NUMBER_REGEXP}, ${NUMBER_REGEXP}\\], radius = ${NUMBER_REGEXP}\\)`)
327325
)
328326
})
329327
})
@@ -404,10 +402,7 @@ sketch001 = startSketchOn(XZ)
404402
await editor.expectEditor.toContain(`|> xLine(length =`)
405403

406404
await click00r(0, 50)
407-
// @pierremtb: this used to create a yLine before the engine zoom fix
408-
// in https://github.com/KittyCAD/engine/pull/3804. I updated it to a line call
409-
// since it doesn't change the test objective
410-
await editor.expectEditor.toContain(`|> line(`)
405+
await editor.expectEditor.toContain(`|> yLine(`)
411406

412407
// exit the sketch, reset relative clicker
413408
await click00r(undefined, undefined)
@@ -1567,7 +1562,9 @@ profile002 = startProfile(sketch002, at = [0, 52.55])
15671562
await nextPoint()
15681563
await editor.openPane()
15691564
// A regex that just confirms the new segment is a line in a pipe
1570-
await expect(editor.codeContent).toContainText(/52\.55\]\)\s+\|\>\s+line\(/)
1565+
await expect(editor.codeContent).toContainText(
1566+
new RegExp(`${NUMBER_REGEXP}\\]\\)\\s+|>\\s+line\\(`)
1567+
)
15711568
})
15721569
test('old style sketch all in one pipe (with extrude) will break up to allow users to add a new profile to the same sketch', async ({
15731570
homePage,

e2e/playwright/snap-to-grid.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ test.describe('Snap to Grid', () => {
1111
await page.setBodyDimensions({ width: 1200, height: 500 })
1212
await homePage.goToModelingScene()
1313

14+
await page.waitForTimeout(1000)
15+
16+
// Ensure Fixed size grid is ON via Command Bar
17+
const commands = page.getByRole('button', { name: 'Commands' })
18+
await commands.click()
19+
await page
20+
.getByRole('option', {
21+
name: 'Settings · modeling · fixed size grid',
22+
})
23+
.click()
24+
await page.getByRole('option', { name: 'On', exact: true }).click()
25+
1426
// Enter sketch mode and select a default axis from the Feature Tree
1527
await toolbar.startSketchBtn.click()
1628
await toolbar.openFeatureTreePane()
@@ -37,6 +49,6 @@ test.describe('Snap to Grid', () => {
3749
await clickB()
3850

3951
// Check if snapping is working
40-
await editor.expectEditor.toContain('line(end = [0.15, 0.1])')
52+
await editor.expectEditor.toContain('line(end = [0.25, 0.25])')
4153
})
4254
})
Loading
Loading

e2e/playwright/testing-constraints.spec.ts

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,7 @@ test.describe('Testing constraints', () => {
148148
|> line(end = [74.36, 130.4], tag = $seg01)
149149
|> line(end = [78.92, -120.11])
150150
|> angledLine(angle = segAng(seg01), length = 78.33)
151-
|> line(end = [51.19, 48.97])
152-
part002 = startSketchOn(XZ)
153-
|> startProfile(at = [299.05, 231.45])
154-
|> xLine(length = -425.34, tag = $seg_what)
155-
|> yLine(length = -264.06)
156-
|> xLine(length = segLen(seg_what))
157-
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
151+
|> line(end = [51.19, 48.97])`
158152
)
159153
})
160154
const u = await getUtils(page)
@@ -265,13 +259,7 @@ test.describe('Testing constraints', () => {
265259
|> line(end = [74.36, 130.4])
266260
|> line(end = [78.92, -120.11])
267261
|> line(end = [9.16, 77.79])
268-
|> line(end = [51.19, 48.97])
269-
part002 = startSketchOn(XZ)
270-
|> startProfile(at = [299.05, 231.45])
271-
|> xLine(length = -425.34, tag = $seg_what)
272-
|> yLine(length = -264.06)
273-
|> xLine(length = segLen(seg_what))
274-
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])`
262+
|> line(end = [51.19, 48.97])`
275263
)
276264
})
277265
const u = await getUtils(page)
@@ -574,13 +562,13 @@ profile001 = startProfile(sketch001, at = [-70, -10])
574562
testName: 'Angle - Add variable',
575563
addVariable: true,
576564
constraint: 'angle',
577-
value: 'angle001, 78.33',
565+
value: 'angle001, 102.05',
578566
},
579567
{
580568
testName: 'Angle - No variable',
581569
addVariable: false,
582570
constraint: 'angle',
583-
value: '83deg, 78.33',
571+
value: '73deg, 102.05',
584572
},
585573
] as const
586574
for (const { testName, addVariable, value, constraint } of cases) {
@@ -594,8 +582,8 @@ profile001 = startProfile(sketch001, at = [-70, -10])
594582
|> startProfile(at = [-7.54, -26.74])
595583
|> line(end = [74.36, 130.4])
596584
|> line(end = [78.92, -120.11])
597-
|> line(end = [9.16, 77.79])
598-
|> line(end = [51.19, 48.97])
585+
|> line(end = [29.16, 97.79])
586+
|> line(end = [81.19, 68.97])
599587
part002 = startSketchOn(XZ)
600588
|> startProfile(at = [299.05, 231.45])
601589
|> xLine(length = -425.34, tag = $seg_what)
@@ -650,13 +638,13 @@ profile001 = startProfile(sketch001, at = [-70, -10])
650638
testName: 'Length - Add variable',
651639
addVariable: true,
652640
constraint: 'length',
653-
value: '83deg, length001',
641+
value: '73deg, length001',
654642
},
655643
{
656644
testName: 'Length - No variable',
657645
addVariable: false,
658646
constraint: 'length',
659-
value: '83deg, 78.33',
647+
value: '73deg, 102.05',
660648
},
661649
] as const
662650
for (const { testName, addVariable, value, constraint } of cases) {
@@ -684,8 +672,8 @@ part001 = startSketchOn(XZ)
684672
|> startProfile(at = [-7.54, -26.74])
685673
|> line(end = [74.36, 130.4])
686674
|> line(end = [78.92, -120.11])
687-
|> line(end = [9.16, 77.79])
688-
|> line(end = [51.19, 48.97])
675+
|> line(end = [29.16, 97.79])
676+
|> line(end = [81.19, 68.97])
689677
part002 = startSketchOn(XZ)
690678
|> startProfile(at = [299.05, 231.45])
691679
|> xLine(length = -425.34, tag = $seg_what)
@@ -720,7 +708,7 @@ part002 = startSketchOn(XZ)
720708
await cmdBarKclVariableNameInput.press('Backspace')
721709
})
722710
}
723-
await expect(cmdBarKclInput).toHaveText('78.33')
711+
await expect(cmdBarKclInput).toHaveText('102.05')
724712
await page.waitForTimeout(500)
725713
const [ang, len] = value.split(', ')
726714
await cmdBar.continue()
@@ -741,15 +729,15 @@ part002 = startSketchOn(XZ)
741729
constraintName: 'Vertical',
742730
codeAfter: [
743731
`|> yLine(length = 130.4)`,
744-
`|> yLine(length = 77.79)`,
745-
`|> yLine(length = 48.97)`,
732+
`|> yLine(length = 97.79)`,
733+
`|> yLine(length = 78.97)`,
746734
],
747735
},
748736
{
749737
codeAfter: [
750738
`|> xLine(length = 74.36)`,
751-
`|> xLine(length = 9.16)`,
752-
`|> xLine(length = 51.19)`,
739+
`|> xLine(length = 29.16)`,
740+
`|> xLine(length = 81.19)`,
753741
],
754742
constraintName: 'Horizontal',
755743
},
@@ -765,8 +753,8 @@ part002 = startSketchOn(XZ)
765753
|> startProfile(at = [-7.54, -26.74])
766754
|> line(end = [74.36, 130.4])
767755
|> line(end = [78.92, -120.11])
768-
|> line(end = [9.16, 77.79])
769-
|> line(end = [51.19, 48.97])
756+
|> line(end = [29.16, 97.79])
757+
|> line(end = [81.19, 78.97])
770758
part002 = startSketchOn(XZ)
771759
|> startProfile(at = [299.05, 231.45])
772760
|> xLine(length = -425.34, tag = $seg_what)
@@ -834,19 +822,19 @@ part002 = startSketchOn(XZ)
834822
test.describe('Two segment - no modal constraints', () => {
835823
const cases = [
836824
{
837-
codeAfter: `|> angledLine(angle = 83deg, length = segLen(seg01))`,
825+
codeAfter: `|> angledLine(angle = 73deg, length = segLen(seg01))`,
838826
constraintName: 'Equal Length',
839827
},
840828
{
841-
codeAfter: `|> angledLine(angle = segAng(seg01), length = 78.33)`,
829+
codeAfter: `|> angledLine(angle = segAng(seg01), length = 102.05)`,
842830
constraintName: 'Parallel',
843831
},
844832
{
845-
codeAfter: `|> line(endAbsolute = [segEndX(seg01), 61.34])`,
833+
codeAfter: `|> line(endAbsolute = [segEndX(seg01), 81.34])`,
846834
constraintName: 'Vertically Align',
847835
},
848836
{
849-
codeAfter: `|> line(endAbsolute = [154.9, segEndY(seg01)])`,
837+
codeAfter: `|> line(endAbsolute = [174.9, segEndY(seg01)])`,
850838
constraintName: 'Horizontally Align',
851839
},
852840
] as const
@@ -861,7 +849,7 @@ part002 = startSketchOn(XZ)
861849
|> startProfile(at = [-7.54, -26.74])
862850
|> line(end = [74.36, 130.4])
863851
|> line(end = [78.92, -120.11])
864-
|> line(end = [9.16, 77.79])
852+
|> line(end = [29.16, 97.79])
865853
part002 = startSketchOn(XZ)
866854
|> startProfile(at = [299.05, 231.45])
867855
|> xLine(length = -425.34, tag = $seg_what)
@@ -923,7 +911,7 @@ part002 = startSketchOn(XZ)
923911
const cases = [
924912
{
925913
codeAfter: /\|> line\(endAbsolute = \[\d+(\.\d+)?, turns::ZERO/,
926-
axisClick: { x: 0.75, y: 0.5 },
914+
axisClick: { x: 0.25, y: 0.5 },
927915
constraintName: 'Snap To X',
928916
},
929917
{

0 commit comments

Comments
 (0)