2024-10-01 07:56:04 +10:00
|
|
|
import type { Page, Locator } from '@playwright/test'
|
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
|
|
|
import { expect } from '../zoo-test'
|
2024-12-20 16:19:59 -05:00
|
|
|
import {
|
|
|
|
checkIfPaneIsOpen,
|
|
|
|
closePane,
|
|
|
|
doAndWaitForImageDiff,
|
|
|
|
openPane,
|
|
|
|
} from '../test-utils'
|
|
|
|
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
|
|
|
import { SIDEBAR_BUTTON_SUFFIX } from 'lib/constants'
|
2024-10-01 07:56:04 +10:00
|
|
|
|
|
|
|
export class ToolbarFixture {
|
|
|
|
public page: Page
|
|
|
|
|
|
|
|
extrudeButton!: Locator
|
2024-12-04 17:24:16 -05:00
|
|
|
loftButton!: Locator
|
2025-01-11 08:20:49 -05:00
|
|
|
sweepButton!: Locator
|
2025-01-17 10:21:55 +01:00
|
|
|
filletButton!: Locator
|
2025-01-14 18:08:32 +01:00
|
|
|
chamferButton!: Locator
|
2024-12-09 15:20:48 -05:00
|
|
|
shellButton!: Locator
|
2025-02-01 06:02:43 -05:00
|
|
|
revolveButton!: Locator
|
2024-11-26 11:36:14 -05:00
|
|
|
offsetPlaneButton!: Locator
|
2025-02-07 10:16:36 -05:00
|
|
|
helixButton!: Locator
|
2024-10-01 07:56:04 +10:00
|
|
|
startSketchBtn!: Locator
|
2024-10-31 07:04:38 -07:00
|
|
|
lineBtn!: Locator
|
2025-02-15 00:57:04 +11:00
|
|
|
tangentialArcBtn!: Locator
|
|
|
|
circleBtn!: Locator
|
2024-10-01 07:56:04 +10:00
|
|
|
rectangleBtn!: Locator
|
2025-02-15 00:57:04 +11:00
|
|
|
lengthConstraintBtn!: Locator
|
2024-10-01 07:56:04 +10:00
|
|
|
exitSketchBtn!: Locator
|
|
|
|
fileTreeBtn!: Locator
|
|
|
|
createFileBtn!: Locator
|
|
|
|
fileCreateToast!: Locator
|
|
|
|
filePane!: Locator
|
2024-11-06 14:32:06 -05:00
|
|
|
treeInputField!: Locator
|
2024-12-20 16:19:59 -05:00
|
|
|
/** The sidebar button for the Feature Tree pane */
|
|
|
|
featureTreeId = 'feature-tree' as const
|
|
|
|
/** The pane element for the Feature Tree */
|
|
|
|
featureTreePane!: Locator
|
2025-03-13 10:54:00 -04:00
|
|
|
gizmo!: Locator
|
|
|
|
gizmoDisabled!: Locator
|
2024-10-01 07:56:04 +10:00
|
|
|
|
|
|
|
constructor(page: Page) {
|
|
|
|
this.page = page
|
2025-03-13 10:54:00 -04:00
|
|
|
|
2024-10-01 07:56:04 +10:00
|
|
|
this.extrudeButton = page.getByTestId('extrude')
|
2024-12-04 17:24:16 -05:00
|
|
|
this.loftButton = page.getByTestId('loft')
|
2025-01-11 08:20:49 -05:00
|
|
|
this.sweepButton = page.getByTestId('sweep')
|
2025-01-17 10:21:55 +01:00
|
|
|
this.filletButton = page.getByTestId('fillet3d')
|
2025-01-14 18:08:32 +01:00
|
|
|
this.chamferButton = page.getByTestId('chamfer3d')
|
2024-12-09 15:20:48 -05:00
|
|
|
this.shellButton = page.getByTestId('shell')
|
2025-02-01 06:02:43 -05:00
|
|
|
this.revolveButton = page.getByTestId('revolve')
|
2024-11-26 11:36:14 -05:00
|
|
|
this.offsetPlaneButton = page.getByTestId('plane-offset')
|
2025-02-07 10:16:36 -05:00
|
|
|
this.helixButton = page.getByTestId('helix')
|
2024-10-01 07:56:04 +10:00
|
|
|
this.startSketchBtn = page.getByTestId('sketch')
|
2024-10-31 07:04:38 -07:00
|
|
|
this.lineBtn = page.getByTestId('line')
|
2025-02-15 00:57:04 +11:00
|
|
|
this.tangentialArcBtn = page.getByTestId('tangential-arc')
|
|
|
|
this.circleBtn = page.getByTestId('circle-center')
|
2024-10-01 07:56:04 +10:00
|
|
|
this.rectangleBtn = page.getByTestId('corner-rectangle')
|
2025-02-15 00:57:04 +11:00
|
|
|
this.lengthConstraintBtn = page.getByTestId('constraint-length')
|
2024-10-01 07:56:04 +10:00
|
|
|
this.exitSketchBtn = page.getByTestId('sketch-exit')
|
|
|
|
this.fileTreeBtn = page.locator('[id="files-button-holder"]')
|
|
|
|
this.createFileBtn = page.getByTestId('create-file-button')
|
2024-11-06 14:32:06 -05:00
|
|
|
this.treeInputField = page.getByTestId('tree-input-field')
|
2024-10-01 07:56:04 +10:00
|
|
|
|
|
|
|
this.filePane = page.locator('#files-pane')
|
2024-12-20 16:19:59 -05:00
|
|
|
this.featureTreePane = page.locator('#feature-tree-pane')
|
2024-10-01 07:56:04 +10:00
|
|
|
this.fileCreateToast = page.getByText('Successfully created')
|
2025-03-13 10:54:00 -04:00
|
|
|
|
|
|
|
// Note to test writers: having two locators like this is preferable to one
|
|
|
|
// which changes another el property because it means our test "signal" is
|
|
|
|
// completely decoupled from the elements themselves. It means the same
|
|
|
|
// element or two different elements can represent these states.
|
|
|
|
this.gizmo = page.getByTestId('gizmo')
|
|
|
|
this.gizmoDisabled = page.getByTestId('gizmo-disabled')
|
2024-10-01 07:56:04 +10:00
|
|
|
}
|
|
|
|
|
2025-03-07 19:14:02 -05:00
|
|
|
get editSketchBtn() {
|
|
|
|
return this.page.locator('[name="Edit Sketch"]')
|
|
|
|
}
|
|
|
|
|
2025-01-17 14:46:52 -05:00
|
|
|
get logoLink() {
|
|
|
|
return this.page.getByTestId('app-logo')
|
|
|
|
}
|
|
|
|
|
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() {
|
2025-03-05 14:09:21 -05:00
|
|
|
return this.page
|
|
|
|
.getByTestId('model-state-indicator-receive-reliable')
|
|
|
|
.or(this.page.getByTestId('model-state-indicator-execution-done'))
|
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
|
|
|
}
|
|
|
|
|
2024-10-01 07:56:04 +10:00
|
|
|
startSketchPlaneSelection = async () =>
|
|
|
|
doAndWaitForImageDiff(this.page, () => this.startSketchBtn.click(), 500)
|
|
|
|
|
2025-03-13 10:54:00 -04:00
|
|
|
waitUntilSketchingReady = async () => {
|
|
|
|
await expect(this.gizmoDisabled).toBeVisible()
|
|
|
|
}
|
|
|
|
|
|
|
|
startSketchThenCallbackThenWaitUntilReady = async (
|
|
|
|
cb: () => Promise<void>
|
|
|
|
) => {
|
|
|
|
await this.startSketchBtn.click()
|
|
|
|
await cb()
|
|
|
|
await this.waitUntilSketchingReady()
|
|
|
|
}
|
|
|
|
|
2025-03-06 11:19:13 -05:00
|
|
|
exitSketch = async () => {
|
|
|
|
await this.exitSketchBtn.click()
|
|
|
|
await expect(
|
|
|
|
this.page.getByRole('button', { name: 'Start Sketch' })
|
|
|
|
).toBeVisible()
|
|
|
|
await expect(
|
|
|
|
this.page.getByRole('button', { name: 'Start Sketch' })
|
|
|
|
).not.toBeDisabled()
|
|
|
|
}
|
|
|
|
|
2024-10-01 07:56:04 +10:00
|
|
|
editSketch = async () => {
|
|
|
|
await this.editSketchBtn.first().click()
|
|
|
|
// One of the rare times we want to allow a arbitrary wait
|
|
|
|
// this is for the engine animation, as it takes 500ms to complete
|
|
|
|
await this.page.waitForTimeout(600)
|
|
|
|
}
|
|
|
|
|
|
|
|
private _serialiseFileTree = async () => {
|
|
|
|
return this.page
|
|
|
|
.locator('#files-pane')
|
|
|
|
.getByTestId('file-tree-item')
|
|
|
|
.allInnerTexts()
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* TODO folders, in expect state
|
|
|
|
*/
|
|
|
|
expectFileTreeState = async (expected: string[]) => {
|
|
|
|
await expect.poll(this._serialiseFileTree).toEqual(expected)
|
|
|
|
}
|
2024-11-06 14:32:06 -05:00
|
|
|
createFile = async (args: {
|
|
|
|
fileName: string
|
|
|
|
waitForToastToDisappear: boolean
|
|
|
|
}) => {
|
2024-10-01 07:56:04 +10:00
|
|
|
await this.createFileBtn.click()
|
2024-11-06 14:32:06 -05:00
|
|
|
await this.treeInputField.fill(args.fileName)
|
|
|
|
await this.treeInputField.press('Enter')
|
2024-10-01 07:56:04 +10:00
|
|
|
await expect(this.fileCreateToast).toBeVisible()
|
2024-11-06 14:32:06 -05:00
|
|
|
if (args.waitForToastToDisappear) {
|
2024-10-01 07:56:04 +10:00
|
|
|
await this.fileCreateToast.waitFor({ state: 'detached' })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Opens file by it's name and waits for execution to finish
|
|
|
|
*/
|
|
|
|
openFile = async (
|
|
|
|
fileName: string,
|
|
|
|
{ wait }: { wait?: boolean } = { wait: true }
|
|
|
|
) => {
|
|
|
|
await this.filePane.getByText(fileName).click()
|
|
|
|
if (wait) {
|
|
|
|
await expect(this.exeIndicator).toBeVisible({ timeout: 15_000 })
|
|
|
|
}
|
|
|
|
}
|
2025-02-15 00:57:04 +11:00
|
|
|
selectCenterRectangle = async () => {
|
|
|
|
await this.page
|
|
|
|
.getByRole('button', { name: 'caret down Corner rectangle:' })
|
|
|
|
.click()
|
|
|
|
await expect(
|
|
|
|
this.page.getByTestId('dropdown-center-rectangle')
|
|
|
|
).toBeVisible()
|
|
|
|
await this.page.getByTestId('dropdown-center-rectangle').click()
|
|
|
|
}
|
|
|
|
|
|
|
|
selectCircleThreePoint = async () => {
|
|
|
|
await this.page
|
|
|
|
.getByRole('button', { name: 'caret down Center circle:' })
|
|
|
|
.click()
|
|
|
|
await expect(
|
|
|
|
this.page.getByTestId('dropdown-circle-three-points')
|
|
|
|
).toBeVisible()
|
|
|
|
await this.page.getByTestId('dropdown-circle-three-points').click()
|
|
|
|
}
|
2024-12-20 16:19:59 -05:00
|
|
|
|
|
|
|
async closePane(paneId: SidebarType) {
|
|
|
|
return closePane(this.page, paneId + SIDEBAR_BUTTON_SUFFIX)
|
|
|
|
}
|
|
|
|
async openPane(paneId: SidebarType) {
|
|
|
|
return openPane(this.page, paneId + SIDEBAR_BUTTON_SUFFIX)
|
|
|
|
}
|
|
|
|
async checkIfPaneIsOpen(paneId: SidebarType) {
|
|
|
|
return checkIfPaneIsOpen(this.page, paneId + SIDEBAR_BUTTON_SUFFIX)
|
|
|
|
}
|
|
|
|
|
|
|
|
async openFeatureTreePane() {
|
|
|
|
return this.openPane(this.featureTreeId)
|
|
|
|
}
|
|
|
|
async closeFeatureTreePane() {
|
|
|
|
await this.closePane(this.featureTreeId)
|
|
|
|
}
|
|
|
|
async checkIfFeatureTreePaneIsOpen() {
|
|
|
|
return this.checkIfPaneIsOpen(this.featureTreeId)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
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 a specific operation button from the Feature Tree pane.
|
|
|
|
* Index is 0-based.
|
2024-12-20 16:19:59 -05:00
|
|
|
*/
|
|
|
|
async getFeatureTreeOperation(operationName: string, operationIndex: number) {
|
|
|
|
await this.openFeatureTreePane()
|
|
|
|
await expect(this.featureTreePane).toBeVisible()
|
|
|
|
return this.featureTreePane
|
|
|
|
.getByRole('button', {
|
|
|
|
name: operationName,
|
|
|
|
})
|
|
|
|
.nth(operationIndex)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* View source on a specific operation in the Feature Tree pane.
|
|
|
|
* @param operationName The name of the operation type
|
|
|
|
* @param operationIndex The index out of operations of this type
|
|
|
|
*/
|
|
|
|
async viewSourceOnOperation(operationName: string, operationIndex: number) {
|
|
|
|
const operationButton = await this.getFeatureTreeOperation(
|
|
|
|
operationName,
|
|
|
|
operationIndex
|
|
|
|
)
|
|
|
|
const viewSourceMenuButton = this.page.getByRole('button', {
|
|
|
|
name: 'View KCL source code',
|
|
|
|
})
|
|
|
|
|
|
|
|
await operationButton.click({ button: 'right' })
|
|
|
|
await expect(viewSourceMenuButton).toBeVisible()
|
|
|
|
await viewSourceMenuButton.click()
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Go to definition on a specific operation in the Feature Tree pane
|
|
|
|
*/
|
|
|
|
async goToDefinitionOnOperation(
|
|
|
|
operationName: string,
|
|
|
|
operationIndex: number
|
|
|
|
) {
|
|
|
|
const operationButton = await this.getFeatureTreeOperation(
|
|
|
|
operationName,
|
|
|
|
operationIndex
|
|
|
|
)
|
|
|
|
const goToDefinitionMenuButton = this.page.getByRole('button', {
|
|
|
|
name: 'View function definition',
|
|
|
|
})
|
|
|
|
|
|
|
|
await operationButton.click({ button: 'right' })
|
|
|
|
await expect(goToDefinitionMenuButton).toBeVisible()
|
|
|
|
await goToDefinitionMenuButton.click()
|
|
|
|
}
|
2024-10-01 07:56:04 +10:00
|
|
|
}
|