* 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>
91 lines
2.8 KiB
TypeScript
91 lines
2.8 KiB
TypeScript
import fs from 'node:fs/promises'
|
|
import fsSync from 'node:fs'
|
|
import path from 'path'
|
|
import { dialog, shell } from 'electron'
|
|
import { MachinesListing } from 'components/MachineManagerProvider'
|
|
|
|
type EnvFn = (value?: string) => string
|
|
|
|
export interface IElectronAPI {
|
|
resizeWindow: (width: number, height: number) => Promise<void>
|
|
open: typeof dialog.showOpenDialog
|
|
save: typeof dialog.showSaveDialog
|
|
openExternal: typeof shell.openExternal
|
|
showInFolder: typeof shell.showItemInFolder
|
|
/** Require to be called first before {@link loginWithDeviceFlow} */
|
|
startDeviceFlow: (host: string) => Promise<string>
|
|
/** Registered by first calling {@link startDeviceFlow}, which sets up the device flow handle */
|
|
loginWithDeviceFlow: () => Promise<string>
|
|
platform: typeof process.env.platform
|
|
arch: typeof process.env.arch
|
|
version: typeof process.env.version
|
|
watchFileOn: (
|
|
path: string,
|
|
key: string,
|
|
callback: (eventType: string, path: string) => void
|
|
) => void
|
|
readFile: typeof fs.readFile
|
|
watchFileOff: (path: string, key: string) => void
|
|
writeFile: (
|
|
path: string,
|
|
data: string | Uint8Array
|
|
) => ReturnType<fs.writeFile>
|
|
readdir: (path: string) => ReturnType<fs.readdir>
|
|
exists: (path: string) => ReturnType<fs.exists>
|
|
getPath: (name: string) => Promise<string>
|
|
rm: typeof fs.rm
|
|
stat: (path: string) => ReturnType<fs.stat>
|
|
statIsDirectory: (path: string) => Promise<boolean>
|
|
path: typeof path
|
|
mkdir: typeof fs.mkdir
|
|
join: typeof path.join
|
|
sep: typeof path.sep
|
|
rename: (prev: string, next: string) => typeof fs.rename
|
|
packageJson: {
|
|
name: string
|
|
}
|
|
os: {
|
|
isMac: boolean
|
|
isWindows: boolean
|
|
isLinux: boolean
|
|
}
|
|
process: {
|
|
env: {
|
|
BASE_URL: string
|
|
TEST_SETTINGS_FILE_KEY: string
|
|
IS_PLAYWRIGHT: string
|
|
VITE_KC_DEV_TOKEN: string
|
|
VITE_KC_API_WS_MODELING_URL: string
|
|
VITE_KC_API_BASE_URL: string
|
|
VITE_KC_SITE_BASE_URL: string
|
|
VITE_KC_SKIP_AUTH: string
|
|
VITE_KC_CONNECTION_TIMEOUT_MS: string
|
|
VITE_KC_DEV_TOKEN: string
|
|
NODE_ENV: string
|
|
PROD: string
|
|
DEV: string
|
|
TEST: string
|
|
CI: string
|
|
}
|
|
}
|
|
kittycad: (access: string, args: any) => any
|
|
listMachines: (machineApiIp: string) => Promise<MachinesListing>
|
|
getMachineApiIp: () => Promise<string | null>
|
|
onUpdateDownloadStart: (
|
|
callback: (value: { version: string }) => void
|
|
) => Electron.IpcRenderer
|
|
onUpdateDownloaded: (
|
|
callback: (value: { version: string; releaseNotes: string }) => void
|
|
) => Electron.IpcRenderer
|
|
onUpdateError: (callback: (value: { error: Error }) => void) => Electron
|
|
appRestart: () => void
|
|
getArgvParsed: () => any
|
|
getAppTestProperty: (propertyName: string) => any
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
electron: IElectronAPI
|
|
}
|
|
}
|