This commit is contained in:
lee-at-zoo-corp
2025-03-27 13:52:57 -04:00
parent 635314bb8d
commit 2c673fba82
2 changed files with 32 additions and 24 deletions

View File

@ -13,7 +13,7 @@ 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 +36,7 @@ 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 +57,7 @@ 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 +77,7 @@ 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 +85,7 @@ 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 +103,7 @@ 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 +124,7 @@ 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 +145,7 @@ 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 +168,7 @@ 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 +185,7 @@ 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 +208,7 @@ 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 +227,7 @@ 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 +254,7 @@ 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 +268,7 @@ 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 +288,7 @@ 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 +300,7 @@ 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 +323,7 @@ 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

@ -74,7 +74,7 @@ test.describe('Point-and-click tests', () => {
await test.step('do extrude flow and check extrude code is added to editor', async () => { await test.step('do extrude flow and check extrude code is added to editor', async () => {
await toolbar.extrudeButton.click() await toolbar.extrudeButton.click()
await expect(page.getByText('Please select one')).toBeVisible() await expect(page.getByText('Please select one or more face')).toBeVisible()
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
@ -1093,7 +1093,7 @@ 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.helixButton.click() await toolbar.helixButton.click()
await expect(page.getByText('AxisOrEdge')).toBeVisible() await expect.poll(() => page.getByText('AxisOrEdge').count()).toBe(2)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'mode', currentArgKey: 'mode',
@ -1242,36 +1242,44 @@ 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.closePane('code') await toolbar.closePane('code')
await toolbar.helixButton.click() await toolbar.helixButton.click()
await expect(page.getByText('AxisOrEdge')).toBeVisible() await expect.poll(() => page.getByText('AxisOrEdge').count()).toBe(2)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'mode', currentArgKey: 'axisOrEdge',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
AngleStart: '', AngleStart: '',
Mode: '', AxisOrEdge: '',
CounterClockWise: '', CounterClockWise: '',
Radius: '', Radius: '',
Revolutions: '', Revolutions: '',
}, },
highlightedHeaderArg: 'mode', highlightedHeaderArg: 'axisOrEdge',
commandName: 'Helix', commandName: 'Helix',
}) })
await cmdBar.selectOption({ name: 'Edge' }).click() await cmdBar.selectOption({ name: 'Edge' }).click()
await expect(page.getByText('Please select one')).toBeVisible() await expect(page.getByText('Please select one')).toBeVisible()
await clickOnEdge() await clickOnEdge()
await page.waitForTimeout(1000)
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await page.waitForTimeout(1000)
await cmdBar.argumentInput.focus() await cmdBar.argumentInput.focus()
await page.waitForTimeout(1000)
await page.keyboard.insertText('20') await page.keyboard.insertText('20')
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await page.keyboard.insertText('0') await page.keyboard.insertText('0')
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
// Skip over clockwise
await cmdBar.progressCmdBar()
await page.keyboard.insertText('1') await page.keyboard.insertText('1')
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await page.keyboard.insertText('100')
await cmdBar.progressCmdBar()
await page.waitForTimeout(1000)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
Mode: 'Edge', AxisOrEdge: 'Edge',
Edge: `1 ${selectionType}`, Edge: `1 ${selectionType}`,
AngleStart: '0', AngleStart: '0',
Revolutions: '20', Revolutions: '20',