2025-02-27 05:44:40 +11:00
|
|
|
import * as fs from 'fs'
|
|
|
|
import * as path from 'path'
|
2025-04-16 00:11:25 +10:00
|
|
|
import type { Locator, Page, Request, Route, TestInfo } from '@playwright/test'
|
|
|
|
import { expect } from '@playwright/test'
|
2024-09-26 18:25:05 +10:00
|
|
|
|
2025-04-14 14:53:01 -04:00
|
|
|
export type CmdBarSerialised =
|
2024-09-26 18:25:05 +10:00
|
|
|
| {
|
|
|
|
stage: 'commandBarClosed'
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
stage: 'pickCommand'
|
|
|
|
// TODO this will need more properties when implemented in _serialiseCmdBar
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
stage: 'arguments'
|
|
|
|
currentArgKey: string
|
|
|
|
currentArgValue: string
|
|
|
|
headerArguments: Record<string, string>
|
|
|
|
highlightedHeaderArg: string
|
|
|
|
commandName: string
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
stage: 'review'
|
|
|
|
headerArguments: Record<string, string>
|
|
|
|
commandName: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CmdBarFixture {
|
2024-10-01 07:56:04 +10:00
|
|
|
public page: Page
|
2025-03-13 10:54:00 -04:00
|
|
|
public cmdBarOpenBtn!: Locator
|
|
|
|
public cmdBarElement!: Locator
|
2024-09-26 18:25:05 +10:00
|
|
|
|
|
|
|
constructor(page: Page) {
|
|
|
|
this.page = page
|
2025-03-13 10:54:00 -04:00
|
|
|
this.cmdBarOpenBtn = this.page.getByTestId('command-bar-open-button')
|
|
|
|
this.cmdBarElement = this.page.getByTestId('command-bar')
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
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 currentArgumentInput() {
|
|
|
|
return this.page.getByTestId('cmd-bar-arg-value')
|
|
|
|
}
|
|
|
|
|
2024-09-26 18:25:05 +10:00
|
|
|
private _serialiseCmdBar = async (): Promise<CmdBarSerialised> => {
|
2025-01-31 11:04:34 -05:00
|
|
|
if (!(await this.page.getByTestId('command-bar-wrapper').isVisible())) {
|
|
|
|
return { stage: 'commandBarClosed' }
|
2025-02-28 18:00:29 -05:00
|
|
|
} else if (await this.page.getByTestId('cmd-bar-search').isVisible()) {
|
|
|
|
return { stage: 'pickCommand' }
|
2025-01-31 11:04:34 -05:00
|
|
|
}
|
2024-11-26 11:36:14 -05:00
|
|
|
const reviewForm = this.page.locator('#review-form')
|
2024-09-26 18:25:05 +10:00
|
|
|
const getHeaderArgs = async () => {
|
|
|
|
const inputs = await this.page.getByTestId('cmd-bar-input-tab').all()
|
|
|
|
const entries = await Promise.all(
|
|
|
|
inputs.map((input) => {
|
|
|
|
const key = input
|
|
|
|
.locator('[data-test-name="arg-name"]')
|
|
|
|
.innerText()
|
|
|
|
.then((a) => a.trim())
|
|
|
|
const value = input
|
|
|
|
.getByTestId('header-arg-value')
|
|
|
|
.innerText()
|
|
|
|
.then((a) => a.trim())
|
|
|
|
return Promise.all([key, value])
|
|
|
|
})
|
|
|
|
)
|
|
|
|
return Object.fromEntries(entries)
|
|
|
|
}
|
|
|
|
const getCommandName = () =>
|
|
|
|
this.page.getByTestId('command-name').textContent()
|
|
|
|
if (await reviewForm.isVisible()) {
|
|
|
|
const [headerArguments, commandName] = await Promise.all([
|
|
|
|
getHeaderArgs(),
|
|
|
|
getCommandName(),
|
|
|
|
])
|
|
|
|
return {
|
|
|
|
stage: 'review',
|
|
|
|
headerArguments,
|
|
|
|
commandName: commandName || '',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const [
|
|
|
|
currentArgKey,
|
|
|
|
currentArgValue,
|
|
|
|
headerArguments,
|
|
|
|
highlightedHeaderArg,
|
|
|
|
commandName,
|
|
|
|
] = await Promise.all([
|
|
|
|
this.page.getByTestId('cmd-bar-arg-name').textContent(),
|
|
|
|
this.page.getByTestId('cmd-bar-arg-value').textContent(),
|
|
|
|
getHeaderArgs(),
|
|
|
|
this.page
|
|
|
|
.locator('[data-is-current-arg="true"]')
|
|
|
|
.locator('[data-test-name="arg-name"]')
|
|
|
|
.textContent(),
|
|
|
|
getCommandName(),
|
|
|
|
])
|
|
|
|
return {
|
|
|
|
stage: 'arguments',
|
|
|
|
currentArgKey: currentArgKey || '',
|
|
|
|
currentArgValue: currentArgValue || '',
|
|
|
|
headerArguments,
|
|
|
|
highlightedHeaderArg: highlightedHeaderArg || '',
|
|
|
|
commandName: commandName || '',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectState = async (expected: CmdBarSerialised) => {
|
|
|
|
return expect.poll(() => this._serialiseCmdBar()).toEqual(expected)
|
|
|
|
}
|
|
|
|
/** The method will use buttons OR press enter randomly to progress the cmdbar,
|
|
|
|
* this could have unexpected results depending on what's focused
|
|
|
|
*
|
|
|
|
* TODO: This method assumes the user has a valid input to the current stage,
|
|
|
|
* and assumes we are past the `pickCommand` step.
|
|
|
|
*/
|
|
|
|
progressCmdBar = async (shouldFuzzProgressMethod = true) => {
|
2025-04-07 07:08:31 -04:00
|
|
|
await this.page.waitForTimeout(2000)
|
|
|
|
const arrowButton = this.page.getByRole('button', {
|
|
|
|
name: 'arrow right Continue',
|
|
|
|
})
|
|
|
|
if (await arrowButton.isVisible()) {
|
|
|
|
await arrowButton.click()
|
2024-09-26 18:25:05 +10:00
|
|
|
} else {
|
2025-04-07 07:08:31 -04:00
|
|
|
await this.page
|
|
|
|
.getByRole('button', { name: 'checkmark Submit command' })
|
|
|
|
.click()
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|
|
|
|
}
|
2024-12-20 13:39:06 +11:00
|
|
|
|
2025-02-11 11:13:25 -06:00
|
|
|
// Added data-testid to the command bar buttons
|
|
|
|
// command-bar-continue are the buttons to go to the next step
|
|
|
|
// does not include the submit which is the final button press
|
|
|
|
// aka the right arrow button
|
|
|
|
continue = async () => {
|
|
|
|
const continueButton = this.page.getByTestId('command-bar-continue')
|
|
|
|
await continueButton.click()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Added data-testid to the command bar buttons
|
|
|
|
// command-bar-submit is the button for the final step to submit
|
|
|
|
// the command bar flow aka the checkmark button.
|
|
|
|
submit = async () => {
|
|
|
|
const submitButton = this.page.getByTestId('command-bar-submit')
|
|
|
|
await submitButton.click()
|
|
|
|
}
|
|
|
|
|
2024-12-20 13:39:06 +11:00
|
|
|
openCmdBar = async (selectCmd?: 'promptToEdit') => {
|
2025-03-05 14:09:21 -05:00
|
|
|
await this.cmdBarOpenBtn.click()
|
2024-12-20 13:39:06 +11:00
|
|
|
await expect(this.page.getByPlaceholder('Search commands')).toBeVisible()
|
|
|
|
if (selectCmd === 'promptToEdit') {
|
|
|
|
const promptEditCommand = this.page.getByText(
|
|
|
|
'Use Zoo AI to edit your kcl'
|
|
|
|
)
|
|
|
|
await expect(promptEditCommand.first()).toBeVisible()
|
|
|
|
await promptEditCommand.first().scrollIntoViewIfNeeded()
|
|
|
|
await promptEditCommand.first().click()
|
|
|
|
}
|
|
|
|
}
|
2025-01-17 14:46:52 -05:00
|
|
|
|
|
|
|
get cmdSearchInput() {
|
|
|
|
return this.page.getByTestId('cmd-bar-search')
|
|
|
|
}
|
|
|
|
|
|
|
|
get argumentInput() {
|
|
|
|
return this.page.getByTestId('cmd-bar-arg-value')
|
|
|
|
}
|
|
|
|
|
|
|
|
get cmdOptions() {
|
|
|
|
return this.page.getByTestId('cmd-bar-option')
|
|
|
|
}
|
|
|
|
|
|
|
|
chooseCommand = async (commandName: string) => {
|
|
|
|
await this.cmdOptions.getByText(commandName).click()
|
|
|
|
}
|
Add ability to create and open URLs to create files (#4166)
* Rename `homeMachine` and accessories to `projectsMachine`
* Separate out `/home` route from `projectsMachine`
* Add logic to navigate out from deleted or renamed project
* Show a warning in the command palette for deleting a project
* Make it navigate when you create a project
* Update "New project" button to use command bar flow
Closes #2585
* More explicit warning message text
* Make projects watching code not run in web
* Tests first version: nested loops
* Tests second version: flattened
* Remove console logs
* Fix tsc
* @jtran feedback, use the type guard util
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Fix tests that relied on one-click, no-navigation project creation
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)"
This reverts commit 7545b61b49dd35cbd229aa5c35273d52e5db8739.
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)"
This reverts commit 3d2e48732c588b9964502b6590da139c1a0d91b0.
* Add a mask to the state indicator to client-side scale test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Fix lint
* Fix tsc
* Add menu item to share link to file
* Forward query params while redirecting to /home or /file
* Add (broken) event logic and command triggering logic
* Fix a couple stray tests that still relied on the old way of creating projects
* De-flake another text that could be thrown off by toast-based selectors
* FMT
* Dumb test error because I was rushing
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Ahhh more flaky toasts, they're everywhere!
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Side quest: Only register commands once, power their disabled status while selecting commands via optional actor
* Get query-triggered command working in browser too
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Tests always run on localhost, don't expect the prod origin
* rerun CI
* wip
* wip
* Everything's pretty much done but url.zoo.dev has been broken and we need to think about how to test reliably
* Merge branch 'main' into franknoirot/4088/create-file-url
* Add useCreateFileLinkQuery on Home page
* Get primary user flow working on desktop
* Rework to open browser app first, then send along to the desktop app if asked
* Styling updates to OpenInDesktopAppHandler
* Clean up unecessary file
* Merge branch 'main' into franknoirot/4088/create-file-url
* Separate creating `createFileUrl` and shortlink so it is unit testable
* Add E2E test for importing file from URL
* Add a couple component tests for OpenInDesktopAppHandler
* Fix the "existing project" user flow
* Add E2E test for "add to existing project" user flow
* Undo mistaken or unecessary changes
* Lints, fmt, tsc
* Fix unit test
* Fix broken rename and delete project commands
Something about the `optionsFromContext` config no longer works with file I/O-related commands. I suspect this has to do with our read/write loop patching
* Fix unit test, use kebab-case for url query param
* Use dev urls everywhere when configured that way
I think we were just using some constants that ended up returning bad
values for dev, it seemed to return a working shortlink when I went
through the flow.
* Clean up unneeded PROD_TOKEN
* Fix browser command flow, because we had made the projectMachine desktop-only on main
* Make the test executor a bit more patient (#5004)
* Fix so that all artifact commands are returned regardless of caching (#5005)
* Fix so that all artifact commands are returned regardless of caching
* Add some more docs and fix up old ones
* Add new lint to disallow use of confusing isNaN (#4999)
* Point-and-click Sweep (first PR) (#4989)
* Refactor 'Delete selection' as actor
Will fix #4662
* WIP logging
* WIP: working Solid3dGetExtrusionFaceInfo for loft
* Working wall deletion of loft
* Add offset plane deletion
* Add feature tree deletion of shell
* Clean up
* Revert "Clean up"
This reverts commit 214763cc2bdf6227d8d8abda0f600f4ec5399327.
* Clean up rust changes, taking the sketch with the most paths
* Working cap selection and deletion
* Clean up
* Add test for loft and offset plane deletion via selection
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores)
* Set reenter: false as it was originally
* Passing test
* Add shell deletion via feature tree test
* Revert the migration to promise actor
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* Use cmd.id as solid_id after latest engine merge
* Add feature tree deletion of offset plane and fix lint
* Add feature tree deletion of loft
* Clean up
* Better comment
* Lint fix
* Remove sketch sorting
* WIP: sweep point-and-click
* Working sweep
* Add test
* Make sweep a development command
* Fix tsc error
* Clean up for review
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Upgrade typescript-eslint from 5.62.0 to 8.19.1 and remove eslint-config-react-app (#5006)
* Fix lost lints and add new ones (#5011)
* Add eslint-plugin-jsx-a11y dependency
* Add jsx-a11y lint
* Add eslint-plugin-react-hooks dependency
* Add react hooks lints
* Ignore new react hooks lint in tests
* Add eslint-plugin-testing-library dependency
* Add testing-library lint
* Fix yarn lint to use all files recursively
* Developer workflow: added auto generated workspace file from vitest extension in vscode (#4997)
* chore: added auto generated workspace file from vitest extension in vscode
* fix: auto fmt fixes
* Change Dependabot PRs to always be made on Mondays (#5025)
* Add packages to Dependabot updates (#5024)
* Bump @lezer/generator from 1.7.1 to 1.7.2 (#5018)
Bumps [@lezer/generator](https://github.com/lezer-parser/generator) from 1.7.1 to 1.7.2.
- [Changelog](https://github.com/lezer-parser/generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lezer-parser/generator/compare/1.7.1...1.7.2)
---
updated-dependencies:
- dependency-name: "@lezer/generator"
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Bump handlebars from 6.2.0 to 6.3.0 in /src/wasm-lib (#5012)
Bumps [handlebars](https://github.com/sunng87/handlebars-rust) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/sunng87/handlebars-rust/releases)
- [Changelog](https://github.com/sunng87/handlebars-rust/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sunng87/handlebars-rust/compare/v6.2.0...v6.3.0)
---
updated-dependencies:
- dependency-name: handlebars
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Bump syn from 2.0.95 to 2.0.96 in /src/wasm-lib (#5015)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.95 to 2.0.96.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.95...2.0.96)
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix artifact types to be more accurate (#5022)
* Fix Cargo.lock to not have changes (#5034)
* Upgrade all wasm-bindgen dependencies together (#5037)
* Disable auto-updater on non-versioned builds (#5042)
* turns on helix from edge (#5036)
* updates for new lib
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* autocomplete
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* bump version
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* bump all the things
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* new samples
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* docs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
---------
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* ci: Add yarn test of packages/codemirror-lang-kcl (#5035)
* ci: Add yarn test of packages/codemirror-lang-kcl
* Fix CI error running tests
* Fix postcss config error
* Bump xstate from 5.17.4 to 5.19.2 (#5027)
* Hook up chamfer UI with AST-mod (#4694)
* button
* config
* hook up with ast
* cmd bar test
* button states fix and test
* little naming fix
* xState action to actor
* remove button state test updates
* fixture-based approach
* nightly
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update src/lib/toolbar.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
---------
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
* Remove Redundant Fillet Button State Test (#5009)
delete obsolete test
* Bump @types/node from 20.14.9 to 22.10.6 in /packages/codemirror-lsp-client (#5041)
* custom axis and origin example for helix (#5057)
* custom axis and origin for helix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* empty
---------
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Bump typescript from 5.7.2 to 5.7.3 (#5021)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.2 to 5.7.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)
---
updated-dependencies:
- dependency-name: typescript
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Refactor: break out `copyFileShareLink` into standalone function
* Add "Share file" to command palette
* Update dumb use of site URL instead of prod app URL
* fmt
* @lf94 nit
* @pierremtb spinner feedback
* Hide share link command and disable menu item for now
* Just comment out the command config for now
---------
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: Adam Sunderland <iterion@gmail.com>
Co-authored-by: Adam Sunderland <adam@kittycad.io>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
Co-authored-by: max <margorskyi@gmail.com>
2025-01-23 19:18:27 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select an option from the command bar
|
|
|
|
*/
|
|
|
|
selectOption = (options: Parameters<typeof this.page.getByRole>[1]) => {
|
|
|
|
return this.page.getByRole('option', options)
|
|
|
|
}
|
2025-02-27 05:44:40 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Captures a snapshot of the request sent to the text-to-cad API endpoint
|
|
|
|
* and saves it to a file named after the current test.
|
|
|
|
*
|
|
|
|
* The snapshot file will be saved in the specified directory with a filename
|
|
|
|
* derived from the test's full path (including describe blocks).
|
|
|
|
*
|
|
|
|
* @param testInfoInOrderToGetTestTitle The TestInfo object from the test context
|
|
|
|
* @param customOutputDir Optional custom directory for the output file
|
|
|
|
*/
|
|
|
|
async captureTextToCadRequestSnapshot(
|
|
|
|
testInfoInOrderToGetTestTitle: TestInfo,
|
|
|
|
customOutputDir = 'e2e/playwright/snapshots/prompt-to-edit'
|
|
|
|
) {
|
|
|
|
// First sanitize each title component individually
|
|
|
|
const sanitizedTitleComponents = [
|
|
|
|
...testInfoInOrderToGetTestTitle.titlePath.slice(0, -1), // Get all parent titles
|
|
|
|
testInfoInOrderToGetTestTitle.title, // Add the test title
|
|
|
|
].map(
|
|
|
|
(component) =>
|
|
|
|
component
|
|
|
|
.replace(/[^a-z0-9]/gi, '-') // Replace non-alphanumeric chars with hyphens
|
|
|
|
.toLowerCase()
|
|
|
|
.replace(/-+/g, '-') // Replace multiple consecutive hyphens with a single one
|
|
|
|
.replace(/^-|-$/g, '') // Remove leading/trailing hyphens
|
|
|
|
)
|
|
|
|
|
|
|
|
// Join the sanitized components with -- as a clear separator
|
|
|
|
const sanitizedTestName = sanitizedTitleComponents.join('--')
|
|
|
|
|
|
|
|
// Create the output path
|
|
|
|
const outputPath = path.join(
|
|
|
|
customOutputDir,
|
|
|
|
`${sanitizedTestName}.snap.json`
|
|
|
|
)
|
|
|
|
|
|
|
|
// Create a handler function that saves request bodies to a file
|
|
|
|
const requestHandler = (route: Route, request: Request) => {
|
|
|
|
try {
|
|
|
|
const requestBody = request.postDataJSON()
|
|
|
|
|
|
|
|
// Ensure directory exists
|
|
|
|
const dir = path.dirname(outputPath)
|
|
|
|
if (!fs.existsSync(dir)) {
|
|
|
|
fs.mkdirSync(dir, { recursive: true })
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write the request body to the file
|
|
|
|
fs.writeFileSync(outputPath, JSON.stringify(requestBody, null, 2))
|
|
|
|
|
|
|
|
console.log(`Saved text-to-cad API request to: ${outputPath}`)
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Error processing text-to-cad request:', error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use void to explicitly mark the promise as ignored
|
|
|
|
void route.continue()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start monitoring requests
|
|
|
|
await this.page.route('**/ml/text-to-cad/iteration', requestHandler)
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
`Monitoring text-to-cad API requests. Output will be saved to: ${outputPath}`
|
|
|
|
)
|
|
|
|
}
|
2024-09-26 18:25:05 +10:00
|
|
|
}
|