2024-09-26 18:25:05 +10:00
|
|
|
import type { Page, Locator } from '@playwright/test'
|
|
|
|
import { expect } from '@playwright/test'
|
2025-02-15 00:57:04 +11:00
|
|
|
import { isArray, uuidv4 } from 'lib/utils'
|
2024-09-26 18:25:05 +10:00
|
|
|
import {
|
|
|
|
closeDebugPanel,
|
|
|
|
doAndWaitForImageDiff,
|
2024-10-02 13:15:40 +10:00
|
|
|
getPixelRGBs,
|
2024-09-26 18:25:05 +10:00
|
|
|
openAndClearDebugPanel,
|
|
|
|
sendCustomCmd,
|
2024-10-01 07:56:04 +10:00
|
|
|
} from '../test-utils'
|
2024-09-26 18:25:05 +10:00
|
|
|
|
2025-02-15 00:57:04 +11:00
|
|
|
type MouseParams = {
|
2024-10-31 07:04:38 -07:00
|
|
|
pixelDiff?: number
|
2025-02-15 00:57:04 +11:00
|
|
|
shouldDbClick?: boolean
|
|
|
|
delay?: number
|
2024-10-31 07:04:38 -07:00
|
|
|
}
|
2025-02-15 00:57:04 +11:00
|
|
|
type MouseDragToParams = MouseParams & {
|
2024-10-31 07:04:38 -07:00
|
|
|
fromPoint: { x: number; y: number }
|
|
|
|
}
|
2025-02-15 00:57:04 +11:00
|
|
|
type MouseDragFromParams = MouseParams & {
|
2024-10-31 07:04:38 -07:00
|
|
|
toPoint: { x: number; y: number }
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
|
|
|
|
2024-10-04 13:47:44 -07:00
|
|
|
type SceneSerialised = {
|
|
|
|
camera: {
|
|
|
|
position: [number, number, number]
|
|
|
|
target: [number, number, number]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-02-15 00:57:04 +11:00
|
|
|
type ClickHandler = (clickParams?: MouseParams) => Promise<void | boolean>
|
|
|
|
type MoveHandler = (moveParams?: MouseParams) => Promise<void | boolean>
|
|
|
|
type DblClickHandler = (clickParams?: MouseParams) => Promise<void | boolean>
|
|
|
|
type DragToHandler = (dragParams: MouseDragToParams) => Promise<void | boolean>
|
2024-10-31 07:04:38 -07:00
|
|
|
type DragFromHandler = (
|
2025-02-15 00:57:04 +11:00
|
|
|
dragParams: MouseDragFromParams
|
2024-10-31 07:04:38 -07:00
|
|
|
) => Promise<void | boolean>
|
|
|
|
|
2024-09-26 18:25:05 +10:00
|
|
|
export class SceneFixture {
|
2024-10-01 07:56:04 +10:00
|
|
|
public page: Page
|
2025-01-08 04:34:57 -05:00
|
|
|
public streamWrapper!: Locator
|
|
|
|
public loadingIndicator!: Locator
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
|
|
|
|
get exeIndicator() {
|
|
|
|
return this.page.getByTestId('model-state-indicator-execution-done')
|
|
|
|
}
|
2024-09-26 18:25:05 +10:00
|
|
|
|
|
|
|
constructor(page: Page) {
|
|
|
|
this.page = page
|
2024-10-01 07:56:04 +10:00
|
|
|
this.reConstruct(page)
|
|
|
|
}
|
2024-10-04 13:47:44 -07:00
|
|
|
private _serialiseScene = async (): Promise<SceneSerialised> => {
|
|
|
|
const camera = await this.getCameraInfo()
|
|
|
|
|
|
|
|
return {
|
|
|
|
camera,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expectState = async (expected: SceneSerialised) => {
|
|
|
|
return expect
|
Move all tests over to electron (#4484)
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* One last try with window-16-cores
* Trigger CI
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Skip more win tests, add back all three oses
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* Add two more fixmes
* 2 more fixmes
* skip segment overlays on win32
* Another fixme
* Trigger CI
* Trigger CI
* Quick clean up
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* fmt, tsc, lint
* Enable two fixmes again
* Fix lint, codespell, fmt
* Fix lint
* Don't run e2e on draft, add back concurrency, clean up
* One last windows skip
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2024-12-18 17:58:03 -05:00
|
|
|
.poll(async () => await this._serialiseScene(), {
|
|
|
|
intervals: [1_000, 2_000, 10_000],
|
|
|
|
timeout: 60000,
|
2024-10-04 13:47:44 -07:00
|
|
|
})
|
|
|
|
.toEqual(expected)
|
|
|
|
}
|
|
|
|
|
2024-10-01 07:56:04 +10:00
|
|
|
reConstruct = (page: Page) => {
|
|
|
|
this.page = page
|
|
|
|
|
2025-01-08 04:34:57 -05:00
|
|
|
this.streamWrapper = page.getByTestId('stream')
|
|
|
|
this.loadingIndicator = this.streamWrapper.getByTestId('loading')
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
makeMouseHelpers = (
|
|
|
|
x: number,
|
|
|
|
y: number,
|
2024-10-04 13:47:44 -07:00
|
|
|
{ steps }: { steps: number } = { steps: 20 }
|
2024-11-27 10:08:23 -05:00
|
|
|
): [ClickHandler, MoveHandler, DblClickHandler] =>
|
2024-10-01 07:56:04 +10:00
|
|
|
[
|
2025-02-15 00:57:04 +11:00
|
|
|
(clickParams?: MouseParams) => {
|
2024-10-01 07:56:04 +10:00
|
|
|
if (clickParams?.pixelDiff) {
|
|
|
|
return doAndWaitForImageDiff(
|
|
|
|
this.page,
|
2025-02-15 00:57:04 +11:00
|
|
|
() =>
|
|
|
|
clickParams?.shouldDbClick
|
|
|
|
? this.page.mouse.dblclick(x, y, {
|
|
|
|
delay: clickParams?.delay || 0,
|
|
|
|
})
|
|
|
|
: this.page.mouse.click(x, y, {
|
|
|
|
delay: clickParams?.delay || 0,
|
|
|
|
}),
|
2024-10-01 07:56:04 +10:00
|
|
|
clickParams.pixelDiff
|
|
|
|
)
|
|
|
|
}
|
2025-02-15 00:57:04 +11:00
|
|
|
return clickParams?.shouldDbClick
|
|
|
|
? this.page.mouse.dblclick(x, y, { delay: clickParams?.delay || 0 })
|
|
|
|
: this.page.mouse.click(x, y, { delay: clickParams?.delay || 0 })
|
2024-10-01 07:56:04 +10:00
|
|
|
},
|
2025-02-15 00:57:04 +11:00
|
|
|
(moveParams?: MouseParams) => {
|
2024-10-01 07:56:04 +10:00
|
|
|
if (moveParams?.pixelDiff) {
|
|
|
|
return doAndWaitForImageDiff(
|
|
|
|
this.page,
|
|
|
|
() => this.page.mouse.move(x, y, { steps }),
|
|
|
|
moveParams.pixelDiff
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return this.page.mouse.move(x, y, { steps })
|
|
|
|
},
|
2025-02-15 00:57:04 +11:00
|
|
|
(clickParams?: MouseParams) => {
|
2024-11-27 10:08:23 -05:00
|
|
|
if (clickParams?.pixelDiff) {
|
|
|
|
return doAndWaitForImageDiff(
|
|
|
|
this.page,
|
|
|
|
() => this.page.mouse.dblclick(x, y),
|
|
|
|
clickParams.pixelDiff
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return this.page.mouse.dblclick(x, y)
|
|
|
|
},
|
2024-10-01 07:56:04 +10:00
|
|
|
] as const
|
2024-10-31 07:04:38 -07:00
|
|
|
makeDragHelpers = (
|
|
|
|
x: number,
|
|
|
|
y: number,
|
|
|
|
{ steps }: { steps: number } = { steps: 20 }
|
|
|
|
): [DragToHandler, DragFromHandler] =>
|
|
|
|
[
|
2025-02-15 00:57:04 +11:00
|
|
|
(dragToParams: MouseDragToParams) => {
|
2024-10-31 07:04:38 -07:00
|
|
|
if (dragToParams?.pixelDiff) {
|
|
|
|
return doAndWaitForImageDiff(
|
|
|
|
this.page,
|
|
|
|
() =>
|
|
|
|
this.page.dragAndDrop('#stream', '#stream', {
|
|
|
|
sourcePosition: dragToParams.fromPoint,
|
|
|
|
targetPosition: { x, y },
|
|
|
|
}),
|
|
|
|
dragToParams.pixelDiff
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return this.page.dragAndDrop('#stream', '#stream', {
|
|
|
|
sourcePosition: dragToParams.fromPoint,
|
|
|
|
targetPosition: { x, y },
|
|
|
|
})
|
|
|
|
},
|
2025-02-15 00:57:04 +11:00
|
|
|
(dragFromParams: MouseDragFromParams) => {
|
2024-10-31 07:04:38 -07:00
|
|
|
if (dragFromParams?.pixelDiff) {
|
|
|
|
return doAndWaitForImageDiff(
|
|
|
|
this.page,
|
|
|
|
() =>
|
|
|
|
this.page.dragAndDrop('#stream', '#stream', {
|
|
|
|
sourcePosition: { x, y },
|
|
|
|
targetPosition: dragFromParams.toPoint,
|
|
|
|
}),
|
|
|
|
dragFromParams.pixelDiff
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return this.page.dragAndDrop('#stream', '#stream', {
|
|
|
|
sourcePosition: { x, y },
|
|
|
|
targetPosition: dragFromParams.toPoint,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
] as const
|
2024-09-26 18:25:05 +10:00
|
|
|
|
|
|
|
/** Likely no where, there's a chance it will click something in the scene, depending what you have in the scene.
|
|
|
|
*
|
|
|
|
* Expects the viewPort to be 1000x500 */
|
|
|
|
clickNoWhere = () => this.page.mouse.click(998, 60)
|
2024-10-01 07:56:04 +10:00
|
|
|
/** Likely no where, there's a chance it will click something in the scene, depending what you have in the scene.
|
|
|
|
*
|
|
|
|
* Expects the viewPort to be 1000x500 */
|
|
|
|
moveNoWhere = (steps?: number) => this.page.mouse.move(998, 60, { steps })
|
2024-09-26 18:25:05 +10:00
|
|
|
|
|
|
|
moveCameraTo = async (
|
|
|
|
pos: { x: number; y: number; z: number },
|
|
|
|
target: { x: number; y: number; z: number } = { x: 0, y: 0, z: 0 }
|
|
|
|
) => {
|
|
|
|
await openAndClearDebugPanel(this.page)
|
|
|
|
await doAndWaitForImageDiff(
|
|
|
|
this.page,
|
|
|
|
() =>
|
|
|
|
sendCustomCmd(this.page, {
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: uuidv4(),
|
|
|
|
cmd: {
|
|
|
|
type: 'default_camera_look_at',
|
|
|
|
vantage: pos,
|
|
|
|
center: target,
|
|
|
|
up: { x: 0, y: 0, z: 1 },
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
300
|
|
|
|
)
|
|
|
|
await closeDebugPanel(this.page)
|
|
|
|
}
|
2024-10-04 13:47:44 -07:00
|
|
|
/** Forces a refresh of the camera position and target displayed
|
|
|
|
* in the debug panel and then returns the values of the fields
|
|
|
|
*/
|
|
|
|
async getCameraInfo() {
|
|
|
|
await openAndClearDebugPanel(this.page)
|
|
|
|
await sendCustomCmd(this.page, {
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: uuidv4(),
|
|
|
|
cmd: {
|
|
|
|
type: 'default_camera_get_settings',
|
|
|
|
},
|
|
|
|
})
|
Move all tests over to electron (#4484)
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* One last try with window-16-cores
* Trigger CI
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Skip more win tests, add back all three oses
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* Add two more fixmes
* 2 more fixmes
* skip segment overlays on win32
* Another fixme
* Trigger CI
* Trigger CI
* Quick clean up
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* fmt, tsc, lint
* Enable two fixmes again
* Fix lint, codespell, fmt
* Fix lint
* Don't run e2e on draft, add back concurrency, clean up
* One last windows skip
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2024-12-18 17:58:03 -05:00
|
|
|
await this.page
|
|
|
|
.locator(`[data-receive-command-type="default_camera_get_settings"]`)
|
|
|
|
.first()
|
|
|
|
.waitFor()
|
2024-10-04 13:47:44 -07:00
|
|
|
const position = await Promise.all([
|
|
|
|
this.page.getByTestId('cam-x-position').inputValue().then(Number),
|
|
|
|
this.page.getByTestId('cam-y-position').inputValue().then(Number),
|
|
|
|
this.page.getByTestId('cam-z-position').inputValue().then(Number),
|
|
|
|
])
|
|
|
|
const target = await Promise.all([
|
|
|
|
this.page.getByTestId('cam-x-target').inputValue().then(Number),
|
|
|
|
this.page.getByTestId('cam-y-target').inputValue().then(Number),
|
|
|
|
this.page.getByTestId('cam-z-target').inputValue().then(Number),
|
|
|
|
])
|
|
|
|
await closeDebugPanel(this.page)
|
|
|
|
return {
|
|
|
|
position,
|
|
|
|
target,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-26 18:25:05 +10:00
|
|
|
waitForExecutionDone = async () => {
|
2024-11-06 14:32:06 -05:00
|
|
|
await expect(this.exeIndicator).toBeVisible({ timeout: 30000 })
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
2024-10-02 13:15:40 +10:00
|
|
|
|
|
|
|
expectPixelColor = async (
|
2025-02-15 00:57:04 +11:00
|
|
|
colour: [number, number, number] | [number, number, number][],
|
2024-10-02 13:15:40 +10:00
|
|
|
coords: { x: number; y: number },
|
|
|
|
diff: number
|
|
|
|
) => {
|
2024-12-13 17:35:34 -08:00
|
|
|
await expectPixelColor(this.page, colour, coords, diff)
|
2024-10-02 13:15:40 +10:00
|
|
|
}
|
2024-10-04 13:47:44 -07:00
|
|
|
|
|
|
|
get gizmo() {
|
|
|
|
return this.page.locator('[aria-label*=gizmo]')
|
|
|
|
}
|
|
|
|
|
|
|
|
async clickGizmoMenuItem(name: string) {
|
Move all tests over to electron (#4484)
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* One last try with window-16-cores
* Trigger CI
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Skip more win tests, add back all three oses
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* Add two more fixmes
* 2 more fixmes
* skip segment overlays on win32
* Another fixme
* Trigger CI
* Trigger CI
* Quick clean up
* Move all tests over to electron
* Pass the correct param to playwright-electron.sh
* Add shebang to script and add macos-14-large as a target
* Get sketch-tests.spec.ts passing in electron
* Try out 4 workers
* Got testing-segment-overlays passing
* Pass testing-selections.spec.ts
* Go back to fix up sketch-tests test
* Pass various.spec.ts, by far the hardest one
* Pass can-sketch-on-all-planes... with ease
* Pass command bar tests
* fmt
* Completely fix code mirror text navigating for tests
* Pass debug pane tests
* Pass desktop export tests
* Pass editor tests
* Pass file tree tests
* Pass onboarding tests
* Corrected a fixme in file-tree.spec!
* Painfully fix hardcoded coordinates in point-click.spec
* Pass machine.spec tests
* Pass projects, fought hard with filechooser
* Pass regresion-tests.spec tests
* Pass network and connection tests
* Pass camera-movement.spec tests
* Extreme time eaten by gizmo test fixes. All passing now.
* Merge main (tests changed x_x) and pass all constraints.spec tests (pain)
* Pass another painful spec suite: testing-settings
* Pass perspective-toggle, interesting note
* Pass samples loading tests
* Pass app header tests
* Pass text-to-cad tests
* Pass segment-overlays (minor ache) and ability to switch to web if needed :)
* Fix a ton of syntax changes and deflake 2 more tests (pain)
* Correct all tsc errors
* Remove to-electron script
* Add an f-ton of shit because playwright doesnt want S P R E A D
* Try CI again
* Stop snapshots of exports (already test in e2e)
* Fix flake in double click editor
* Hopefully help CI flake
* Fixmes, fixmes everywhere
* One more fixme to settings
* Skip another code pane flake
* Port jess's projects.spec tests
* fixup
* Reuse electron window; difficult task
* Rebased and refixed
* Remove duplicate cases
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* Reduce the workers to something CI can handle
* Lower it further, we need to think about the others
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update package.json
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Fix the last tests and tsc errors
* Timeout to 120 and windows-2022-16core
* Fix windows runner detection, enable concurrency temporarily
* Hopefully this time fix windows runner detection
* Comment out Vector, add back removed camera test code
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Fix camera tests again
* Massively deflake a whole class of tests
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-14-large)
* Try new CI and fix small onboarding test
* Derp
* No github tuning
* Try mac
* Add back all the OS
* Lord, hallow be thy name
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores)
* Try AWS Windows runner
* Passing on windows locally with a few skips
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* fmt, tsc, lint
* Enable two fixmes again
* Fix lint, codespell, fmt
* Fix lint
* Don't run e2e on draft, add back concurrency, clean up
* One last windows skip
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
2024-12-18 17:58:03 -05:00
|
|
|
await this.gizmo.hover()
|
2024-10-04 13:47:44 -07:00
|
|
|
await this.gizmo.click({ button: 'right' })
|
|
|
|
const buttonToTest = this.page.getByRole('button', {
|
|
|
|
name: name,
|
|
|
|
})
|
|
|
|
await expect(buttonToTest).toBeVisible()
|
|
|
|
await buttonToTest.click()
|
|
|
|
}
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
2024-12-13 17:35:34 -08:00
|
|
|
|
2025-02-15 00:57:04 +11:00
|
|
|
function isColourArray(
|
|
|
|
colour: [number, number, number] | [number, number, number][]
|
|
|
|
): colour is [number, number, number][] {
|
|
|
|
return isArray(colour[0])
|
|
|
|
}
|
|
|
|
|
2024-12-13 17:35:34 -08:00
|
|
|
export async function expectPixelColor(
|
|
|
|
page: Page,
|
2025-02-15 00:57:04 +11:00
|
|
|
colour: [number, number, number] | [number, number, number][],
|
2024-12-13 17:35:34 -08:00
|
|
|
coords: { x: number; y: number },
|
|
|
|
diff: number
|
|
|
|
) {
|
|
|
|
let finalValue = colour
|
|
|
|
await expect
|
2025-02-15 00:57:04 +11:00
|
|
|
.poll(
|
|
|
|
async () => {
|
|
|
|
const pixel = (await getPixelRGBs(page)(coords, 1))[0]
|
|
|
|
if (!pixel) return null
|
|
|
|
finalValue = pixel
|
|
|
|
if (!isColourArray(colour)) {
|
|
|
|
return pixel.every(
|
|
|
|
(channel, index) => Math.abs(channel - colour[index]) < diff
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return colour.some((c) =>
|
|
|
|
c.every((channel, index) => Math.abs(pixel[index] - channel) < diff)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{ timeout: 10_000 }
|
|
|
|
)
|
2024-12-13 17:35:34 -08:00
|
|
|
.toBeTruthy()
|
|
|
|
.catch((cause) => {
|
|
|
|
throw new Error(
|
|
|
|
`ExpectPixelColor: expecting ${colour} got ${finalValue}`,
|
|
|
|
{ cause }
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|