Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion e2e/playwright/feature-tree-pane.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ profile003 = startProfile(sketch001, at = [0, -4.93])
})
// One dumb hardcoded screen pixel value
const testPoint = { x: 650, y: 250 }
const sketchColor: [number, number, number] = [149, 149, 149]
const sketchColor: [number, number, number] = [187, 187, 187]
const planeColor: [number, number, number] = [74, 74, 74]

await homePage.openProject('test-sample')
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/point-click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ extrude001 = extrude(sketch001, length = 30)

// One dumb hardcoded screen pixel value
// Any idea here how to select a cap without clicking in the scene?
const testPoint = { x: 575, y: 200 }
const testPoint = { x: 490, y: 200 }
const [clickOnCap] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
const shellDeclaration =
'shell001 = shell(extrude001, faces = END, thickness = 5)'
Expand Down
15 changes: 2 additions & 13 deletions e2e/playwright/prompt-to-edit-snapshot-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,8 @@ test.describe('edit with AI example snapshots', () => {
await homePage.openProject(project)
await scene.settled(cmdBar)

const body1CapCoords = { x: 571, y: 351 }
const [clickBody1Cap] = scene.makeMouseHelpers(
body1CapCoords.x,
body1CapCoords.y
)

await test.step('wait for scene to load select body and check selection came through', async () => {
await clickBody1Cap()
await editor.expectState({
highlightedCode: '',
activeLines: ['|>startProfile(at=[-73.64,-42.89])'],
diagnostics: [],
})
await test.step('wait for scene to load select body', async () => {
await editor.selectText('startProfile(at = [-73.64, -42.89])')
})

await test.step('fire off edit prompt', async () => {
Expand Down
16 changes: 5 additions & 11 deletions e2e/playwright/regression-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,9 @@ extrude002 = extrude(profile002, length = 150)`
'ratio'
)

await scene.expectPixelColor(
TEST_COLORS.DARK_MODE_BKGD,
offModelBefore,
15
)
// not sure why old DARK_MODE_BKGD doesn't work anymore
const bgColor: [number, number, number] = [30, 30, 30]
await scene.expectPixelColor(bgColor, offModelBefore, 15)
const standardModelGrey: TestColor = [100, 100, 100]
await scene.expectPixelColor(standardModelGrey, onModelBefore, 15)

Expand All @@ -371,11 +369,7 @@ extrude002 = extrude(profile002, length = 150)`
'ratio'
)

await scene.expectPixelColor(
TEST_COLORS.DARK_MODE_BKGD,
offModelAfter,
15
)
await scene.expectPixelColor(bgColor, offModelAfter, 15)
await scene.expectPixelColor(standardModelGrey, onModelAfter, 15)
}
)
Expand Down Expand Up @@ -591,7 +585,7 @@ extrude002 = extrude(profile002, length = 150)`

// Constants and locators
const planeColor: [number, number, number] = [80, 60, 60]
const bgColor: [number, number, number] = [30, 30, 30]
const bgColor: [number, number, number] = TEST_COLORS.DARK_MODE_BKGD
const middlePixelIsColor = async (color: [number, number, number]) => {
return u.getGreatestPixDiff({ x: 600, y: 250 }, color)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion e2e/playwright/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const TEST_COLORS: { [key: string]: TestColor } = {
GREY: [142, 142, 142],
YELLOW: [255, 255, 0],
BLUE: [0, 0, 255],
DARK_MODE_BKGD: [27, 27, 27],
DARK_MODE_BKGD: [86, 66, 107],
DARK_MODE_PLANE_XZ: [50, 50, 99],
} as const

Expand Down
10 changes: 5 additions & 5 deletions e2e/playwright/testing-constraints.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test.describe('Testing constraints', () => {
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1200, height: 500 })
await page.setBodyDimensions({ width: 1200, height: 800 })

await homePage.goToModelingScene()
await scene.settled(cmdBar)
Expand Down Expand Up @@ -275,7 +275,7 @@ test.describe('Testing constraints', () => {
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1000, height: 500 })
await page.setBodyDimensions({ width: 1200, height: 800 })

await homePage.goToModelingScene()
await scene.settled(cmdBar)
Expand Down Expand Up @@ -605,7 +605,7 @@ profile001 = startProfile(sketch001, at = [-70, -10])
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1000, height: 500 })
await page.setBodyDimensions({ width: 1200, height: 800 })

await homePage.goToModelingScene()
await scene.settled(cmdBar)
Expand Down Expand Up @@ -695,7 +695,7 @@ part002 = startSketchOn(XZ)
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1200, height: 500 })
await page.setBodyDimensions({ width: 1200, height: 800 })

await homePage.goToModelingScene()
await scene.settled(cmdBar)
Expand Down Expand Up @@ -776,7 +776,7 @@ part002 = startSketchOn(XZ)
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1000, height: 500 })
await page.setBodyDimensions({ width: 1200, height: 800 })

await homePage.goToModelingScene()
await scene.settled(cmdBar)
Expand Down
22 changes: 5 additions & 17 deletions e2e/playwright/testing-gizmo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,15 @@ test.describe(`Testing gizmo, fixture-based`, () => {
await test.step(`Setup`, async () => {
await scene.expectState({
camera: {
position: [11796.52, -39216.59, 21103.27],
position: [36352.69, -25191.17, 27757.58],
target: [11796.52, -635, 3201.42],
},
})
})
const [clickCircle, moveToCircle] = scene.makeMouseHelpers(
582 / bodyDimensions.width,
217 / bodyDimensions.height,
{ format: 'ratio' }
)

await test.step(`Select an edge of this circle`, async () => {
const circleSnippet = 'circle(center = [818.33, 168.1], radius = 182.8)'
await moveToCircle()
await clickCircle()
await editor.openPane()
await editor.expectState({
activeLines: ['|>' + circleSnippet],
highlightedCode: '',
diagnostics: [],
})
const circleSnippet = 'circle(center = [818.33, 168.1], radius = 182.8)'
await editor.selectText(circleSnippet)
await editor.closePane()
})

Expand All @@ -317,8 +305,8 @@ test.describe(`Testing gizmo, fixture-based`, () => {
await test.step(`Verify the camera moved`, async () => {
await scene.expectState({
camera: {
position: [20785.58, -39851.59, 22171.6],
target: [20785.58, -1270, 4269.74],
position: [24556.17, -24556.17, 24556.17],
target: [0, 0, 0],
},
})
})
Expand Down
35 changes: 13 additions & 22 deletions src/lib/resetCameraPosition.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
import { isPlaywright } from '@src/lib/isPlaywright'
import {
engineCommandManager,
sceneInfra,
settingsActor,
} from '@src/lib/singletons'
import { engineStreamZoomToFit, engineViewIsometric } from '@src/lib/utils'
import { engineViewIsometric } from '@src/lib/utils'

/**
* Reset the camera position to a baseline, which is isometric for
* normal users and a deprecated "front-down" view for playwright tests.
*
* Gotcha: Playwright E2E tests will be zoom_to_fit, when you try to recreate the e2e test manually
* your localhost will do view_isometric. Turn this boolean on to have the same experience when manually
* debugging e2e tests
* normal users.
*/
export async function resetCameraPosition() {
// We need a padding of 0.1 for zoom_to_fit for all E2E tests since they were originally
// written with zoom_to_fit with padding 0.1
const padding = 0.1
if (isPlaywright()) {
await engineStreamZoomToFit({ engineCommandManager, padding })
} else {
// Get user camera projection
const cameraProjection =
settingsActor.getSnapshot().context.modeling.cameraProjection.current
// Get user camera projection
const cameraProjection =
settingsActor.getSnapshot().context.modeling.cameraProjection.current

// We need to keep the users projection setting when resetting their camera
if (cameraProjection === 'perspective') {
await sceneInfra.camControls.usePerspectiveCamera()
}

await engineViewIsometric({
engineCommandManager,
padding,
})
// We need to keep the users projection setting when resetting their camera
if (cameraProjection === 'perspective') {
await sceneInfra.camControls.usePerspectiveCamera()
}

await engineViewIsometric({
engineCommandManager,
padding,
})
}
Loading