fix: 2 e2e tests, made a new helper function for the future

This commit is contained in:
Kevin
2025-06-25 12:26:26 -05:00
parent bb4ef3f0a2
commit 5330492749
2 changed files with 11 additions and 4 deletions

View File

@ -289,6 +289,13 @@ export class SceneFixture {
'true' 'true'
) )
} }
/**
* Returns the row within the explorer that is clickable
*/
getFileRowFromExplorer(name: string) {
return this.page.getByRole('treeitem', { name })
}
} }
function isColourArray( function isColourArray(

View File

@ -246,7 +246,7 @@ test(
test( test(
'open a file in a project works and renders, open empty file, it should clear the scene', 'open a file in a project works and renders, open empty file, it should clear the scene',
{ tag: '@desktop' }, { tag: '@desktop' },
async ({ context, page }, testInfo) => { async ({ context, page, scene }, testInfo) => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
const bracketDir = path.join(dir, 'bracket') const bracketDir = path.join(dir, 'bracket')
await fsp.mkdir(bracketDir, { recursive: true }) await fsp.mkdir(bracketDir, { recursive: true })
@ -289,8 +289,8 @@ test(
// open the file pane. // open the file pane.
await page.getByTestId('files-pane-button').click() await page.getByTestId('files-pane-button').click()
// OPen the other file. // Open the other file.
const file = page.getByRole('button', { name: 'empty.kcl' }) const file = scene.getFileRowFromExplorer('empty.kcl')
await expect(file).toBeVisible() await expect(file).toBeVisible()
await file.click() await file.click()
@ -358,7 +358,7 @@ test(
await page.getByTestId('files-pane-button').click() await page.getByTestId('files-pane-button').click()
// Open the other file. // Open the other file.
const file = page.getByRole('button', { name: 'broken-code-test.kcl' }) const file = scene.getFileRowFromExplorer('broken-code-test.kcl')
await expect(file).toBeVisible() await expect(file).toBeVisible()
await file.click() await file.click()