2024-03-22 16:55:30 +11:00
|
|
|
import { SceneEntities } from 'clientSideScene/sceneEntities'
|
|
|
|
import { SceneInfra } from 'clientSideScene/sceneInfra'
|
2024-04-19 14:24:40 -07:00
|
|
|
import EditorManager from 'editor/manager'
|
2024-03-22 16:55:30 +11:00
|
|
|
import { KclManager } from 'lang/KclSingleton'
|
2024-04-17 20:18:07 -07:00
|
|
|
import CodeManager from 'lang/codeManager'
|
2024-03-22 16:55:30 +11:00
|
|
|
import { EngineCommandManager } from 'lang/std/engineConnection'
|
2024-08-05 16:08:30 +10:00
|
|
|
import { uuidv4 } from './utils'
|
2024-03-22 16:55:30 +11:00
|
|
|
|
2024-04-17 20:18:07 -07:00
|
|
|
export const codeManager = new CodeManager()
|
|
|
|
|
2024-03-22 16:55:30 +11:00
|
|
|
export const engineCommandManager = new EngineCommandManager()
|
|
|
|
|
2024-07-07 13:10:52 -04:00
|
|
|
// Accessible for tests mostly
|
|
|
|
// @ts-ignore
|
|
|
|
window.tearDown = engineCommandManager.tearDown
|
|
|
|
|
2024-04-19 14:24:40 -07:00
|
|
|
// This needs to be after codeManager is created.
|
2024-03-22 16:55:30 +11:00
|
|
|
export const kclManager = new KclManager(engineCommandManager)
|
2024-08-30 05:14:24 -05:00
|
|
|
engineCommandManager.kclManager = kclManager
|
2024-07-04 01:40:45 -04:00
|
|
|
|
2024-03-22 16:55:30 +11:00
|
|
|
export const sceneInfra = new SceneInfra(engineCommandManager)
|
|
|
|
engineCommandManager.camControlsCameraChange = sceneInfra.onCameraChange
|
|
|
|
|
|
|
|
export const sceneEntitiesManager = new SceneEntities(engineCommandManager)
|
2024-04-19 14:24:40 -07:00
|
|
|
|
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
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
editorManager: EditorManager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-19 14:24:40 -07:00
|
|
|
// This needs to be after sceneInfra and engineCommandManager are is created.
|
|
|
|
export const editorManager = new EditorManager()
|
2024-04-22 20:14:06 +10:00
|
|
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
;(window as any).engineCommandManager = engineCommandManager
|
|
|
|
;(window as any).kclManager = kclManager
|
|
|
|
;(window as any).sceneInfra = sceneInfra
|
|
|
|
;(window as any).sceneEntitiesManager = sceneEntitiesManager
|
|
|
|
;(window as any).editorManager = editorManager
|
|
|
|
;(window as any).enableMousePositionLogs = () =>
|
|
|
|
document.addEventListener('mousemove', (e) =>
|
|
|
|
console.log(`await page.mouse.click(${e.clientX}, ${e.clientY})`)
|
|
|
|
)
|
2024-07-15 19:20:32 +10:00
|
|
|
;(window as any).enableFillet = () => {
|
|
|
|
;(window as any)._enableFillet = true
|
|
|
|
}
|
2024-08-05 16:08:30 +10:00
|
|
|
;(window as any).zoomToFit = () =>
|
|
|
|
engineCommandManager.sendSceneCommand({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: uuidv4(),
|
|
|
|
cmd: {
|
|
|
|
type: 'zoom_to_fit',
|
|
|
|
object_ids: [], // leave empty to zoom to all objects
|
|
|
|
padding: 0.2, // padding around the objects
|
2024-10-04 13:47:44 -07:00
|
|
|
animated: false, // don't animate the zoom for now
|
2024-08-05 16:08:30 +10:00
|
|
|
},
|
|
|
|
})
|
2024-04-22 20:14:06 +10:00
|
|
|
}
|