Fix native menu tests more
This commit is contained in:
@ -12,15 +12,21 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const newProject =
|
||||
app.applicationMenu.getMenuItemById('File.New project')
|
||||
if (!newProject) fail()
|
||||
if (!newProject) return false
|
||||
newProject.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
@ -34,15 +40,21 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const openProject =
|
||||
app.applicationMenu.getMenuItemById('File.Open project')
|
||||
if (!openProject) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
openProject.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
@ -60,17 +72,23 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
console.log(app)
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const userSettings = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.User settings'
|
||||
)
|
||||
if (!userSettings) fail()
|
||||
if (!userSettings) return false
|
||||
userSettings.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
// You are viewing the user tab
|
||||
@ -89,16 +107,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
}
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const keybindings = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Keybindings'
|
||||
)
|
||||
if (!keybindings) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
keybindings.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
// You are viewing the keybindings tab
|
||||
@ -113,16 +137,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.User default units'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const defaultUnit = settings.locator('#defaultUnit')
|
||||
@ -132,16 +162,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Theme'
|
||||
)
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
@ -159,16 +195,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Theme color'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const defaultUnit = settings.locator('#themeColor')
|
||||
@ -182,15 +224,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById('File.Sign out')
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu =
|
||||
app.applicationMenu.getMenuItemById('File.Sign out')
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
// FIXME: Add back when you can actually sign out
|
||||
// menu.click()
|
||||
// return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// FIXME: When signing out during E2E the page is not bound correctly.
|
||||
// It cannot find the button
|
||||
// const signIn = page.getByTestId('sign-in-button')
|
||||
@ -203,16 +252,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Rename project'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check the placeholder project name exists
|
||||
const actual = await cmdBar.cmdBarElement
|
||||
.getByTestId('command-name')
|
||||
@ -224,16 +279,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Delete project'
|
||||
)
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check the placeholder project name exists
|
||||
const actual = async () =>
|
||||
cmdBar.cmdBarElement.getByTestId('command-name').textContent()
|
||||
@ -248,16 +309,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Change project directory'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const projectDirectory = settings.locator('#projectDirectory')
|
||||
@ -273,16 +340,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'View.Command Palette...'
|
||||
)
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check the placeholder project name exists
|
||||
const actual = cmdBar.cmdBarElement.getByTestId('cmd-bar-search')
|
||||
await expect(actual).toBeVisible()
|
||||
@ -293,16 +366,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Show all commands'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Check the placeholder project name exists
|
||||
const actual = cmdBar.cmdBarElement.getByTestId('cmd-bar-search')
|
||||
await expect(actual).toBeVisible()
|
||||
@ -311,15 +390,21 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.KCL code samples'
|
||||
)
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
})
|
||||
test('Home.Help.Refresh and report a bug', async ({
|
||||
tronApp,
|
||||
@ -329,16 +414,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Refresh and report a bug'
|
||||
)
|
||||
if (!menu) fail()
|
||||
if (!menu) return false
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
// Core dump and refresh magic number timeout
|
||||
await page.waitForTimeout(7000)
|
||||
const actual = page.getByText(
|
||||
@ -350,16 +441,22 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
if (!app || !app.applicationMenu) return false
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Reset onboarding'
|
||||
)
|
||||
if (!menu) {
|
||||
fail()
|
||||
return false
|
||||
}
|
||||
menu.click()
|
||||
return true
|
||||
})
|
||||
)
|
||||
.toBe(true)
|
||||
|
||||
const actual = page.getByText(
|
||||
`This is a hardware design tool that lets you edit visually, with code, or both. It's powered by the KittyCAD Design API, the first API created for anyone to build hardware design tools.`
|
||||
|
||||
@ -419,7 +419,6 @@ test(
|
||||
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
|
||||
const startXPx = 600
|
||||
const [endOfTangentClk, endOfTangentMv] = scene.makeMouseHelpers(
|
||||
startXPx + PUR * 30,
|
||||
@ -548,7 +547,6 @@ test(
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
|
||||
// click on "Start Sketch" button
|
||||
await u.doAndWaitForImageDiff(
|
||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||
@ -594,7 +592,6 @@ test(
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
|
||||
await u.doAndWaitForImageDiff(
|
||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||
200
|
||||
@ -645,7 +642,6 @@ test.describe(
|
||||
|
||||
await u.waitForAuthSkipAppStart()
|
||||
|
||||
|
||||
await u.doAndWaitForImageDiff(
|
||||
() => page.getByRole('button', { name: 'Start Sketch' }).click(),
|
||||
200
|
||||
|
||||
Reference in New Issue
Block a user