Compare commits

...

10 Commits

Author SHA1 Message Date
ab5b83bbce Increase test timeout 2024-08-28 12:52:53 +10:00
max
ed339a6b9a Bug: Fillet Button - selecting edge without tag caused an Error rev2 (#3690)
* typos

* typos2

* trigger ci
2024-08-28 01:53:33 +02:00
1d19fc6b7e Fix platform detection in Vite (#3689) 2024-08-27 19:02:49 -04:00
max
5b5355376f Revert "Bug: Fillet Button - selecting edge without tag caused an Error" (#3687)
Revert "Bug: Fillet Button - selecting edge without tag caused an Error (#3685)"

This reverts commit 5c90f72c91.
2024-08-28 00:20:50 +02:00
max
5c90f72c91 Bug: Fillet Button - selecting edge without tag caused an Error (#3685)
fixed
2024-08-27 21:49:46 +00:00
026a8d19cb Remove unintentional changelog in readme (#3678) 2024-08-27 17:27:41 +00:00
6dd0981709 make wasm-build windows safe (#3676)
make wasm-prep windows safe
2024-08-27 11:26:52 +00:00
b231a26115 more conclusive text to cad playwright tests (#3672) 2024-08-27 06:36:05 +00:00
3f47486fb5 fix electron playwright reports/traces (#3670)
add matricx to playwright reports
2024-08-27 02:04:34 +00:00
57e97d16d0 integrate wasm-prep (#3671)
* integrate wasm-prep

* update readme
2024-08-27 01:35:11 +00:00
7 changed files with 23 additions and 16 deletions

View File

@ -423,14 +423,14 @@ jobs:
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
with:
name: test-results-electron-${{ github.sha }}
name: test-results-electron-${{ matrix.os }}-${{ github.sha }}
path: test-results/
retention-days: 30
overwrite: true
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }}
with:
name: playwright-report-electron-${{ github.sha }}
name: playwright-report-electron-${{ matrix.os }}-${{ github.sha }}
path: playwright-report/
retention-days: 30
overwrite: true

View File

@ -110,7 +110,6 @@ Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash
yarn install
yarn wasm-prep
yarn build:wasm-dev # or yarn build:wasm for slower but more production-like build
yarn start # or yarn build:local && yarn serve for slower but more production-like build
```

View File

@ -6,6 +6,8 @@ import {
setupElectron,
createProjectAndRenameIt,
} from './test-utils'
import { join } from 'path'
import fs from 'fs'
test.beforeEach(async ({ context, page }) => {
await setup(context, page)
@ -694,10 +696,9 @@ test(
'Text-to-CAD functionality',
{ tag: '@electron' },
async ({ browserName }, testInfo) => {
const { electronApp, page } = await setupElectron({
testInfo,
folderSetupFn: async () => {},
})
const { electronApp, page, dir } = await setupElectron({ testInfo })
const fileExists = () =>
fs.existsSync(join(dir, 'test-000', 'lego-2x4.kcl'))
await page.setViewportSize({ width: 1200, height: 500 })
@ -721,6 +722,7 @@ test(
// File is considered created if it shows up in the Project Files pane
const file = page.getByRole('button', { name: 'lego-2x4.kcl' })
await expect(file).toBeVisible({ timeout: 20_000 })
expect(fileExists()).toBeTruthy()
})
await test.step(`Test file navigation`, async () => {
@ -741,6 +743,7 @@ test(
`Successfully deleted file "lego-2x4.kcl"`
)
await expect(submittingToastMessage).toBeVisible()
expect(fileExists()).toBeFalsy()
})
await electronApp.close()

View File

@ -83,11 +83,10 @@
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
"fetch:wasm": "./get-latest-wasm-bundle.sh",
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
"build:wasm-dev": "(cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm": "cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm-clean": "yarn wasm-prep && yarn build:wasm",
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\" || echo \"sed for both mac and linux\"",
"wasm-prep": "rm -rf src/wasm-lib/pkg && mkdir src/wasm-lib/pkg && rm -rf src/wasm-lib/kcl/bindings",
"wasm-prep": "rimraf src/wasm-lib/pkg && mkdirp src/wasm-lib/pkg && rimraf src/wasm-lib/kcl/bindings",
"lint": "eslint --fix src e2e",
"bump-jsons": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
"postinstall": "yarn xstate:typegen && ./node_modules/.bin/electron-rebuild",

View File

@ -152,7 +152,7 @@ const extrude001 = extrude(-15, sketch001)`
selectedSegmentSnippet,
expectedExtrudeSnippet
)
})
}, 5_000)
it('should return the correct paths for a valid selection and extrusion in case of several extrusions and sketches', async () => {
const code = `const sketch001 = startSketchOn('XY')
|> startProfileAt([-30, 30], %)

View File

@ -469,6 +469,9 @@ export const hasValidFilletSelection = ({
if (segmentNode.node.type === 'CallExpression') {
const segmentName = segmentNode.node.callee.name
if (segmentName in sketchLineHelperMap) {
// Add check whether the tag exists at all:
if (!(segmentNode.node.arguments.length === 3)) return true
// If the tag exists, check if it is already filleted
const edges = isTagUsedInFillet({
ast,
callExp: segmentNode.node,

View File

@ -147,7 +147,7 @@ export function platform(): Platform {
case 'sunos':
return 'linux'
default:
console.error('Unknown platform:', platform)
console.error('Unknown desktop platform:', platform)
return ''
}
}
@ -156,11 +156,14 @@ export function platform(): Platform {
// it's more accurate than userAgent and userAgentData in Playwright.
if (
navigator.platform?.indexOf('Mac') === 0 ||
navigator.platform === 'iPhone'
navigator.platform?.indexOf('iPhone') === 0 ||
navigator.platform?.indexOf('iPad') === 0 ||
// Vite tests running in HappyDOM.
navigator.platform?.indexOf('Darwin') >= 0
) {
return 'macos'
}
if (navigator.platform === 'Win32') {
if (navigator.platform === 'Windows' || navigator.platform === 'Win32') {
return 'windows'
}
@ -185,7 +188,7 @@ export function platform(): Platform {
return 'linux'
}
console.error(
'Unknown platform userAgent:',
'Unknown web platform:',
navigator.platform,
userAgentDataPlatform,
navigator.userAgent