Files
modeling-app/README.md

459 lines
18 KiB
Markdown
Raw Normal View History

![Zoo Modeling App](/public/zma-logomark-outlined.png)
2023-09-14 01:16:24 -04:00
## Zoo Modeling App
2022-11-12 13:11:54 +11:00
2024-10-04 14:27:54 -07:00
download at [zoo.dev/modeling-app/download](https://zoo.dev/modeling-app/download)
2023-01-12 11:55:58 +11:00
A CAD application from the future, brought to you by the [Zoo team](https://zoo.dev).
2023-09-14 01:16:24 -04:00
Modeling App is our take on what a modern modelling experience can be. It is applying several lessons learned in the decades since most major CAD tools came into existence:
2023-09-14 01:16:24 -04:00
- All artifacts—including parts and assemblies—should be represented as human-readable code. At the end of the day, your CAD project should be "plain text"
- This makes version control—which is a solved problem in software engineering—trivial for CAD
- All GUI (or point-and-click) interactions should be actions performed on this code representation under the hood
- This unlocks a hybrid approach to modeling. Whether you point-and-click as you always have or you write your own KCL code, you are performing the same action in Modeling App
2023-09-14 01:16:24 -04:00
- Everything graphics _has_ to be built for the GPU
- Most CAD applications have had to retrofit support for GPUs, but our geometry engine is made for GPUs (primarily Nvidia's Vulkan), getting the order of magnitude rendering performance boost with it
- Make the resource-intensive pieces of an application auto-scaling
- One of the bottlenecks of today's hardware design tools is that they all rely on the local machine's resources to do the hardest parts, which include geometry rendering and analysis. Our geometry engine parallelizes rendering and just sends video frames back to the app (seriously, inspect source, it's just a `<video>` element), and our API will offload analysis as we build it in
We are excited about what a small team of people could build in a short time with our API. We welcome you to try our API, build your own applications, or contribute to ours!
Modeling App is a _hybrid_ user interface for CAD modeling. You can point-and-click to design parts (and soon assemblies), but everything you make is really just [`kcl` code](https://github.com/KittyCAD/kcl-experiments) under the hood. All of your CAD models can be checked into source control such as GitHub and responsibly versioned, rolled back, and more.
2023-09-14 01:16:24 -04:00
The 3D view in Modeling App is just a video stream from our hosted geometry engine. The app sends new modeling commands to the engine via WebSockets, which returns back video frames of the view within the engine.
2023-09-14 01:16:24 -04:00
## Tools
- UI
- [React](https://react.dev/)
- [Headless UI](https://headlessui.com/)
- [TailwindCSS](https://tailwindcss.com/)
- [XState](https://xstate.js.org/)
2023-09-14 01:16:24 -04:00
- Networking
- WebSockets (via [KittyCAD TS client](https://github.com/KittyCAD/kittycad.ts))
- Code Editor
- [CodeMirror](https://codemirror.net/)
- Custom WASM LSP Server
- Modeling
- [KittyCAD TypeScript client](https://github.com/KittyCAD/kittycad.ts)
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
2022-11-12 13:11:54 +11:00
2023-09-14 01:16:24 -04:00
[Original demo slides](https://github.com/KittyCAD/Eng/files/10398178/demo.pdf)
2022-11-12 13:11:54 +11:00
2023-09-14 01:16:24 -04:00
## Get started
2022-11-12 13:11:54 +11:00
2023-09-14 01:16:24 -04:00
We recommend downloading the latest application binary from [our Releases page](https://github.com/KittyCAD/modeling-app/releases). If you don't see your platform or architecture supported there, please file an issue.
2023-01-22 07:46:53 +11:00
2023-09-14 01:16:24 -04:00
## Running a development build
2023-01-22 07:46:53 +11:00
First, [install Rust via `rustup`](https://www.rust-lang.org/tools/install). This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We always use the latest stable version of Rust, so you may need to run `rustup update stable`. Then, run:
2022-11-12 13:11:54 +11:00
2023-01-12 11:49:01 +11:00
```
yarn install
```
2023-09-14 01:16:24 -04:00
followed by:
```
yarn build:wasm
```
2024-04-26 09:59:10 +10:00
or if you have the gh cli installed
2024-04-26 09:59:10 +10:00
```
./get-latest-wasm-bundle.sh # this will download the latest main wasm bundle
```
2023-09-14 01:16:24 -04:00
That will build the WASM binary and put in the `public` dir (though gitignored).
Finally, to run the web app only, run:
2022-11-12 13:11:54 +11:00
```
2023-09-14 01:16:24 -04:00
yarn start
```
2022-11-12 13:11:54 +11:00
If you're not an KittyCAD employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
2024-05-02 19:04:29 +10:00
### Development environment variables
The Copilot LSP plugin in the editor requires a Zoo API token to run. In production, we authenticate this with a token via cookie in the browser and device auth token in the desktop environment, but this token is inaccessible in the dev browser version because the cookie is considered "cross-site" (from `localhost` to `dev.zoo.dev`). There is an optional environment variable called `VITE_KC_DEV_TOKEN` that you can populate with a dev token in a `.env.development.local` file to not check it into Git, which will use that token instead of other methods for the LSP service.
### Developing in Chrome
Chrome is in the process of rolling out a new default which
[blocks Third-Party Cookies](https://developer.chrome.com/en/docs/privacy-sandbox/third-party-cookie-phase-out/).
If you're having trouble logging into the `modeling-app`, you may need to
enable third-party cookies. You can enable third-party cookies by clicking on
the eye with a slash through it in the URL bar, and clicking on "Enable
Third-Party Cookies".
Lf94/tauri to electron (#3315) * Get electron building something at all * Merge Frank test setup work (#3418) * Working window.electron.getPath * Loading project-specific settings in electron tests * Simplify test until we can get snapshots/traces working in electron tests * test tweaks --------- Co-authored-by: Frank Noirot <frank@kittycad.io> * add test #3375 and #3420 * put kcl files together * move files * can sort projects #3362 * File in the file pane should open with a single click #3385 * pressing delete on home screen should do nothing #3387 * add aria labels to icons * Rename and delete projects, also spam arrow keys when renaming #3364 #3365 #3259 * Fix up paths * Update flake.nix to support Electron * Remove a layer of indirection * Work without a web server * Fix settings#projectDir link on home * Fix login (requires new @kittycad/lib WHICH IS NOT INCLUDED HERE) * Lee: Tests are broken because auth skip needs to happen * get setting override envs passed through * tweak eletron CI * yml tweak * fmt * NUKE tauri shit post merge with main * another test auth tweak * Revert "another test auth tweak" This reverts commit b2254b10af6d706d6b03b4c68e60d917834eb81d. * try CI again * CI tweaks * SKIP_AUTH true now on playwright * Skipping auth when NODE_ENV=development now * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * Use BASE_URL() * fix exists Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix foldername for macos Signed-off-by: Jess Frazelle <github@jessfraz.com> * update for windows Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix version in lower right Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup unused imports Signed-off-by: Jess Frazelle <github@jessfraz.com> * progress on is playwright Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix test folders Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri from actions bullshit Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri dir Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups the coredump async shit Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * node env dev Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix cancellable Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup unnessary things Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * env vars Signed-off-by: Jess Frazelle <github@jessfraz.com> * Bring back fix for NOT using hardcoded main.kcl * env Signed-off-by: Jess Frazelle <github@jessfraz.com> * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * Revert "updates" This reverts commit da5d9f1043eb94404e8b3f8044088e990e34a4ef. * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri clippuy Signed-off-by: Jess Frazelle <github@jessfraz.com> * less retries for now, no debug Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * tsconfig Signed-off-by: Jess Frazelle <github@jessfraz.com> * small tsc fix * update some tsc Signed-off-by: Jess Frazelle <github@jessfraz.com> * tsc env Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix other tsc Signed-off-by: Jess Frazelle <github@jessfraz.com> * small change for routeLoaders * rm old screenshot Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix auth Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix last onew Signed-off-by: Jess Frazelle <github@jessfraz.com> * auth clean up * fix package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * dissmissed screen on tests * add waits between files being written * put back retried Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix weird programMemory Map issue * put private back * Revert "put private back" This reverts commit d311b978ca5dcd5880a1b58228dbccec1ba49195. * Revert "fix weird programMemory Map issue" This reverts commit 6c387bdf627c9432194e4b93cf073d456ea2f55b. * remove serde-wasm-bindgen Signed-off-by: Jess Frazelle <github@jessfraz.com> * add env Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix tests * more test tweaks * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * another tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * more test tweaks * more tweaks * increase macos timeout * try fix macos * disable macos playwright tests --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Adam Sunderland <iterion@gmail.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-16 07:15:42 -04:00
## Desktop
2023-08-08 06:05:26 +10:00
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
2023-09-14 01:16:24 -04:00
2023-08-08 06:05:26 +10:00
```
yarn tron:start
2023-08-08 06:05:26 +10:00
```
2023-09-14 01:16:24 -04:00
This will start the application and hot-reload on changes.
2023-08-08 06:05:26 +10:00
Lf94/tauri to electron (#3315) * Get electron building something at all * Merge Frank test setup work (#3418) * Working window.electron.getPath * Loading project-specific settings in electron tests * Simplify test until we can get snapshots/traces working in electron tests * test tweaks --------- Co-authored-by: Frank Noirot <frank@kittycad.io> * add test #3375 and #3420 * put kcl files together * move files * can sort projects #3362 * File in the file pane should open with a single click #3385 * pressing delete on home screen should do nothing #3387 * add aria labels to icons * Rename and delete projects, also spam arrow keys when renaming #3364 #3365 #3259 * Fix up paths * Update flake.nix to support Electron * Remove a layer of indirection * Work without a web server * Fix settings#projectDir link on home * Fix login (requires new @kittycad/lib WHICH IS NOT INCLUDED HERE) * Lee: Tests are broken because auth skip needs to happen * get setting override envs passed through * tweak eletron CI * yml tweak * fmt * NUKE tauri shit post merge with main * another test auth tweak * Revert "another test auth tweak" This reverts commit b2254b10af6d706d6b03b4c68e60d917834eb81d. * try CI again * CI tweaks * SKIP_AUTH true now on playwright * Skipping auth when NODE_ENV=development now * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * Use BASE_URL() * fix exists Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix foldername for macos Signed-off-by: Jess Frazelle <github@jessfraz.com> * update for windows Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix version in lower right Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup unused imports Signed-off-by: Jess Frazelle <github@jessfraz.com> * progress on is playwright Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix test folders Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri from actions bullshit Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri dir Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups the coredump async shit Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * node env dev Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix cancellable Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup unnessary things Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * env vars Signed-off-by: Jess Frazelle <github@jessfraz.com> * Bring back fix for NOT using hardcoded main.kcl * env Signed-off-by: Jess Frazelle <github@jessfraz.com> * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * Revert "updates" This reverts commit da5d9f1043eb94404e8b3f8044088e990e34a4ef. * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove tauri clippuy Signed-off-by: Jess Frazelle <github@jessfraz.com> * less retries for now, no debug Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * tsconfig Signed-off-by: Jess Frazelle <github@jessfraz.com> * small tsc fix * update some tsc Signed-off-by: Jess Frazelle <github@jessfraz.com> * tsc env Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix other tsc Signed-off-by: Jess Frazelle <github@jessfraz.com> * small change for routeLoaders * rm old screenshot Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix auth Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix last onew Signed-off-by: Jess Frazelle <github@jessfraz.com> * auth clean up * fix package.json Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * dissmissed screen on tests * add waits between files being written * put back retried Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix weird programMemory Map issue * put private back * Revert "put private back" This reverts commit d311b978ca5dcd5880a1b58228dbccec1ba49195. * Revert "fix weird programMemory Map issue" This reverts commit 6c387bdf627c9432194e4b93cf073d456ea2f55b. * remove serde-wasm-bindgen Signed-off-by: Jess Frazelle <github@jessfraz.com> * add env Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix tests * more test tweaks * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * another tweak * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * more test tweaks * more tweaks * increase macos timeout * try fix macos * disable macos playwright tests --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Adam Sunderland <iterion@gmail.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-16 07:15:42 -04:00
Devtools can be opened with the usual Cmd/Ctrl-Shift-I.
2023-08-08 06:05:26 +10:00
To build, run `yarn tron:package`.
2024-08-07 06:27:23 +10:00
## Checking out commits / Bisecting
Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash
yarn install
yarn build:wasm
2024-08-07 06:27:23 +10:00
yarn start # or yarn build:local && yarn serve for slower but more production-like build
```
2023-09-14 01:16:24 -04:00
## Before submitting a PR
Before you submit a contribution PR to this repo, please ensure that:
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
- You have separated out refactoring commits from feature commits as much as possible
- You have run all of the following commands locally:
- `yarn fmt`
- `yarn tsc`
- `yarn test`
- Here they are all together: `yarn fmt && yarn tsc && yarn test`
## Release a new version
#### 1. Create a 'Cut release $VERSION' issue
It will be used to document changelog discussions and release testing.
https://github.com/KittyCAD/modeling-app/issues/new
#### 2. Push a new tag
Create a new tag and push it to the repo (eg. `v0.28.0` for `$VERSION`)
```
VERSION=$(./scripts/semantic-release.sh)
git tag $VERSION
git push origin --tags
```
This will trigger the `build-apps` workflow, set the version, build & sign the apps, and generate release files as well as updater-test artifacts.
Once the workflow succeeds, a draft release will be created at https://github.com/KittyCAD/modeling-app/releases.
#### 3. Manually test artifacts from the Cut Release PR
##### Release builds
The release builds can be found under the `out-{arch}-{platform}` zip files, at the very bottom of the `build-apps` summary page for the workflow (triggered by the tag in 2.).
Alternatively, the draft release will also include these builds.
Manually test against this [list](https://github.com/KittyCAD/modeling-app/issues/3588) across Windows, MacOS, Linux and posting results as comments in the issue.
##### Updater-test builds
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
```
# Windows (PowerShell)
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
# macOS
/Applications/Zoo\ Modeling\ App.app/Contents/MacOS/Zoo\ Modeling\ App
# Linux
./Zoo Modeling App-{version}-{arch}-linux.AppImage
```
#### 4. Publish the release
Head over to https://github.com/KittyCAD/modeling-app/releases, paste in the changelog discussed in the issue, and publish the draft release created by the `build-apps` workflow from step 2.
A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, which can be found under `release` event filter. On success, the files will be uploaded to the public bucket and the announcement on Discord will be sent.
#### 5. Close the issue
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
## Fuzzing the parser
Make sure you install cargo fuzz:
```bash
$ cargo install cargo-fuzz
```
```bash
$ cd src/wasm-lib/kcl
# list the fuzz targets
$ cargo fuzz list
# run the parser fuzzer
$ cargo +nightly fuzz run parser
```
2023-09-14 01:16:24 -04:00
For more information on fuzzing you can check out
[this guide](https://rust-fuzz.github.io/book/cargo-fuzz.html).
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
## Tests
### Playwright tests
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
You will need a `./e2e/playwright/playwright-secrets.env` file:
```bash
$ touch ./e2e/playwright/playwright-secrets.env
$ cat ./e2e/playwright/playwright-secrets.env
token=<dev.zoo.dev/account/api-tokens>
snapshottoken=<your-snapshot-token>
```
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
For a portable way to run Playwright you'll need Docker.
#### Generic example
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
After that, open a terminal and run:
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```bash
docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
and in another terminal, run:
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```
#### Specific example
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
open a terminal and run:
Show when user can't connect because of a bad token (#2105) * Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771) This reverts commit 1913519f686d778413d4fead2e7d194d29c83fe9. * Fix build errors * Add new error states to network status notification * Remove unused variable * Refactor to use Context API for network status * Don't do any stream events if network is not ok * Catch LSP errors on bad auth * Show when authentication is bad (cookie header only) * Fix formatting * Fix up types * Revert awaiting on lsp failure * Fix tsc * wip * wip * fmt * Fix typing * Incorporate ping health; yarn make:dev; faster video stream loss notice * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls * run ci pls * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * run ci pls again * Remove unused variables * Add new instructions on running Playwright anywhere * Please the Playwright. Praise the Playwright. * Correct a vitest * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci again * Fix tests unrelated to this PR * Fix flakiness in for segments tests * Bump to 2 workers * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fmt * fmt * Fixups * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * ci * Set workers to 1 * Wait for network status listeners before connecting * Fix initial connection requirements and trying 2 workers again --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-04 08:32:24 -04:00
```bash
docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
```
and in another terminal, run:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```
run a specific test change the test from `test('...` to `test.only('...`
(note if you commit this, the tests will instantly fail without running any of the tests)
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
run headed
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```
yarn playwright test --headed
```
run with step through debugger
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
```
PWDEBUG=1 yarn playwright test
```
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
If you want to limit to a single browser use `--project="webkit"` or `firefox`, `Google Chrome`
Or comment out browsers in `playwright.config.ts`.
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
<details>
<summary>
Where `./store` should look like this
</summary>
```JSON
{
"cookies": [],
"origins": [
{
"origin": "http://localhost:3000",
"localStorage": [
{
"name": "store",
"value": "{\"state\":{\"openPanes\":[\"code\"]},\"version\":0}"
},
{
"name": "persistCode",
"value": ""
},
{
"name": "TOKEN_PERSIST_KEY",
"value": "your-token"
}
]
}
]
}
```
</details>
However because much of our tests involve clicking in the stream at specific locations, it's code-gen looks `await page.locator('video').click();` when really we need to use a pixel coord, so I think it's of limited use.
### Unit and component tests
If you already haven't, run the following:
```
yarn
yarn build:wasm
yarn start
```
and finally:
```
Nadro/4012/ci cd update (#4062) * chore: saving off package.json progress unit tests fail in main * fix: implementing a one liner for unit tests * fix: renaming test:unit:local * chore: adding playwright tests * fix: making package.json not destructive to keep same pipeline commands for now * fix: reordering * fix: added tags for OS tests, moved kill-port to dev depen * fix: OS skipping at tag level * fix: lint, fmt, tsc, etc... * Look at this (photo)Graph *in the voice of Nickelback* * fix: new formatting * fix: removing the ci copy, do not like it * Look at this (photo)Graph *in the voice of Nickelback* * chore: updating readme with explanation on the commands for CI CD simulation locally * fix: package.json command for unit test, removing cached breaking cache in unit tests * fix: fixing copy and typos in README.md for CI CD section * fix: adding a duplicate command for a better name. CI CD will use it in a future PR * chore: trying to clean up the copy and commands for CI CD tests * chore: porting the bash code in the YAML to a bash script then using matrix permutations to control the runtime * fix: typos * fix: another typo, missed these went porting to the bash script logic * fix: I think I need the checkout action since it has the repo code? * fix: wrote absolute path not the relative hidden path, ope * fix: does this cache give me the yarn install of playwright? * fix: yarn cannot find the binary, use the yarn command * fix: remove all uses...? * chore: adding bash script for electron runtimes * fix: copy cleanup * fix: typo when copy and pasting the exclude logic, ope * fix: this is wrong * fix: build:wasm is a requirement for yarn tsc * fix: reorder? * fix: renaming integrations to e2e * fix: windows is complaining about a pipe issue in the bash script? * fix: escaping double quotes in windows? * chore: consolidating commands into 1 file and easier YAML configuation for electron * chore: mapped multiple OS playwright browser into a single bash script * fix: removing old bash scripts, renaming matrix jobs * fix: missed deleting this when I added the if statements. * chore: removing unused job, xstate typegen more more since v5 * fix: trying to get these two tests to pass on first try * fix: auto fixes * fix: removing old unit test command --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-03 10:40:12 -04:00
yarn test:unit
```
For individual testing:
```
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/) tests, in interactive mode by default.
### Rust tests
```bash
cd src/wasm-lib
KITTYCAD_API_TOKEN=XXX cargo test -- --test-threads=1
```
Where `XXX` is an API token from the production engine (NOT the dev environment).
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
```
cd src/wasm-lib
KITTYCAD_API_TOKEN=XXX cargo run nextest
```
### Mapping CI CD jobs to local commands
When you see the CI CD fail on jobs you may wonder three things
- Do I have a bug in my code?
- Is the test flaky?
- Is there a bug in `main`?
To answer these questions the following commands will give you confidence to locate the issue.
#### Static Analysis
Part of the CI CD pipeline performs static analysis on the code. Use the following commands to mimic the CI CD jobs.
The following set of commands should get us closer to one and done commands to instantly retest issues.
```
yarn test-setup
```
> Gotcha, are packages up to date and is the wasm built?
```
yarn tsc
yarn fmt-check
yarn lint
yarn test:unit:local
```
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
#### E2E Tests
**Playwright Browser**
These E2E tests run in a browser (without electron).
There are tests that are skipped if they are ran in a windows OS or Linux OS. We can use playwright tags to implement test skipping.
Breaking down the command `yarn test:playwright:browser:chrome:windows`
- The application is `playwright`
- The runtime is a `browser`
- The specific `browser` is `chrome`
- The test should run in a `windows` environment. It will skip tests that are broken or flaky in the windows OS.
```
yarn test:playwright:browser:chrome
yarn test:playwright:browser:chrome:windows
yarn test:playwright:browser:chrome:ubuntu
```
**Playwright Electron**
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
```
yarn test:playwright:electron:local
yarn test:playwright:electron:windows:local
yarn test:playwright:electron:macos:local
yarn test:playwright:electron:ubuntu:local
```
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
#### Some notes on CI
The tests are broken into snapshot tests and non-snapshot tests, and they run in that order, they automatically commit new snap shots, so if you see an image commit check it was an intended change. If we have non-determinism in the snapshots such that they are always committing new images, hopefully this annoyance makes us fix them asap, if you notice this happening let Kurt know. But for the odd occasion `git reset --hard HEAD~ && git push -f` is your friend.
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
How to interpret failing playwright tests?
If your tests fail, click through to the action and see that the tests failed on a line that includes `await page.getByTestId('loading').waitFor({ state: 'detached' })`, this means the test fail because the stream never started. It's you choice if you want to re-run the test, or ignore the failure.
We run on ubuntu and macos, because safari doesn't work on linux because of the dreaded "no RTCPeerConnection variable" error. But linux runs first and then macos for the same reason that we limit the number of parallel tests to 1 because we limit stream connections per user, so tests would start failing we if let them run together.
2023-11-24 09:06:13 +11:00
If something fails on CI you can download the artifact, unzip it and then open `playwright-report/data/<UUID>.zip` with https://trace.playwright.dev/ to see what happened.
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
#### Getting started writing a playwright test in our app
Besides following the instructions above and using the playwright docs, our app is weird because of the whole stream thing, which means our testing is weird. Because we've just figured out this stuff and therefore docs might go stale quick here's a 15min vid/tutorial
https://github.com/KittyCAD/modeling-app/assets/29681384/6f5e8e85-1003-4fd9-be7f-f36ce833942d
<details>
<summary>
PS: for the debug panel, the following JSON is useful for snapping the camera
initial playwright setup and test (#1039) * initial playwright setup and test * try verbose logging * double check resolution * double check token * remove logs * try running on ubuntu and macos * move e2e tests * vitest ignores playwright tests * add a series of tests * tweak yarn setup * typo * update fmt * action typo * rust toolchain? * remove .only from playwright test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * add pan and zoom back * try puting os in commit message * A snapshot a day keeps the bugs away! 📷🐛 .os * A snapshot a day keeps the bugs away! 📷🐛 .os * fix commit message * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * add command logs to UI for axis tests * typo * fmt * remove .only * add auto complete test * remove .only * update queries to be more playwright recommended * move test utils * remove waits from first test * remove old snapshots * re-arrange files and tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * trigger CI * refactor plane test * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * remove .only * try longer wait * try snap shoting * fmt * better CI names * fix * fix linux * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * try make executes on load a bit more robust * fix * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * stabilise snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: macos-latest) * make tests run linearly * update naming * tidy * .only * update readme * trigger CI * add set tool * util clean up * update readme * readme tweaks * self-review clean up * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * tweak * update readme * Ensure Vite preview server is running before running any Playwright tests (#1114) * Ensure that Vite is serving before tests run * Don't break secrets if developer has extra blank line in env file * @mxschmitt's suggestions * fix * add wait-on types * tsconfig fix * update readme * code template for sktech on each plane test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io>
2023-11-24 08:59:24 +11:00
</summary>
```JSON
{"type":"modeling_cmd_req","cmd_id":"054e5472-e5e9-4071-92d7-1ce3bac61956","cmd":{"type":"default_camera_look_at","center":{"x":15,"y":0,"z":0},"up":{"x":0,"y":0,"z":1},"vantage":{"x":30,"y":30,"z":30}}}
```
</details>
## KCL
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl).
### Logging
To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log some warnings and simple performance metrics. To view these in test runs, use `-- --nocapture`.
To enable memory metrics, build with `--features dhat-heap`.