yarn fmt lint tsc

This commit is contained in:
lee-at-zoo-corp
2025-04-01 17:20:35 -04:00
parent 65adfd4497
commit 00122aae5e
8 changed files with 113 additions and 55 deletions

View File

@ -78,12 +78,14 @@ sketch001 = startSketchOn(XY)
// Ensure we execute the first time. // Ensure we execute the first time.
await u.openDebugPanel() await u.openDebugPanel()
await expect.poll(() => await expect
page.locator('[data-receive-command-type="scene_clear_all"]').count() .poll(() =>
).toBe(2) page.locator('[data-receive-command-type="scene_clear_all"]').count()
await expect.poll(() => )
page.locator('[data-message-type="execution-done"]').count() .toBe(2)
).toBe(2) await expect
.poll(() => page.locator('[data-message-type="execution-done"]').count())
.toBe(2)
// Add whitespace to the end of the code. // Add whitespace to the end of the code.
await u.codeLocator.click() await u.codeLocator.click()
@ -501,7 +503,7 @@ sketch_001 = startSketchOn(XY)
await page.keyboard.press('ArrowLeft') await page.keyboard.press('ArrowLeft')
await page.keyboard.press('ArrowRight') await page.keyboard.press('ArrowRight')
await scene.waitForExecutionDone() await scene.connectionEstablished()
// error in guter // error in guter
await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible() await expect(page.locator('.cm-lint-marker-info').first()).toBeVisible()

View File

@ -90,7 +90,9 @@ test.describe('Feature Tree pane', () => {
await scene.settled(cmdBar) await scene.settled(cmdBar)
await toolbar.openFeatureTreePane() await toolbar.openFeatureTreePane()
await expect.poll(() => page.getByText('Feature tree').count()).toBeGreaterThan(1) await expect
.poll(() => page.getByText('Feature tree').count())
.toBeGreaterThan(1)
}) })
async function testViewSource({ async function testViewSource({

View File

@ -112,17 +112,17 @@ export class CmdBarFixture {
* and assumes we are past the `pickCommand` step. * and assumes we are past the `pickCommand` step.
*/ */
progressCmdBar = async (shouldFuzzProgressMethod = true) => { progressCmdBar = async (shouldFuzzProgressMethod = true) => {
await this.page.waitForTimeout(2000) await this.page.waitForTimeout(2000)
const arrowButton = this.page.getByRole('button', { const arrowButton = this.page.getByRole('button', {
name: 'arrow right Continue', name: 'arrow right Continue',
}) })
if (await arrowButton.isVisible()) { if (await arrowButton.isVisible()) {
await arrowButton.click() await arrowButton.click()
} else { } else {
await this.page await this.page
.getByRole('button', { name: 'checkmark Submit command' }) .getByRole('button', { name: 'checkmark Submit command' })
.click() .click()
} }
} }
// Added data-testid to the command bar buttons // Added data-testid to the command bar buttons

View File

@ -13,7 +13,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const newProject = const newProject =
app.applicationMenu.getMenuItemById('File.New project') app.applicationMenu.getMenuItemById('File.New project')
if (!newProject) fail() if (!newProject) fail()
@ -36,7 +38,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
if (!app || !app.applicationMenu) fail() if (!app || !app.applicationMenu) fail()
const openProject = const openProject =
app.applicationMenu.getMenuItemById('File.Open project') app.applicationMenu.getMenuItemById('File.Open project')
if (!openProject) { fail() } if (!openProject) {
fail()
}
openProject.click() openProject.click()
}) })
// Check that the command bar is opened // Check that the command bar is opened
@ -57,7 +61,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const userSettings = app.applicationMenu.getMenuItemById( const userSettings = app.applicationMenu.getMenuItemById(
'File.Preferences.User settings' 'File.Preferences.User settings'
) )
@ -77,7 +83,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
cmdBar, cmdBar,
page, page,
}) => { }) => {
if (!tronApp) { fail() } if (!tronApp) {
fail()
}
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
@ -85,7 +93,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const keybindings = app.applicationMenu.getMenuItemById( const keybindings = app.applicationMenu.getMenuItemById(
'File.Preferences.Keybindings' 'File.Preferences.Keybindings'
) )
if (!keybindings) { fail() } if (!keybindings) {
fail()
}
keybindings.click() keybindings.click()
}) })
const settings = page.getByTestId('settings-dialog-panel') const settings = page.getByTestId('settings-dialog-panel')
@ -103,7 +113,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.User default units' 'File.Preferences.User default units'
) )
@ -124,7 +136,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.Theme' 'File.Preferences.Theme'
) )
if (!menu) { fail() } if (!menu) {
fail()
}
menu.click() menu.click()
}) })
// Check that the command bar is opened // Check that the command bar is opened
@ -145,7 +159,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.Theme color' 'File.Preferences.Theme color'
) )
@ -168,7 +184,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) fail() if (!app || !app.applicationMenu) fail()
const menu = app.applicationMenu.getMenuItemById('File.Sign out') const menu = app.applicationMenu.getMenuItemById('File.Sign out')
if (!menu) { fail() } if (!menu) {
fail()
}
// FIXME: Add back when you can actually sign out // FIXME: Add back when you can actually sign out
// menu.click() // menu.click()
}) })
@ -185,7 +203,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Edit.Rename project' 'Edit.Rename project'
) )
@ -208,7 +228,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Edit.Delete project' 'Edit.Delete project'
) )
if (!menu) { fail() } if (!menu) {
fail()
}
menu.click() menu.click()
}) })
// Check the placeholder project name exists // Check the placeholder project name exists
@ -227,7 +249,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Edit.Change project directory' 'Edit.Change project directory'
) )
@ -254,7 +278,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'View.Command Palette...' 'View.Command Palette...'
) )
if (!menu) { fail() } if (!menu) {
fail()
}
menu.click() menu.click()
}) })
// Check the placeholder project name exists // Check the placeholder project name exists
@ -268,7 +294,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.Show all commands' 'Help.Show all commands'
) )
@ -288,7 +316,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.KCL code samples' 'Help.KCL code samples'
) )
if (!menu) { fail() } if (!menu) {
fail()
}
}) })
}) })
test('Home.Help.Refresh and report a bug', async ({ test('Home.Help.Refresh and report a bug', async ({
@ -300,7 +330,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu! // Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => { await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() } if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.Refresh and report a bug' 'Help.Refresh and report a bug'
) )
@ -323,7 +355,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById( const menu = app.applicationMenu.getMenuItemById(
'Help.Reset onboarding' 'Help.Reset onboarding'
) )
if (!menu) { fail() } if (!menu) {
fail()
}
menu.click() menu.click()
}) })

View File

@ -583,8 +583,6 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
scene, scene,
cmdBar, cmdBar,
}) => { }) => {
const u = await getUtils(page)
const initialCode = `closedSketch = startSketchOn(XZ) const initialCode = `closedSketch = startSketchOn(XZ)
|> circle(center = [8, 5], radius = 2) |> circle(center = [8, 5], radius = 2)
openSketch = startSketchOn(XY) openSketch = startSketchOn(XY)
@ -1031,7 +1029,9 @@ openSketch = startSketchOn(XY)
}) })
await test.step(`Go through the command bar flow`, async () => { await test.step(`Go through the command bar flow`, async () => {
await toolbar.offsetPlaneButton.click() await toolbar.offsetPlaneButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'plane', currentArgKey: 'plane',
@ -1256,7 +1256,9 @@ openSketch = startSketchOn(XY)
commandName: 'Helix', commandName: 'Helix',
}) })
await cmdBar.selectOption({ name: 'Edge' }).click() await cmdBar.selectOption({ name: 'Edge' }).click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await clickOnEdge() await clickOnEdge()
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -1540,7 +1542,9 @@ extrude001 = extrude(profile001, length = 100)
if (!shouldPreselect) { if (!shouldPreselect) {
await test.step(`Go through the command bar flow without preselected sketches`, async () => { await test.step(`Go through the command bar flow without preselected sketches`, async () => {
await toolbar.loftButton.click() await toolbar.loftButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',
@ -1719,7 +1723,9 @@ sketch002 = startSketchOn(XZ)
await test.step(`Go through the command bar flow`, async () => { await test.step(`Go through the command bar flow`, async () => {
await toolbar.sweepButton.click() await toolbar.sweepButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
commandName: 'Sweep', commandName: 'Sweep',
currentArgKey: 'target', currentArgKey: 'target',
@ -1856,7 +1862,9 @@ sketch002 = startSketchOn(XZ)
await test.step(`Go through the command bar flow and fail validation with a toast`, async () => { await test.step(`Go through the command bar flow and fail validation with a toast`, async () => {
await toolbar.sweepButton.click() await toolbar.sweepButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
commandName: 'Sweep', commandName: 'Sweep',
currentArgKey: 'target', currentArgKey: 'target',
@ -2073,7 +2081,9 @@ extrude001 = extrude(sketch001, length = -12)
await test.step(`Open fillet UI without selecting edges`, async () => { await test.step(`Open fillet UI without selecting edges`, async () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await toolbar.filletButton.click() await toolbar.filletButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',
@ -2669,7 +2679,9 @@ extrude001 = extrude(sketch001, length = -12)
await test.step(`Open chamfer UI without selecting edges`, async () => { await test.step(`Open chamfer UI without selecting edges`, async () => {
await page.waitForTimeout(100) await page.waitForTimeout(100)
await toolbar.chamferButton.click() await toolbar.chamferButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',
@ -2979,7 +2991,9 @@ extrude001 = extrude(sketch001, length = 30)
if (!shouldPreselect) { if (!shouldPreselect) {
await test.step(`Go through the command bar flow without preselected faces`, async () => { await test.step(`Go through the command bar flow without preselected faces`, async () => {
await toolbar.shellButton.click() await toolbar.shellButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',
@ -3120,7 +3134,9 @@ extrude001 = extrude(sketch001, length = 40)
await test.step(`Go through the command bar flow, selecting a wall and keeping default thickness`, async () => { await test.step(`Go through the command bar flow, selecting a wall and keeping default thickness`, async () => {
await toolbar.shellButton.click() await toolbar.shellButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',
@ -3132,7 +3148,9 @@ extrude001 = extrude(sketch001, length = 40)
highlightedHeaderArg: 'selection', highlightedHeaderArg: 'selection',
commandName: 'Shell', commandName: 'Shell',
}) })
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await clickOnCap() await clickOnCap()
await page.keyboard.down('Shift') await page.keyboard.down('Shift')
await clickOnWall() await clickOnWall()
@ -3270,7 +3288,9 @@ extrude002 = extrude(sketch002, length = 50)
highlightedHeaderArg: 'selection', highlightedHeaderArg: 'selection',
commandName: 'Shell', commandName: 'Shell',
}) })
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await clickOnCap() await clickOnCap()
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -3425,7 +3445,9 @@ sweep001 = sweep(sketch001, path = sketch002)
await test.step(`Go through the Shell flow and fail validation with a toast`, async () => { await test.step(`Go through the Shell flow and fail validation with a toast`, async () => {
await toolbar.shellButton.click() await toolbar.shellButton.click()
await expect.poll(() => page.getByText('Please select one').count()).toBe(1) await expect
.poll(() => page.getByText('Please select one').count())
.toBe(1)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'selection', currentArgKey: 'selection',

View File

@ -1554,13 +1554,10 @@ test(
path.join(dir, 'bracket', 'main.kcl') path.join(dir, 'bracket', 'main.kcl')
) )
}) })
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1200, height: 500 }) await page.setBodyDimensions({ width: 1200, height: 500 })
page.on('console', console.log) page.on('console', console.log)
const pointOnModel = { x: 630, y: 280 }
await test.step('Opening the bracket project via command palette should load the stream', async () => { await test.step('Opening the bracket project via command palette should load the stream', async () => {
await homePage.expectState({ await homePage.expectState({
projectCards: [ projectCards: [

View File

@ -867,7 +867,7 @@ test.describe('Testing settings', () => {
homePage, homePage,
tronApp, tronApp,
scene, scene,
cmdBar cmdBar,
}) => { }) => {
if (!tronApp) { if (!tronApp) {
fail() fail()

View File

@ -536,6 +536,7 @@ class EngineConnection extends EventTarget {
* did not establish. * did not establish.
*/ */
connect(args: { reconnect: boolean }): Promise<void> { connect(args: { reconnect: boolean }): Promise<void> {
// eslint-disable-next-line
const that = this const that = this
return new Promise((resolve) => { return new Promise((resolve) => {
if (this.isConnecting() || this.isReady()) { if (this.isConnecting() || this.isReady()) {