Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/playwright/command-bar-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ theta = 45deg
await homePage.textToCadBtn.click()
await cmdBar.expectState({
stage: 'arguments',
commandName: 'Text-to-CAD Create',
commandName: 'Create Project using Text-to-CAD',
currentArgKey: 'prompt',
currentArgValue: '',
headerArguments: {
Expand Down
17 changes: 7 additions & 10 deletions e2e/playwright/fixtures/cmdBarFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,9 @@ export class CmdBarFixture {
await submitButton.click()
}

openCmdBar = async (selectCmd?: 'promptToEdit') => {
openCmdBar = async () => {
await this.cmdBarOpenBtn.click()
await expect(this.page.getByPlaceholder('Search commands')).toBeVisible()
if (selectCmd === 'promptToEdit') {
const promptEditCommand = this.selectOption({ name: 'Text-to-CAD Edit' })
await expect(promptEditCommand.first()).toBeVisible()
await promptEditCommand.first().scrollIntoViewIfNeeded()
await promptEditCommand.first().click()
}
}

closeCmdBar = async () => {
Expand Down Expand Up @@ -267,15 +261,18 @@ export class CmdBarFixture {
if (part.startsWith('--')) continue

const nameMatch = part.match(/name="([^"]+)"/)
if (!nameMatch) continue
if (!nameMatch) {
console.log('No name match found in part:', part.substring(0, 100))
continue
}

const name = nameMatch[1]
const content = part.split(/\r?\n\r?\n/)[1]?.trim()
if (!content) continue

if (name === 'event') {
if (name === 'body') {
eventData = JSON.parse(content)
} else {
} else if (name === 'files') {
files[name] = content
}
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright/fixtures/editorFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class EditorFixture {
await this.scrollToBottom()
if (!shouldNormalise) {
const result = not
? await expect(this.codeContent).not.toContainText(code)
: await expect(this.codeContent).toContainText(code)
? await expect(this.codeContent).not.toContainText(code, { timeout })
: await expect(this.codeContent).toContainText(code, { timeout })

await resetPane()
return result
Expand Down
9 changes: 9 additions & 0 deletions e2e/playwright/fixtures/toolbarFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,13 @@ export class ToolbarFixture {
await expect(goToDefinitionMenuButton).toBeVisible()
await goToDefinitionMenuButton.click()
}

async fireTtcPrompt(prompt: string) {
await this.openPane('text-to-cad')
await expect(
this.page.getByTestId('ml-ephant-conversation-input')
).toBeVisible()
await this.page.getByTestId('ml-ephant-conversation-input').fill(prompt)
await this.page.getByTestId('ml-ephant-conversation-input-button').click()
}
}
20 changes: 1 addition & 19 deletions e2e/playwright/native-file-menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,6 @@ test.describe(
)
await openSettingsExpectLocator(page, '#themeColor')
})
await test.step('Modeling.Edit.Modify with Zoo Text-To-CAD', async () => {
await page.waitForTimeout(250)
await clickElectronNativeMenuById(
tronApp,
'Edit.Modify with Zoo Text-To-CAD'
)
await cmdBar.expectCommandName('Text-to-CAD Edit')
})
await test.step('Modeling.Edit.Edit parameter', async () => {
await page.waitForTimeout(250)
await clickElectronNativeMenuById(tronApp, 'Edit.Edit parameter')
Expand Down Expand Up @@ -518,17 +510,7 @@ test.describe(
'Design.Create with Zoo Text-To-CAD'
)
await cmdBar.toBeOpened()
await cmdBar.expectCommandName('Text-to-CAD Create')
})

await test.step('Modeling.Design.Modify with Zoo Text-To-CAD', async () => {
await page.waitForTimeout(250)
await clickElectronNativeMenuById(
tronApp,
'Design.Modify with Zoo Text-To-CAD'
)
await cmdBar.toBeOpened()
await cmdBar.expectCommandName('Text-to-CAD Edit')
await cmdBar.expectCommandName('Create Project using Text-to-CAD')
})

await test.step('Modeling.Help.KCL code samples', async () => {
Expand Down
14 changes: 3 additions & 11 deletions e2e/playwright/prompt-to-edit-snapshot-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@e2e/playwright/zoo-test'
import { test } from '@e2e/playwright/zoo-test'
import path from 'path'
import fsp from 'fs/promises'

Expand Down Expand Up @@ -64,7 +64,7 @@ test.describe('edit with AI example snapshots', () => {
`change colour`,
// TODO this is more of a snapshot, but atm it needs to be manually run locally to update the files
{ tag: ['@desktop'] },
async ({ context, homePage, cmdBar, editor, page, scene }) => {
async ({ context, homePage, cmdBar, editor, page, scene, toolbar }) => {
const project = 'test-dir'
await context.folderSetupFn(async (dir) => {
const projectDir = path.join(dir, project)
Expand All @@ -85,7 +85,6 @@ test.describe('edit with AI example snapshots', () => {
body1CapCoords.x,
body1CapCoords.y
)
const submittingToast = page.getByText('Submitting to Text-to-CAD API...')

await test.step('wait for scene to load select body and check selection came through', async () => {
await clickBody1Cap()
Expand All @@ -98,16 +97,9 @@ test.describe('edit with AI example snapshots', () => {

await test.step('fire off edit prompt', async () => {
await cmdBar.captureTextToCadRequestSnapshot(test.info())
await cmdBar.openCmdBar('promptToEdit')
await toolbar.fireTtcPrompt('make this neon green please, use #39FF14')
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
// being specific about the color with a hex means asserting pixel color is more stable
await page
.getByTestId('cmd-bar-arg-value')
.fill('make this neon green please, use #39FF14')
await page.waitForTimeout(100)
await cmdBar.progressCmdBar()
await expect(submittingToast).toBeVisible()
})
}
)
Expand Down
Loading
Loading