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.
await u.openDebugPanel()
await expect.poll(() =>
page.locator('[data-receive-command-type="scene_clear_all"]').count()
).toBe(2)
await expect.poll(() =>
page.locator('[data-message-type="execution-done"]').count()
).toBe(2)
await expect
.poll(() =>
page.locator('[data-receive-command-type="scene_clear_all"]').count()
)
.toBe(2)
await expect
.poll(() => page.locator('[data-message-type="execution-done"]').count())
.toBe(2)
// Add whitespace to the end of the code.
await u.codeLocator.click()
@ -501,7 +503,7 @@ sketch_001 = startSketchOn(XY)
await page.keyboard.press('ArrowLeft')
await page.keyboard.press('ArrowRight')
await scene.waitForExecutionDone()
await scene.connectionEstablished()
// error in guter
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 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({

View File

@ -112,17 +112,17 @@ export class CmdBarFixture {
* and assumes we are past the `pickCommand` step.
*/
progressCmdBar = async (shouldFuzzProgressMethod = true) => {
await this.page.waitForTimeout(2000)
const arrowButton = this.page.getByRole('button', {
name: 'arrow right Continue',
})
if (await arrowButton.isVisible()) {
await arrowButton.click()
} else {
await this.page
.getByRole('button', { name: 'checkmark Submit command' })
.click()
}
await this.page.waitForTimeout(2000)
const arrowButton = this.page.getByRole('button', {
name: 'arrow right Continue',
})
if (await arrowButton.isVisible()) {
await arrowButton.click()
} else {
await this.page
.getByRole('button', { name: 'checkmark Submit command' })
.click()
}
}
// 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!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const newProject =
app.applicationMenu.getMenuItemById('File.New project')
if (!newProject) fail()
@ -36,7 +38,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
if (!app || !app.applicationMenu) fail()
const openProject =
app.applicationMenu.getMenuItemById('File.Open project')
if (!openProject) { fail() }
if (!openProject) {
fail()
}
openProject.click()
})
// 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!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const userSettings = app.applicationMenu.getMenuItemById(
'File.Preferences.User settings'
)
@ -77,7 +83,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
cmdBar,
page,
}) => {
if (!tronApp) { fail() }
if (!tronApp) {
fail()
}
// Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
@ -85,7 +93,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const keybindings = app.applicationMenu.getMenuItemById(
'File.Preferences.Keybindings'
)
if (!keybindings) { fail() }
if (!keybindings) {
fail()
}
keybindings.click()
})
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!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.User default units'
)
@ -124,7 +136,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.Theme'
)
if (!menu) { fail() }
if (!menu) {
fail()
}
menu.click()
})
// 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!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'File.Preferences.Theme color'
)
@ -168,7 +184,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) fail()
const menu = app.applicationMenu.getMenuItemById('File.Sign out')
if (!menu) { fail() }
if (!menu) {
fail()
}
// FIXME: Add back when you can actually sign out
// menu.click()
})
@ -185,7 +203,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'Edit.Rename project'
)
@ -208,7 +228,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById(
'Edit.Delete project'
)
if (!menu) { fail() }
if (!menu) {
fail()
}
menu.click()
})
// Check the placeholder project name exists
@ -227,7 +249,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'Edit.Change project directory'
)
@ -254,7 +278,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById(
'View.Command Palette...'
)
if (!menu) { fail() }
if (!menu) {
fail()
}
menu.click()
})
// Check the placeholder project name exists
@ -268,7 +294,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
// Run electron snippet to find the Menu!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'Help.Show all commands'
)
@ -288,7 +316,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById(
'Help.KCL code samples'
)
if (!menu) { fail() }
if (!menu) {
fail()
}
})
})
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!
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) { fail() }
if (!app || !app.applicationMenu) {
fail()
}
const menu = app.applicationMenu.getMenuItemById(
'Help.Refresh and report a bug'
)
@ -323,7 +355,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const menu = app.applicationMenu.getMenuItemById(
'Help.Reset onboarding'
)
if (!menu) { fail() }
if (!menu) {
fail()
}
menu.click()
})

View File

@ -583,8 +583,6 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
scene,
cmdBar,
}) => {
const u = await getUtils(page)
const initialCode = `closedSketch = startSketchOn(XZ)
|> circle(center = [8, 5], radius = 2)
openSketch = startSketchOn(XY)
@ -1031,7 +1029,9 @@ openSketch = startSketchOn(XY)
})
await test.step(`Go through the command bar flow`, async () => {
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({
stage: 'arguments',
currentArgKey: 'plane',
@ -1256,7 +1256,9 @@ openSketch = startSketchOn(XY)
commandName: 'Helix',
})
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 page.waitForTimeout(1000)
await cmdBar.progressCmdBar()
@ -1540,7 +1542,9 @@ extrude001 = extrude(profile001, length = 100)
if (!shouldPreselect) {
await test.step(`Go through the command bar flow without preselected sketches`, async () => {
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({
stage: 'arguments',
currentArgKey: 'selection',
@ -1719,7 +1723,9 @@ sketch002 = startSketchOn(XZ)
await test.step(`Go through the command bar flow`, async () => {
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({
commandName: 'Sweep',
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 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({
commandName: 'Sweep',
currentArgKey: 'target',
@ -2073,7 +2081,9 @@ extrude001 = extrude(sketch001, length = -12)
await test.step(`Open fillet UI without selecting edges`, async () => {
await page.waitForTimeout(100)
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({
stage: 'arguments',
currentArgKey: 'selection',
@ -2669,7 +2679,9 @@ extrude001 = extrude(sketch001, length = -12)
await test.step(`Open chamfer UI without selecting edges`, async () => {
await page.waitForTimeout(100)
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({
stage: 'arguments',
currentArgKey: 'selection',
@ -2979,7 +2991,9 @@ extrude001 = extrude(sketch001, length = 30)
if (!shouldPreselect) {
await test.step(`Go through the command bar flow without preselected faces`, async () => {
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({
stage: 'arguments',
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 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({
stage: 'arguments',
currentArgKey: 'selection',
@ -3132,7 +3148,9 @@ extrude001 = extrude(sketch001, length = 40)
highlightedHeaderArg: 'selection',
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 page.keyboard.down('Shift')
await clickOnWall()
@ -3270,7 +3288,9 @@ extrude002 = extrude(sketch002, length = 50)
highlightedHeaderArg: 'selection',
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 page.waitForTimeout(1000)
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 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({
stage: 'arguments',
currentArgKey: 'selection',

View File

@ -1554,13 +1554,10 @@ test(
path.join(dir, 'bracket', 'main.kcl')
)
})
const u = await getUtils(page)
await page.setBodyDimensions({ width: 1200, height: 500 })
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 homePage.expectState({
projectCards: [

View File

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

View File

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