diff --git a/e2e/playwright/fixtures/sceneFixture.ts b/e2e/playwright/fixtures/sceneFixture.ts index 9955403cf..4f1a14e05 100644 --- a/e2e/playwright/fixtures/sceneFixture.ts +++ b/e2e/playwright/fixtures/sceneFixture.ts @@ -289,6 +289,13 @@ export class SceneFixture { 'true' ) } + + /** + * Returns the row within the explorer that is clickable + */ + getFileRowFromExplorer(name: string) { + return this.page.getByRole('treeitem', { name }) + } } function isColourArray( diff --git a/e2e/playwright/projects.spec.ts b/e2e/playwright/projects.spec.ts index 09ede1ee8..116af3a40 100644 --- a/e2e/playwright/projects.spec.ts +++ b/e2e/playwright/projects.spec.ts @@ -246,7 +246,7 @@ test( test( 'open a file in a project works and renders, open empty file, it should clear the scene', { tag: '@desktop' }, - async ({ context, page }, testInfo) => { + async ({ context, page, scene }, testInfo) => { await context.folderSetupFn(async (dir) => { const bracketDir = path.join(dir, 'bracket') await fsp.mkdir(bracketDir, { recursive: true }) @@ -289,8 +289,8 @@ test( // open the file pane. await page.getByTestId('files-pane-button').click() - // OPen the other file. - const file = page.getByRole('button', { name: 'empty.kcl' }) + // Open the other file. + const file = scene.getFileRowFromExplorer('empty.kcl') await expect(file).toBeVisible() await file.click() @@ -358,7 +358,7 @@ test( await page.getByTestId('files-pane-button').click() // 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 file.click()