Compare commits

..

1 Commits

Author SHA1 Message Date
8e56b5997f wiggle move robustness 2024-07-17 20:13:18 +10:00
444 changed files with 26027 additions and 254995 deletions

View File

@ -1,37 +0,0 @@
name: Cryptic KCL Error
description: File a bug report for source code that produces a confusing error
title: "[CRYPTIC]: "
labels: ["cryptic-error"]
assignees: []
body:
- type: markdown
attributes:
value: "Thank you for taking the time to report a confusing error. Please provide as much information as possible to help us resolve it."
- type: textarea
id: kcl
attributes:
label: Paste minimal KCL source that produces a cryptic error
description: Minimal KCL reproducer that produces a cryptic error
placeholder: "const ..."
render: javascript
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: Description of what you expected to happen (if you know).
placeholder: "I expected that..."
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Add any other context about the problem here.
placeholder: "Anything else you want to add..."
validations:
required: false

View File

@ -124,39 +124,28 @@ Before you submit a contribution PR to this repo, please ensure that:
## Release a new version
#### 1. Bump the versions by running `./make-release.sh` and create a Cut Release PR
1. Bump the versions by running `./make-realease.sh` while on a fresh pull of main
That will create the branch with the updated json files for you:
- run `./make-release.sh` or `./make-release.sh patch` for a patch update;
- run `./make-release.sh minor` for minor; or
- run `./make-release.sh major` for major.
That will create the branch with the updated json files for you.
run `./make-release.sh` for a patch update
run `./make-release.sh "minor"` for minor
run `./make-release.sh "major"` for major
After it runs you should just need the push the branch and open a PR.
After it runs you should just need to push the push the branch and open a PR (it will suggest a changelog for you too, delete any that are not user facing)
**Important:** It needs to be prefixed with `Cut release v` to build in release mode and a few other things to test in the best context possible, the intent would be for instance to have `Cut release v1.2.3` for the `v1.2.3` release candidate.
The PR may serve as a place to discuss the human-readable changelog and extra QA.
The PR may then serve as a place to discuss the human-readable changelog and extra QA. The `make-release.sh` tool suggests a changelog for you too to be used as PR description, just make sure to delete lines that are not user facing.
2. Smoke test the artifact from the above PR
We don't have a strict process, but click around and check for anything obvious
One of the artifacts is called updater-test, because we don't have a way to test this fully automated, we have a semi-automated process.
#### 2. Smoke test artifacts from the Cut Release PR
Download updater-test zip file, install the app, run it, expect an updater prompt to v0.99.99, install it and check that the app comes back at that version (on both macOS and Windows).
The release builds can be find under the `artifact` zip, at the very bottom of the `ci` action page for each commit on this branch.
We don't have a strict process, but click around and check for anything obvious, posting results as comments in the Cut Release PR.
The other `ci` output in Cut Release PRs is `updater-test`, because we don't have a way to test this fully automated, we have a semi-automated process. Download updater-test zip file, install the app, run it, expect an updater prompt to a dummy v0.99.99, install it and check that the app comes back at that version (on both macOS and Windows).
#### 3. Merge the Cut Release PR
This will kick the `create-release` action, that creates a _Draft_ release out of this Cut Release PR merge after less than a minute, with the new version as title and Cut Release PR as description.
3. Merge the PR
#### 4. Publish the release
4. Profit (A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions if the PR was correctly named)
Head over to https://github.com/KittyCAD/modeling-app/releases, the draft release corresponding to the merged Cut Release PR should show up at the top as _Draft_. Click on it, verify the content, and hit _Publish_.
#### 5. Profit
A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, which can be found under `release` event filter.
## Fuzzing the parser

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@ const exampleSketch = startSketchOn('XZ')
|> lineTo([0, 20], %)
|> angledLineThatIntersects({
angle: 80,
intersectTag: lineToIntersect,
intersectTag: 'lineToIntersect',
offset: 10
}, %)
|> close(%)
@ -41,92 +41,6 @@ const example = extrude(10, exampleSketch)
angle: number,
// The tag of the line to intersect with.
intersectTag: {
// Engine information for a tag.
info: {
// The id of the tagged object.
id: uuid,
// The path the tag is on.
path: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
},
// The sketch group the tag is on.
sketchGroup: uuid,
// The surface information for the tag.
surface: {
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "extrudePlane",
} |
{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
},
},
value: string,
},
// The offset from the intersecting line.
@ -136,7 +50,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -178,21 +92,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -210,7 +118,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -361,38 +269,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.
@ -548,7 +424,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -590,21 +466,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -622,7 +492,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -773,38 +643,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -83,21 +83,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -115,7 +109,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -266,38 +260,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.
@ -453,7 +415,7 @@ const example = extrude(10, exampleSketch)
`SketchGroup` - A sketch group is a collection of paths.
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -495,21 +457,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -527,7 +483,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -678,38 +634,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,8 +19,8 @@ const example = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([10, 0], %)
|> arc({
angleStart: 120,
angleEnd: 0,
angle_end: 0,
angle_start: 120,
radius: 5
}, %)
|> line([5, 0], %)
@ -41,8 +41,8 @@ const example = startSketchOn('XZ')
const exampleSketch = startSketchOn('XZ')
|> startProfileAt([-10, 0], %)
|> arc({
angleStart: 120,
angleEnd: -60,
angle_end: -60,
angle_start: 120,
radius: 5
}, %)
|> line([10, 0], %)
@ -67,7 +67,7 @@ const example = extrude(10, exampleSketch)
* `sketch_group_set`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED)
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -109,21 +109,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -141,7 +135,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -292,38 +286,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.
@ -479,21 +441,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -511,7 +467,7 @@ const example = extrude(10, exampleSketch)
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -553,21 +509,15 @@ const example = extrude(10, exampleSketch)
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -619,38 +569,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.
@ -825,38 +743,6 @@ const example = extrude(10, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
} |
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

366
docs/kcl/getEdge.md Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -20,11 +20,6 @@ layout: manual
* [`angledLineToY`](kcl/angledLineToY)
* [`arc`](kcl/arc)
* [`asin`](kcl/asin)
* [`assert`](kcl/assert)
* [`assertGreaterThan`](kcl/assertGreaterThan)
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
* [`assertLessThan`](kcl/assertLessThan)
* [`assertLessThanOrEq`](kcl/assertLessThanOrEq)
* [`atan`](kcl/atan)
* [`bezierCurve`](kcl/bezierCurve)
* [`ceil`](kcl/ceil)
@ -36,13 +31,13 @@ layout: manual
* [`extrude`](kcl/extrude)
* [`fillet`](kcl/fillet)
* [`floor`](kcl/floor)
* [`getEdge`](kcl/getEdge)
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
* [`getOppositeEdge`](kcl/getOppositeEdge)
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
* [`helix`](kcl/helix)
* [`hole`](kcl/hole)
* [`import`](kcl/import)
* [`int`](kcl/int)
* [`lastSegX`](kcl/lastSegX)
* [`lastSegY`](kcl/lastSegY)
* [`legAngX`](kcl/legAngX)
@ -62,7 +57,6 @@ layout: manual
* [`patternLinear3d`](kcl/patternLinear3d)
* [`patternTransform`](kcl/patternTransform)
* [`pi`](kcl/pi)
* [`polar`](kcl/polar)
* [`pow`](kcl/pow)
* [`profileStart`](kcl/profileStart)
* [`profileStartX`](kcl/profileStartX)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ const sketch001 = startSketchOn('XY')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -71,21 +71,15 @@ const sketch001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -103,7 +97,7 @@ const sketch001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -254,38 +248,6 @@ const sketch001 = startSketchOn('XY')
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.

View File

@ -28,7 +28,7 @@ const sketch001 = startSketchOn('XY')
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: {
@ -70,21 +70,15 @@ const sketch001 = startSketchOn('XY')
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edgeId: uuid,
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
@ -102,7 +96,7 @@ const sketch001 = startSketchOn('XY')
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group (this will change when the engine's reference to it changes.
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
@ -253,38 +247,6 @@ const sketch001 = startSketchOn('XY')
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
}],
},
// The id of the face.

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Returns the angle of the segment.
```js
segAng(tag: TagIdentifier) -> number
segAng(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
```
### Examples
@ -20,9 +20,9 @@ const exampleSketch = startSketchOn('XZ')
|> line([10, 0], %)
|> line([5, 10], %, $seg01)
|> line([-10, 0], %)
|> angledLine([segAng(seg01), 10], %)
|> angledLine([segAng(seg01, %), 10], %)
|> line([-10, 0], %)
|> angledLine([segAng(seg01), -15], %)
|> angledLine([segAng(seg01, %), -15], %)
|> close(%)
const example = extrude(4, exampleSketch)
@ -32,15 +32,89 @@ const example = extrude(4, exampleSketch)
### Arguments
* `tag`: `TagIdentifier` (REQUIRED)
* `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
// Engine information for a tag.
info: {
// The id of the tagged object.
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
id: uuid,
// The path the tag is on.
path: {
// What the sketch is on (can be a plane or a face).
on: {
// The id of the plane.
id: uuid,
// Origin of the plane.
origin: {
x: number,
y: number,
z: number,
},
type: "plane",
// Type for a plane.
value: "XY" | "XZ" | "YZ" | "Custom",
// What should the planes X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the planes Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
} |
{
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
@ -53,10 +127,109 @@ const example = extrude(4, exampleSketch)
// The to point.
to: [number, number],
},
// The sketch group the tag is on.
sketchGroup: uuid,
// The surface information for the tag.
surface: {
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
@ -87,41 +260,144 @@ const example = extrude(4, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
}],
},
// The id of the face.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
type: "face",
// The tag of the face.
value: string,
// What should the faces X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the faces Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
},
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
},
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
}
```

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Returns the segment end of y.
```js
segEndY(tag: TagIdentifier) -> number
segEndY(segment_name: TagIdentifier, sketch_group: SketchGroup) -> number
```
### Examples
@ -20,7 +20,7 @@ const exampleSketch = startSketchOn('XZ')
|> line([20, 0], %)
|> line([0, 3], %, $thing)
|> line([-10, 0], %)
|> line([0, segEndY(thing)], %)
|> line([0, segEndY(thing, %)], %)
|> line([-10, 0], %)
|> close(%)
@ -31,15 +31,89 @@ const example = extrude(5, exampleSketch)
### Arguments
* `tag`: `TagIdentifier` (REQUIRED)
* `segment_name`: `TagIdentifier` (REQUIRED)
```js
{
// Engine information for a tag.
info: {
// The id of the tagged object.
value: string,
}
```
* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED)
```js
{
// The id of the sketch group.
id: uuid,
// The path the tag is on.
path: {
// What the sketch is on (can be a plane or a face).
on: {
// The id of the plane.
id: uuid,
// Origin of the plane.
origin: {
x: number,
y: number,
z: number,
},
type: "plane",
// Type for a plane.
value: "XY" | "XZ" | "YZ" | "Custom",
// What should the planes X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the planes Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
} |
{
// The extrude group the face is on.
extrudeGroup: {
// The id of the extrusion end cap
endCapId: uuid,
// Chamfers or fillets on this extrude group.
filletOrChamfers: [{
// The engine id of the edge to fillet.
edge_id: uuid,
// The id of the engine command that called this fillet.
id: uuid,
radius: number,
type: "fillet",
} |
{
// The engine id of the edge to chamfer.
edge_id: uuid,
// The id of the engine command that called this chamfer.
id: uuid,
length: number,
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
}],
// The height of the extrude group.
height: number,
// The id of the extrude group.
id: uuid,
// The sketch group.
sketchGroup: {
// The id of the sketch group.
id: uuid,
// What the sketch is on (can be a plane or a face).
on: SketchSurface,
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
@ -52,10 +126,109 @@ const example = extrude(5, exampleSketch)
// The to point.
to: [number, number],
},
// The sketch group the tag is on.
sketchGroup: uuid,
// The surface information for the tag.
surface: {
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
},
// The id of the extrusion start cap
startCapId: uuid,
// The extrude surfaces.
value: [{
// The face id for the extrude plane.
faceId: uuid,
// The id of the geometry.
@ -86,41 +259,144 @@ const example = extrude(5, exampleSketch)
value: string,
},
type: "extrudeArc",
} |
{
// The id for the chamfer surface.
faceId: uuid,
// The id of the geometry.
}],
},
// The id of the face.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
type: "face",
// The tag of the face.
value: string,
// What should the faces X axis be?
xAxis: {
x: number,
y: number,
z: number,
},
// What should the faces Y axis be?
yAxis: {
x: number,
y: number,
z: number,
},
// The z-axis (normal).
zAxis: {
x: number,
y: number,
z: number,
},
},
// The starting path.
start: {
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "chamfer",
} |
{
// The id for the fillet surface.
faceId: uuid,
// The id of the geometry.
id: uuid,
// The source range.
sourceRange: [number, number],
// The tag.
// The to point.
to: [number, number],
},
// Tag identifiers that have been declared in this sketch group.
tags: {
},
// The paths in the sketch group.
value: [{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
type: "fillet",
},
},
// The to point.
to: [number, number],
type: "ToPoint",
} |
{
// arc's direction
ccw: string,
// the arc's center
center: [number, number],
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArcTo",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "TangentialArc",
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Horizontal",
// The x coordinate.
x: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "AngledLineTo",
// The x coordinate.
x: number,
// The y coordinate.
y: number,
} |
{
// The from point.
from: [number, number],
// The tag of the path.
tag: {
digest: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number],
end: number,
start: number,
value: string,
},
// The to point.
to: [number, number],
type: "Base",
}],
}
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ import * as TOML from '@iarna/toml'
import { LineInputsType } from 'lang/std/sketchcombos'
import { Coords2d } from 'lang/std/sketch'
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
import { EngineCommand } from 'lang/std/artifactMap'
import { EngineCommand } from 'lang/std/engineConnection'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { bracket } from 'lib/exampleKcl'
@ -48,6 +48,8 @@ const commonPoints = {
startAt: '[7.19, -9.7]',
num1: 7.25,
num2: 14.44,
// num1: 9.64,
// num2: 19.19,
}
test.afterEach(async ({ context, page }, testInfo) => {
@ -139,9 +141,8 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
await expect(u.codeLocator)
.toHaveText(`const sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)`)
} else {
await page.waitForTimeout(500)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
await page.waitForTimeout(500)
@ -151,9 +152,8 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
.toHaveText(`const sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)`)
} else {
await page.waitForTimeout(500)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
if (openPanes.includes('code')) {
@ -162,9 +162,8 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)
|> line([0, ${commonPoints.num1 + 0.01}], %)`)
} else {
await page.waitForTimeout(500)
}
await page.waitForTimeout(500)
await page.mouse.click(startXPx, 500 - PUR * 20)
if (openPanes.includes('code')) {
await expect(u.codeLocator)
@ -176,7 +175,7 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
}
// deselect line tool
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await page.waitForTimeout(500)
const line1 = await u.getSegmentBodyCoords(`[data-overlay-index="${0}"]`, 0)
@ -204,7 +203,7 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
await expect(page.locator('.cm-cursor')).toHaveCount(2)
}
await page.getByRole('button', { name: 'Length: open menu' }).click()
await page.getByRole('button', { name: 'Constraints' }).click()
await page.getByRole('button', { name: 'Equal Length' }).click()
// Open the code pane.
@ -213,7 +212,7 @@ async function doBasicSketch(page: Page, openPanes: string[]) {
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %, $seg01)
|> line([0, ${commonPoints.num1 + 0.01}], %)
|> angledLine([180, segLen(seg01)], %)`)
|> angledLine([180, segLen(seg01, %)], %)`)
}
test.describe('Basic sketch', () => {
@ -453,7 +452,7 @@ test.describe('Testing Camera Movement', () => {
// await expect(u.codeLocator).toHaveText(code)
// click the line button
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
const hoverOverNothing = async () => {
// await u.canvasLocator.hover({position: {x: 700, y: 325}})
@ -925,10 +924,10 @@ test.describe('Editor tests', () => {
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
await expect(
page.locator('.cm-lint-marker.cm-lint-marker-error')
page.locator('.cm-lintRange.cm-lintRange-error').first()
).toBeVisible()
await page.locator('.cm-lint-marker.cm-lint-marker-error').hover()
await page.locator('.cm-lintRange.cm-lintRange-error').hover()
await expect(page.locator('.cm-diagnosticText').first()).toBeVisible()
await expect(
page.getByText('Cannot redefine `topAng`').first()
@ -1016,18 +1015,18 @@ test.describe('Editor tests', () => {
|> startProfileAt([0, 0], %)
|> line([0, 10], %)
|> line([10, 0], %)
|> line([0, -10], %, $revolveAxis)
|> line([0, -10], %, 'revolveAxis')
|> close(%)
|> extrude(10, %)
const sketch001 = startSketchOn(box, revolveAxis)
const sketch001 = startSketchOn(box, "revolveAxis")
|> startProfileAt([5, 10], %)
|> line([0, -10], %)
|> line([2, 0], %)
|> line([0, -10], %)
|> close(%)
|> revolve({
axis: revolveAxis,
axis: getEdge('revolveAxis', box),
angle: 90
}, %)
`
@ -1045,7 +1044,7 @@ test.describe('Editor tests', () => {
await page.hover('.cm-lint-marker-error')
const searchText =
'sketch profile must lie entirely on one side of the revolution axis'
await expect(page.getByText(searchText)).toBeVisible()
await expect(page.getByText(searchText).first()).toBeVisible()
})
test.describe('Autocomplete works', () => {
test('with enter/click to accept the completion', async ({ page }) => {
@ -1064,7 +1063,7 @@ test.describe('Editor tests', () => {
await page.keyboard.type('const sketch001 = start')
// expect there to be six auto complete options
await expect(page.locator('.cm-completionLabel')).toHaveCount(8)
await expect(page.locator('.cm-completionLabel')).toHaveCount(6)
// this makes sure we can accept a completion with click
await page.getByText('startSketchOn').click()
await page.keyboard.type("'XZ'")
@ -1463,9 +1462,7 @@ test.describe('Can create sketches on all planes and their back sides', () => {
await page.mouse.click(clickCoords.x, clickCoords.y)
await page.waitForTimeout(300) // wait for animation
await expect(
page.getByRole('button', { name: 'Line', exact: true })
).toBeVisible()
await expect(page.getByRole('button', { name: 'Line' })).toBeVisible()
// draw a line
const startXPx = 600
@ -1475,7 +1472,7 @@ test.describe('Can create sketches on all planes and their back sides', () => {
await expect(page.locator('.cm-content')).toHaveText(code)
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await u.openAndClearDebugPanel()
await page.getByRole('button', { name: 'Exit Sketch' }).click()
await u.expectCmdLog('[data-message-type="execution-done"]')
@ -1514,8 +1511,6 @@ test.describe('Can create sketches on all planes and their back sides', () => {
})
test.describe('Copilot ghost text', () => {
test.skip(true, 'Needs to get covered again')
test('completes code in empty file', async ({ page }) => {
const u = await getUtils(page)
// const PUR = 400 / 37.5 //pixeltoUnitRatio
@ -1554,9 +1549,7 @@ test.describe('Copilot ghost text', () => {
await expect(page.locator('.cm-ghostText')).not.toBeVisible()
})
test.skip('copilot disabled in sketch mode no select plane', async ({
page,
}) => {
test('copilot disabled in sketch mode no select plane', async ({ page }) => {
const u = await getUtils(page)
// const PUR = 400 / 37.5 //pixeltoUnitRatio
await page.setViewportSize({ width: 1200, height: 500 })
@ -2103,7 +2096,7 @@ test.describe('Testing settings', () => {
.hover()
await page
.getByRole('button', {
name: 'Roll back theme',
name: 'Roll back theme ; Has tooltip: Roll back to match default',
})
.click()
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
@ -2155,7 +2148,7 @@ test.describe('Testing settings', () => {
.hover()
await page
.getByRole('button', {
name: 'Roll back theme',
name: 'Roll back theme ; Has tooltip: Roll back to match default',
})
.click()
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
@ -2265,50 +2258,6 @@ test.describe('Onboarding tests', () => {
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
})
test('Code resets after confirmation', async ({ page }) => {
const initialCode = `const sketch001 = startSketchOn('XZ')`
// Load the page up with some code so we see the confirmation warning
// when we go to replay onboarding
await page.addInitScript((code) => {
localStorage.setItem('persistCode', code)
}, initialCode)
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
// Replay the onboarding
await page.getByRole('link', { name: 'Settings' }).last().click()
const replayButton = page.getByRole('button', { name: 'Replay onboarding' })
await expect(replayButton).toBeVisible()
await replayButton.click()
// Ensure we see the warning, and that the code has not yet updated
await expect(
page.getByText('Replaying onboarding resets your code')
).toBeVisible()
await expect(page.locator('.cm-content')).toHaveText(initialCode)
const nextButton = page.getByTestId('onboarding-next')
await expect(nextButton).toBeVisible()
await nextButton.click()
// Ensure we see the introduction and that the code has been reset
await expect(page.getByText('Welcome to Modeling App!')).toBeVisible()
await expect(page.locator('.cm-content')).toContainText('// Shelf Bracket')
// Ensure we persisted the code to local storage.
// Playwright's addInitScript method unfortunately will reset
// this code if we try reloading the page as a test,
// so this is our best way to test persistence afaik.
expect(
await page.evaluate(() => {
return localStorage.getItem('persistCode')
})
).toContain('// Shelf Bracket')
})
test('Click through each onboarding step', async ({ page }) => {
const u = await getUtils(page)
@ -2613,7 +2562,7 @@ test.describe('Testing selections', () => {
|> line([-${commonPoints.num2}, 0], %)`)
// deselect line tool
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await u.closeDebugPanel()
const selectionSequence = async () => {
@ -2638,10 +2587,8 @@ test.describe('Testing selections', () => {
// click a segment hold shift and click an axis, see that a relevant constraint is enabled
await topHorzSegmentClick()
await page.keyboard.down('Shift')
const constrainButton = page.getByRole('button', {
name: 'Length: open menu',
})
const absYButton = page.getByRole('button', { name: 'Absolute Y' })
const constrainButton = page.getByRole('button', { name: 'Constraints' })
const absYButton = page.getByRole('button', { name: 'ABS Y' })
await constrainButton.click()
await expect(absYButton).toBeDisabled()
await page.waitForTimeout(100)
@ -3213,7 +3160,7 @@ const extrude001 = extrude(10, sketch001)`
},
{
pos: [816, 244],
expectedCode: 'angledLine([segAng(seg01), yo], %)',
expectedCode: 'angledLine([segAng(seg01, %), yo], %)',
},
{
pos: [1107, 161],
@ -3465,6 +3412,21 @@ const extrude001 = extrude(50, sketch001)
await expect(
page.getByRole('button', { name: 'Edit Sketch' })
).not.toBeVisible()
// selecting an editable sketch but clicking "start sketch" should start a new sketch and not edit the existing one
await page.getByText(selectionsSnippets.extrudeAndEditAllowed).click()
await page.getByRole('button', { name: 'Start Sketch' }).click()
await page.waitForTimeout(200)
await page.getByTestId('KCL Code').click()
await page.waitForTimeout(200)
await page.mouse.click(734, 134)
await page.waitForTimeout(100)
await page.getByTestId('KCL Code').click()
// expect main content to contain `sketch005` i.e. started a new sketch
await page.waitForTimeout(300)
await expect(page.locator('.cm-content')).toHaveText(
/sketch001 = startSketchOn\('XZ'\)/
)
})
test('Deselecting line tool should mean nothing happens on click', async ({
@ -3501,7 +3463,7 @@ const extrude001 = extrude(50, sketch001)
let previousCodeContent = await page.locator('.cm-content').innerText()
// deselect the line tool by clicking it
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await page.mouse.click(700, 200)
await page.waitForTimeout(100)
@ -3514,7 +3476,7 @@ const extrude001 = extrude(50, sketch001)
await expect(page.locator('.cm-content')).toHaveText(previousCodeContent)
// select line tool again
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await u.closeDebugPanel()
@ -3847,24 +3809,13 @@ const extrude001 = extrude(distance001, sketch001)`.replace(
const sketchButton = page.getByRole('button', { name: 'Start Sketch' })
const cmdBarButton = page.getByRole('button', { name: 'Commands' })
const rectangleToolCommand = page.getByRole('option', {
name: 'rectangle',
})
const rectangleToolButton = page.getByRole('button', {
name: 'Corner rectangle',
exact: true,
})
const lineToolCommand = page.getByRole('option', {
name: 'Line',
})
const lineToolButton = page.getByRole('button', {
name: 'Line',
exact: true,
name: 'Rectangle',
})
const rectangleToolButton = page.getByRole('button', { name: 'Rectangle' })
const lineToolCommand = page.getByRole('option', { name: 'Line' })
const lineToolButton = page.getByRole('button', { name: 'Line' })
const arcToolCommand = page.getByRole('option', { name: 'Tangential Arc' })
const arcToolButton = page.getByRole('button', {
name: 'Tangential Arc',
exact: true,
})
const arcToolButton = page.getByRole('button', { name: 'Tangential Arc' })
// Start a sketch
await sketchButton.click()
@ -3911,7 +3862,10 @@ test.describe('Regression tests', () => {
await u.waitForAuthSkipAppStart()
// expand variables section
const variablesTabButton = page.getByTestId('variables-pane-button')
const variablesTabButton = page.getByRole('tab', {
name: 'Variables',
exact: false,
})
await variablesTabButton.click()
// can find sketch001 in the variables summary (pretty-json-container, makes sure we're not looking in the code editor)
@ -3936,7 +3890,10 @@ test.describe('Regression tests', () => {
await u.waitForAuthSkipAppStart()
const variablesTabButton = page.getByTestId('variables-pane-button')
const variablesTabButton = page.getByRole('tab', {
name: 'Variables',
exact: false,
})
await variablesTabButton.click()
// expect to see "myVar:5"
await expect(
@ -4019,19 +3976,16 @@ test.describe('Regression tests', () => {
)
})
await expect(async () => {
await page.goto('/')
await u.waitForPageLoad()
// error in guter
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 1_000,
})
await page.waitForTimeout(200)
// expect it still to be there (sometimes it just clears for a bit?)
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 1_000,
})
}).toPass({ timeout: 40_000, intervals: [1_000] })
await page.goto('/')
await u.waitForPageLoad()
// error in guter
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
await page.waitForTimeout(200)
// expect it still to be there (sometimes it just clears for a bit?)
await expect(page.locator('.cm-lint-marker-error')).toBeVisible({
timeout: 10_000,
})
// error text on hover
await page.hover('.cm-lint-marker-error')
@ -4179,15 +4133,12 @@ test.describe('Sketch tests', () => {
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await page.getByText('tangentialArcTo([24.95, -5.38], %)').click()
await expect(async () => {
await page.mouse.click(700, 200)
await page.getByText('tangentialArcTo([24.95, -5.38], %)').click()
await expect(
page.getByRole('button', { name: 'Edit Sketch' })
).toBeEnabled({ timeout: 1000 })
await page.getByRole('button', { name: 'Edit Sketch' }).click()
}).toPass({ timeout: 40_000, intervals: [1_000] })
await expect(
page.getByRole('button', { name: 'Edit Sketch' })
).toBeEnabled()
await page.getByRole('button', { name: 'Edit Sketch' }).click()
await page.waitForTimeout(600) // wait for animation
@ -4203,7 +4154,7 @@ test.describe('Sketch tests', () => {
await u.expectCmdLog('[data-message-type="execution-done"]', 10_000)
await page.waitForTimeout(100)
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await page.waitForTimeout(100)
await page.mouse.click(700, 200)
@ -4230,7 +4181,9 @@ test.describe('Sketch tests', () => {
page.getByRole('button', { name: 'Exit Sketch' })
).toBeVisible()
await expect(page.getByText('select a plane or face')).toBeVisible()
await expect(
page.getByText('click plane or face to sketch on')
).toBeVisible()
await page.keyboard.press('Escape')
await expect(
@ -4781,7 +4734,7 @@ test.describe('Sketch tests', () => {
await expect(page.locator('.cm-content')).toHaveText(code)
// Assert the tool was unequipped
await expect(
page.getByRole('button', { name: 'Line', exact: true })
page.getByRole('button', { name: 'Line' })
).not.toHaveAttribute('aria-pressed', 'true')
// exit sketch
@ -4943,7 +4896,8 @@ test.describe('Testing constraints', () => {
await page.mouse.click(834, 244)
await page.keyboard.up('Shift')
await page.getByRole('button', { name: 'Length', exact: true }).click()
await page.getByRole('button', { name: 'Constraints', exact: true }).click()
await page.getByRole('button', { name: 'length', exact: true }).click()
await page.getByText('Add constraining value').click()
await expect(page.locator('.cm-content')).toHaveText(
@ -4973,13 +4927,13 @@ const part001 = startSketchOn('XZ')
|> startProfileAt([-7.54, -26.74], %)
|> line([74.36, 130.4], %, $seg01)
|> line([78.92, -120.11], %)
|> angledLine([segAng(seg01), yo], %)
|> angledLine([segAng(seg01, %), yo], %)
|> line([41.19, 28.97 + 5], %)
const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -4997,10 +4951,12 @@ const part002 = startSketchOn('XZ')
await page.waitForTimeout(100) // this wait is needed for webkit - not sure why
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page.getByRole('button', { name: 'remove constraints' }).click()
await page
.getByRole('button', { name: 'remove constraints', exact: true })
.click()
await page.getByText('line([39.13, 68.63], %)').click()
const activeLinesContent = await page.locator('.cm-activeLine').all()
@ -5031,13 +4987,13 @@ const part001 = startSketchOn('XZ')
|> startProfileAt([-7.54, -26.74], %)
|> line([74.36, 130.4], %, $seg01)
|> line([78.92, -120.11], %)
|> angledLine([segAng(seg01), 78.33], %)
|> angledLine([segAng(seg01, %), 78.33], %)
|> line([41.19, 28.97], %)
const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5061,11 +5017,11 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift')
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page
.getByRole('button', { name: 'Perpendicular Distance' })
.getByRole('button', { name: 'perpendicular distance', exact: true })
.click()
const createNewVariableCheckbox = page.getByTestId(
@ -5102,22 +5058,22 @@ const part002 = startSketchOn('XZ')
{
testName: 'Add variable',
constraint: 'horizontal distance',
value: 'segEndX(seg01) + xDis001, 61.34',
value: 'segEndX(seg01, %) + xDis001, 61.34',
},
{
testName: 'No variable',
constraint: 'horizontal distance',
value: 'segEndX(seg01) + 88.08, 61.34',
value: 'segEndX(seg01, %) + 88.08, 61.34',
},
{
testName: 'Add variable',
constraint: 'vertical distance',
value: '154.9, segEndY(seg01) - yDis001',
value: '154.9, segEndY(seg01, %) - yDis001',
},
{
testName: 'No variable',
constraint: 'vertical distance',
value: '154.9, segEndY(seg01) - 42.32',
value: '154.9, segEndY(seg01, %) - 42.32',
},
] as const
for (const { testName, value, constraint } of cases) {
@ -5136,7 +5092,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5160,10 +5116,12 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift')
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page.getByRole('button', { name: constraint }).click()
await page
.getByRole('button', { name: constraint, exact: true })
.click()
const createNewVariableCheckbox = page.getByTestId(
'create-new-variable-checkbox'
@ -5204,25 +5162,25 @@ const part002 = startSketchOn('XZ')
{
testName: 'Add variable',
addVariable: true,
constraint: 'Absolute X',
constraint: 'ABS X',
value: 'xDis001, 61.34',
},
{
testName: 'No variable',
addVariable: false,
constraint: 'Absolute X',
constraint: 'ABS X',
value: '154.9, 61.34',
},
{
testName: 'Add variable',
addVariable: true,
constraint: 'Absolute Y',
constraint: 'ABS Y',
value: '154.9, yDis001',
},
{
testName: 'No variable',
addVariable: false,
constraint: 'Absolute Y',
constraint: 'ABS Y',
value: '154.9, 61.34',
},
] as const
@ -5242,7 +5200,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5258,7 +5216,7 @@ const part002 = startSketchOn('XZ')
u.getSegmentBodyCoords(`[data-overlay-index="${2}"]`),
])
if (constraint === 'Absolute X') {
if (constraint === 'ABS X') {
await page.mouse.click(600, 130)
} else {
await page.mouse.click(900, 250)
@ -5269,7 +5227,7 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift')
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page
@ -5312,13 +5270,13 @@ const part002 = startSketchOn('XZ')
testName: 'Add variable',
addVariable: true,
axisSelect: false,
value: 'segAng(seg01) + angle001',
value: 'segAng(seg01, %) + angle001',
},
{
testName: 'No variable',
addVariable: false,
axisSelect: false,
value: 'segAng(seg01) + 22.69',
value: 'segAng(seg01, %) + 22.69',
},
{
testName: 'Add variable, selecting axis',
@ -5349,7 +5307,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5377,10 +5335,10 @@ const part002 = startSketchOn('XZ')
await page.keyboard.up('Shift')
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page.getByTestId('dropdown-constraint-angle').click()
await page.getByTestId('angle').click()
const createNewVariableCheckbox = page.getByTestId(
'create-new-variable-checkbox'
@ -5459,7 +5417,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5478,10 +5436,10 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(line3.x, line3.y)
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page.getByTestId('dropdown-constraint-' + constraint).click()
await page.getByTestId(constraint).click()
if (!addVariable) {
await page.getByTestId('create-new-variable-checkbox').click()
@ -5535,7 +5493,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5569,7 +5527,7 @@ const part002 = startSketchOn('XZ')
await expect(activeLinesContent).toHaveLength(codeAfter.length)
const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
const constraintButton = page
.getByRole('button', {
@ -5600,19 +5558,19 @@ const part002 = startSketchOn('XZ')
test.describe('Two segment - no modal constraints', () => {
const cases = [
{
codeAfter: `|> angledLine([83, segLen(seg01)], %)`,
codeAfter: `|> angledLine([83, segLen(seg01, %)], %)`,
constraintName: 'Equal Length',
},
{
codeAfter: `|> angledLine([segAng(seg01), 78.33], %)`,
codeAfter: `|> angledLine([segAng(seg01, %), 78.33], %)`,
constraintName: 'Parallel',
},
{
codeAfter: `|> lineTo([segEndX(seg01), 61.34], %)`,
codeAfter: `|> lineTo([segEndX(seg01, %), 61.34], %)`,
constraintName: 'Vertically Align',
},
{
codeAfter: `|> lineTo([154.9, segEndY(seg01)], %)`,
codeAfter: `|> lineTo([154.9, segEndY(seg01, %)], %)`,
constraintName: 'Horizontally Align',
},
] as const
@ -5631,7 +5589,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5652,7 +5610,7 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(line3.x - 3, line3.y + 20)
await page.keyboard.up('Shift')
const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
const constraintButton = page.getByRole('button', {
name: constraintName,
@ -5708,7 +5666,7 @@ const part002 = startSketchOn('XZ')
|> startProfileAt([299.05, 231.45], %)
|> xLine(-425.34, %, $seg_what)
|> yLine(-264.06, %)
|> xLine(segLen(seg_what), %)
|> xLine(segLen(seg_what, %), %)
|> lineTo([profileStartX(%), profileStartY(%)], %)`
)
})
@ -5729,7 +5687,7 @@ const part002 = startSketchOn('XZ')
await page.mouse.click(axisClick.x, axisClick.y)
await page.keyboard.up('Shift')
const constraintMenuButton = page.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
const constraintButton = page.getByRole('button', {
name: constraintName,
@ -5788,10 +5746,10 @@ const part002 = startSketchOn('XZ')
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
await page.getByRole('button', { name: 'Horizontal', exact: true }).click()
await page.getByRole('button', { name: 'horizontal', exact: true }).click()
let activeLinesContent = await page.locator('.cm-activeLine').all()
await expect(activeLinesContent[0]).toHaveText(`|> xLine(3.13, %)`)
@ -5812,13 +5770,13 @@ const part002 = startSketchOn('XZ')
await page.waitForTimeout(300)
await page
.getByRole('button', {
name: 'Length: open menu',
name: 'Constraints',
})
.click()
// await expect(page.getByRole('button', { name: 'length', exact: true })).toBeVisible()
await page.waitForTimeout(200)
// await page.getByRole('button', { name: 'length', exact: true }).click()
await page.getByTestId('dropdown-constraint-length').click()
await page.locator('[data-testid="length"]').click()
await page.getByLabel('length Value').fill('10')
await page.getByRole('button', { name: 'Add constraining value' }).click()
@ -6876,8 +6834,8 @@ const part001 = startSketchOn('XZ')
|> startProfileAt([5, 6], %)
|> ${lineToBeDeleted}
|> line([-10, -15], %)
|> angledLine([-176, segLen(seg01)], %)
${extraLine ? 'const myVar = segLen(seg01)' : ''}`
|> angledLine([-176, segLen(seg01, %)], %)
${extraLine ? 'const myVar = segLen(seg01, part001)' : ''}`
)
},
{
@ -7036,7 +6994,7 @@ ${extraLine ? 'const myVar = segLen(seg01)' : ''}`
|> startProfileAt([5, 6], %)
|> ${lineToBeDeleted}
|> line([-10, -15], %)
|> angledLine([-176, segLen(seg01)], %)`
|> angledLine([-176, segLen(seg01, %)], %)`
)
},
{
@ -7110,8 +7068,6 @@ test.describe('Test network and connection issues', () => {
await u.waitForAuthSkipAppStart()
const networkToggle = page.getByTestId('network-toggle')
// This is how we wait until the stream is online
await expect(
page.getByRole('button', { name: 'Start Sketch' })
@ -7125,7 +7081,7 @@ test.describe('Test network and connection issues', () => {
await expect(networkPopover).not.toBeVisible()
// (First check) Expect the network to be up
await expect(networkToggle).toContainText('Connected')
await expect(page.getByText('Network Health (Connected)')).toBeVisible()
// Click the network widget
await networkWidget.click()
@ -7147,7 +7103,7 @@ test.describe('Test network and connection issues', () => {
})
// Expect the network to be down
await expect(networkToggle).toContainText('Offline')
await expect(page.getByText('Network Health (Offline)')).toBeVisible()
// Click the network widget
await networkWidget.click()
@ -7173,7 +7129,7 @@ test.describe('Test network and connection issues', () => {
).not.toBeDisabled({ timeout: 15000 })
// (Second check) expect the network to be up
await expect(networkToggle).toContainText('Connected')
await expect(page.getByText('Network Health (Connected)')).toBeVisible()
})
test('Engine disconnect & reconnect in sketch mode', async ({
@ -7185,8 +7141,6 @@ test.describe('Test network and connection issues', () => {
browserName === 'webkit',
'Skip on Safari until `window.tearDown` is working there'
)
const networkToggle = page.getByTestId('network-toggle')
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
const PUR = 400 / 37.5 //pixeltoUnitRatio
@ -7229,7 +7183,7 @@ test.describe('Test network and connection issues', () => {
|> line([${commonPoints.num1}, 0], %)`)
// Expect the network to be up
await expect(networkToggle).toContainText('Connected')
await expect(page.getByText('Network Health (Connected)')).toBeVisible()
// simulate network down
await u.emulateNetworkConditions({
@ -7241,7 +7195,7 @@ test.describe('Test network and connection issues', () => {
})
// Expect the network to be down
await expect(networkToggle).toContainText('Offline')
await expect(page.getByText('Network Health (Offline)')).toBeVisible()
// Ensure we are not in sketch mode
await expect(
@ -7266,8 +7220,7 @@ test.describe('Test network and connection issues', () => {
).not.toBeDisabled({ timeout: 15000 })
// Expect the network to be up
await expect(networkToggle).toContainText('Connected')
await expect(page.getByTestId('loading-stream')).not.toBeAttached()
await expect(page.getByText('Network Health (Connected)')).toBeVisible()
// Click off the code pane.
await page.mouse.click(100, 100)
@ -7283,7 +7236,7 @@ test.describe('Test network and connection issues', () => {
await page.waitForTimeout(150)
// Click the line tool
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page.getByRole('button', { name: 'Line' }).click()
await page.waitForTimeout(150)
@ -7293,15 +7246,15 @@ test.describe('Test network and connection issues', () => {
.toHaveText(`const sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)
|> line([-8.84, 8.75], %)`)
|> line([-9.16, 8.81], %)`)
await page.waitForTimeout(100)
await page.mouse.click(startXPx, 500 - PUR * 20)
await expect(page.locator('.cm-content'))
.toHaveText(`const sketch001 = startSketchOn('XZ')
|> startProfileAt(${commonPoints.startAt}, %)
|> line([${commonPoints.num1}, 0], %)
|> line([-8.84, 8.75], %)
|> line([-5.6, 0], %)`)
|> line([-9.16, 8.81], %)
|> line([-5.28, 0], %)`)
// Unequip line tool
await page.keyboard.press('Escape')
@ -7310,7 +7263,7 @@ test.describe('Test network and connection issues', () => {
page.getByRole('button', { name: 'Exit Sketch' })
).toBeVisible()
await expect(
page.getByRole('button', { name: 'Line', exact: true })
page.getByRole('button', { name: 'Line' })
).not.toHaveAttribute('aria-pressed', 'true')
// Exit sketch
@ -7611,19 +7564,19 @@ const part001 = startSketchOn('-XZ')
offset: -armThick,
intersectTag: seg04
}, %)
|> angledLineToY([segAng(seg04) + 180, ZERO], %)
|> angledLineToY([segAng(seg04, %) + 180, ZERO], %)
|> angledLineToY({
angle: -bottomAng,
to: -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03) + 0, %)
|> yLine(-segLen(seg01), %)
|> xLineTo(segEndX(seg03, %) + 0, %)
|> yLine(-segLen(seg01, %), %)
|> angledLineThatIntersects({
angle: HALF_TURN,
offset: -armThick,
intersectTag: seg02
}, %)
|> angledLineToY([segAng(seg02) + 180, -baseHeight], %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> close(%)
|> extrude(4, %)`
@ -7715,7 +7668,7 @@ test('Keyboard shortcuts can be viewed through the help menu', async ({
.waitFor({ state: 'visible' })
// Open the help menu
await page.getByRole('button', { name: 'Help and resources' }).click()
await page.getByRole('button', { name: 'Help', exact: false }).click()
// Open the keyboard shortcuts
await page.getByRole('button', { name: 'Keyboard Shortcuts' }).click()
@ -7739,11 +7692,8 @@ test('First escape in tool pops you out of tool, second exits sketch mode', asyn
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
const lineButton = page.getByRole('button', { name: 'Line', exact: true })
const arcButton = page.getByRole('button', {
name: 'Tangential Arc',
exact: true,
})
const lineButton = page.getByRole('button', { name: 'Line' })
const arcButton = page.getByRole('button', { name: 'Tangential Arc' })
// Test these hotkeys perform actions when
// focus is on the canvas
@ -7755,7 +7705,6 @@ test('First escape in tool pops you out of tool, second exits sketch mode', asyn
await page.mouse.move(800, 300)
await page.mouse.click(800, 300)
await page.waitForTimeout(1000)
await expect(lineButton).toBeVisible()
await expect(lineButton).toHaveAttribute('aria-pressed', 'true')
// Draw a line
@ -7825,12 +7774,9 @@ test('Basic default modeling and sketch hotkeys work', async ({ page }) => {
await u.closeDebugPanel()
const codePane = page.getByRole('textbox').locator('div')
const codePaneButton = page.getByTestId('code-pane-button')
const lineButton = page.getByRole('button', { name: 'Line', exact: true })
const arcButton = page.getByRole('button', {
name: 'Tangential Arc',
exact: true,
})
const codePaneButton = page.getByRole('tab', { name: 'KCL Code' })
const lineButton = page.getByRole('button', { name: 'Line' })
const arcButton = page.getByRole('button', { name: 'Tangential Arc' })
const extrudeButton = page.getByRole('button', { name: 'Extrude' })
// Test that the hotkeys do nothing when
@ -7851,7 +7797,7 @@ test('Basic default modeling and sketch hotkeys work', async ({ page }) => {
await page.mouse.click(600, 250)
// work-around: to stop "keyboard.press('s')" from typing in the editor even when it should be blurred
await page.getByRole('button', { name: 'Commands' }).click()
await page.getByRole('button', { name: 'Commands ⌘K' }).click()
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await page.waitForTimeout(100)
@ -8097,34 +8043,3 @@ test('Sketch on face', async ({ page }) => {
const sketch002 = extrude(${[5, 5]} + 7, sketch002)`
await expect(page.locator('.cm-content')).toHaveText(result2.regExp)
})
test('Typing KCL errors induces a badge on the error logs pane button', async ({
page,
}) => {
const u = await getUtils(page)
// Load the app with the working starter code
await page.addInitScript((code) => {
localStorage.setItem('persistCode', code)
}, bracket)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
// wait for execution done
await u.openDebugPanel()
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel()
// Ensure no badge is present
const errorLogsButton = page.getByRole('button', { name: 'KCL Code pane' })
await expect(errorLogsButton).not.toContainText('notification')
// Delete a character to break the KCL
await u.openKclCodePanel()
await page.getByText('extrude(').click()
await page.keyboard.press('Backspace')
// Ensure that a badge appears on the button
await expect(errorLogsButton).toContainText('notification')
})

View File

@ -64,27 +64,27 @@ const part001 = startSketchOn('-XZ')
|> angledLineToY({
angle: topAng,
to: totalHeightHalf,
}, %, $seg04)
|> xLineTo(totalLen, %, $seg03')
|> yLine(-armThick, %, $seg01)
}, %, 'seg04')
|> xLineTo(totalLen, %, 'seg03')
|> yLine(-armThick, %, 'seg01')
|> angledLineThatIntersects({
angle: HALF_TURN,
offset: -armThick,
intersectTag: seg04
intersectTag: 'seg04'
}, %)
|> angledLineToY([segAng(seg04, %) + 180, ZERO], %)
|> angledLineToY([segAng('seg04', %) + 180, ZERO], %)
|> angledLineToY({
angle: -bottomAng,
to: -totalHeightHalf - armThick,
}, %, $seg02)
|> xLineTo(segEndX(seg03, %) + 0, %)
|> yLine(-segLen(seg01, %), %)
}, %, 'seg02')
|> xLineTo(segEndX('seg03', %) + 0, %)
|> yLine(-segLen('seg01', %), %)
|> angledLineThatIntersects({
angle: HALF_TURN,
offset: -armThick,
intersectTag: seg02
intersectTag: 'seg02'
}, %)
|> angledLineToY([segAng(seg02, %) + 180, -baseHeight], %)
|> angledLineToY([segAng('seg02', %) + 180, -baseHeight], %)
|> xLineTo(ZERO, %)
|> close(%)
|> extrude(4, %)`
@ -431,9 +431,7 @@ test('Draft segments should look right', async ({ page, context }) => {
|> line([7.25, 0], %)`
await expect(page.locator('.cm-content')).toHaveText(code)
await page
.getByRole('button', { name: 'Tangential Arc', exact: true })
.click()
await page.getByRole('button', { name: 'Tangential Arc' }).click()
await page.mouse.move(startXPx + PUR * 30, 500 - PUR * 20, { steps: 10 })
@ -477,10 +475,8 @@ test('Draft rectangles should look right', async ({ page, context }) => {
const startXPx = 600
// Equip the rectangle tool
await page.getByRole('button', { name: 'Line', exact: true }).click()
await page
.getByRole('button', { name: 'Corner rectangle', exact: true })
.click()
await page.getByRole('button', { name: 'Line' }).click()
await page.getByRole('button', { name: 'Rectangle' }).click()
// Draw the rectangle
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 30)
@ -539,9 +535,7 @@ test.describe('Client side scene scale should match engine scale', () => {
|> line([7.25, 0], %)`
await expect(u.codeLocator).toHaveText(code)
await page
.getByRole('button', { name: 'Tangential Arc', exact: true })
.click()
await page.getByRole('button', { name: 'Tangential Arc' }).click()
await page.waitForTimeout(100)
await page.mouse.click(startXPx + PUR * 30, 500 - PUR * 20)
@ -551,9 +545,7 @@ test.describe('Client side scene scale should match engine scale', () => {
await expect(u.codeLocator).toHaveText(code)
// click tangential arc tool again to unequip it
await page
.getByRole('button', { name: 'Tangential Arc', exact: true })
.click()
await page.getByRole('button', { name: 'Tangential Arc' }).click()
await page.waitForTimeout(100)
// screen shot should show the sketch
@ -642,9 +634,7 @@ test.describe('Client side scene scale should match engine scale', () => {
|> line([184.3, 0], %)`
await expect(u.codeLocator).toHaveText(code)
await page
.getByRole('button', { name: 'Tangential Arc', exact: true })
.click()
await page.getByRole('button', { name: 'Tangential Arc' }).click()
await page.waitForTimeout(100)
await page.mouse.click(startXPx + PUR * 30, 500 - PUR * 20)
@ -653,9 +643,7 @@ test.describe('Client side scene scale should match engine scale', () => {
|> tangentialArcTo([551.2, -62.01], %)`
await expect(u.codeLocator).toHaveText(code)
await page
.getByRole('button', { name: 'Tangential Arc', exact: true })
.click()
await page.getByRole('button', { name: 'Tangential Arc' }).click()
await page.waitForTimeout(100)
// screen shot should show the sketch

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -71,7 +71,7 @@ export const TEST_CODE_GIZMO = `const part001 = startSketchOn('XZ')
|> angledLine({ angle: 3 + 0, length: 3.14 + 0 }, %)
|> lineTo([20.14 + 0, -0.14 + 0], %)
|> xLineTo(29 + 0, %)
|> yLine(-3.14 + 0, %, $a)
|> yLine(-3.14 + 0, %, 'a')
|> xLine(1.63, %)
|> angledLineOfXLength({ angle: 3 + 0, length: 3.14 }, %)
|> angledLineOfYLength({ angle: 30, length: 3 + 0 }, %)
@ -79,7 +79,7 @@ export const TEST_CODE_GIZMO = `const part001 = startSketchOn('XZ')
|> angledLineToY({ angle: 30, to: 11.14 }, %)
|> angledLineThatIntersects({
angle: 3.14,
intersectTag: a,
intersectTag: 'a',
offset: 0
}, %)
|> tangentialArcTo([13.14 + 0, 13.14], %)

View File

@ -1,5 +1,5 @@
import { expect, Page, Download } from '@playwright/test'
import { EngineCommand } from 'lang/std/artifactMap'
import { test, expect, Page, Download } from '@playwright/test'
import { EngineCommand } from '../../src/lang/std/engineConnection'
import os from 'os'
import fsp from 'fs/promises'
import pixelMatch from 'pixelmatch'
@ -16,14 +16,14 @@ export const TEST_COLORS = {
} as const
async function waitForPageLoad(page: Page) {
// wait for 'Loading stream...' spinner
await page.getByTestId('loading-stream').waitFor()
// wait for all spinners to be gone
await expect(page.getByTestId('loading')).not.toBeAttached({
timeout: 20_000,
})
await page
.getByTestId('loading')
.waitFor({ state: 'detached', timeout: 20_000 })
await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeEnabled({
timeout: 20_000,
})
await page.getByTestId('start-sketch').waitFor()
}
async function removeCurrentCode(page: Page) {
@ -58,45 +58,44 @@ async function waitForDefaultPlanesToBeVisible(page: Page) {
}
async function openKclCodePanel(page: Page) {
const paneLocator = page.getByTestId('code-pane-button')
const ariaSelected = await paneLocator?.getAttribute('aria-pressed')
const isOpen = ariaSelected === 'true'
const paneLocator = page.getByRole('tab', { name: 'KCL Code', exact: false })
const isOpen = (await paneLocator?.getAttribute('aria-selected')) === 'true'
if (!isOpen) {
await paneLocator.click()
await expect(paneLocator).toHaveAttribute('aria-pressed', 'true')
await paneLocator.and(page.locator('[aria-selected="true"]')).waitFor()
}
}
async function closeKclCodePanel(page: Page) {
const paneLocator = page.getByTestId('code-pane-button')
const ariaSelected = await paneLocator?.getAttribute('aria-pressed')
const isOpen = ariaSelected === 'true'
const paneLocator = page.getByRole('tab', { name: 'KCL Code', exact: false })
const isOpen = (await paneLocator?.getAttribute('aria-selected')) === 'true'
if (isOpen) {
await paneLocator.click()
await expect(paneLocator).not.toHaveAttribute('aria-pressed', 'true')
await paneLocator
.and(page.locator(':not([aria-selected="true"])'))
.waitFor()
}
}
async function openDebugPanel(page: Page) {
const debugLocator = page.getByTestId('debug-pane-button')
await expect(debugLocator).toBeVisible()
const isOpen = (await debugLocator?.getAttribute('aria-pressed')) === 'true'
const debugLocator = page.getByRole('tab', { name: 'Debug', exact: false })
const isOpen = (await debugLocator?.getAttribute('aria-selected')) === 'true'
if (!isOpen) {
await debugLocator.click()
await expect(debugLocator).toHaveAttribute('aria-pressed', 'true')
await debugLocator.and(page.locator('[aria-selected="true"]')).waitFor()
}
}
async function closeDebugPanel(page: Page) {
const debugLocator = page.getByTestId('debug-pane-button')
await expect(debugLocator).toBeVisible()
const isOpen = (await debugLocator?.getAttribute('aria-pressed')) === 'true'
const debugLocator = page.getByRole('tab', { name: 'Debug', exact: false })
const isOpen = (await debugLocator?.getAttribute('aria-selected')) === 'true'
if (isOpen) {
await debugLocator.click()
await expect(debugLocator).not.toHaveAttribute('aria-pressed', 'true')
await debugLocator
.and(page.locator(':not([aria-selected="true"])'))
.waitFor()
}
}
@ -123,7 +122,7 @@ export const wiggleMove = async (
const step = dist / steps
for (let i = 0, j = 0; i < dist; i += step, j += 1) {
if (locator) {
const isElVis = await page.locator(locator).isVisible()
const isElVis = await page.locator(locator).isVisible({ timeout: 100 })
if (isElVis) return
}
const [x1, y1] = [0, Math.sin((tau / steps) * j * freq) * amplitude]
@ -266,7 +265,7 @@ export async function getUtils(page: Page) {
getSegmentBodyCoords: async (locator: string, px = 30) => {
const overlay = page.locator(locator)
const bbox = await overlay
.boundingBox({ timeout: 5000 })
.boundingBox()
.then((box) => ({ ...box, x: box?.x || 0, y: box?.y || 0 }))
const angle = Number(await overlay.getAttribute('data-overlay-angle'))
const angleXOffset = Math.cos(((angle - 180) * Math.PI) / 180) * px
@ -472,11 +471,8 @@ export const doExport = async (
page: Page
): Promise<Paths> => {
await page.getByRole('button', { name: APP_NAME }).click()
const exportMenuButton = page.getByRole('button', {
name: 'Export current part',
})
await expect(exportMenuButton).toBeVisible()
await exportMenuButton.click()
await expect(page.getByRole('button', { name: 'Export Part' })).toBeVisible()
await page.getByRole('button', { name: 'Export Part' }).click()
await expect(page.getByTestId('command-bar')).toBeVisible()
// Go through export via command bar

View File

@ -77,7 +77,7 @@ describe('ZMA authorized user flows', () => {
const menuButton = await $('[data-testid="user-sidebar-toggle"]')
await click(menuButton)
const settingsButton = await $('[data-testid="user-settings"]')
const settingsButton = await $('[data-testid="settings-button"]')
await click(settingsButton)
const projectDirInput = await $('[data-testid="project-directory-input"]')

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More