diff --git a/e2e/playwright/desktop-export.spec.ts b/e2e/playwright/desktop-export.spec.ts index 7755a1ad9..cdd062566 100644 --- a/e2e/playwright/desktop-export.spec.ts +++ b/e2e/playwright/desktop-export.spec.ts @@ -11,7 +11,7 @@ import { expect, test } from '@e2e/playwright/zoo-test' test( 'export works on the first try', { tag: ['@desktop', '@macos', '@windows', '@skipLocalEngine'] }, - async ({ page, context, scene, tronApp, cmdBar }, testInfo) => { + async ({ page, context, scene, tronApp, cmdBar, toolbar}, testInfo) => { if (!tronApp) { fail() } @@ -95,8 +95,7 @@ test( await u.openFilePanel() // Click on the other file - const otherKclButton = scene.getFileRowFromExplorer('other.kcl') - await otherKclButton.click() + await toolbar.openFile('other.kcl') // Close the file pane await u.closeFilePanel() diff --git a/e2e/playwright/fixtures/sceneFixture.ts b/e2e/playwright/fixtures/sceneFixture.ts index 4f1a14e05..9955403cf 100644 --- a/e2e/playwright/fixtures/sceneFixture.ts +++ b/e2e/playwright/fixtures/sceneFixture.ts @@ -289,13 +289,6 @@ 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 b4f58d7ff..637a22897 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, scene }, testInfo) => { + async ({ context, page, scene, toolbar }, testInfo) => { await context.folderSetupFn(async (dir) => { const bracketDir = path.join(dir, 'bracket') await fsp.mkdir(bracketDir, { recursive: true }) @@ -290,10 +290,7 @@ test( await page.getByTestId('files-pane-button').click() // Open the other file. - const file = scene.getFileRowFromExplorer('empty.kcl') - await expect(file).toBeVisible() - - await file.click() + await toolbar.openFile('empty.kcl') // planes colors means the scene has been cleared. await expect @@ -312,7 +309,7 @@ test( test( 'open a file in a project works and renders, open another file in the same project with errors, it should clear the scene', { tag: '@desktop' }, - async ({ scene, cmdBar, context, page }, testInfo) => { + async ({ scene, cmdBar, context, page, toolbar }, testInfo) => { await context.folderSetupFn(async (dir) => { const bracketDir = path.join(dir, 'bracket') await fsp.mkdir(bracketDir, { recursive: true }) @@ -358,10 +355,7 @@ test( await page.getByTestId('files-pane-button').click() // Open the other file. - const file = scene.getFileRowFromExplorer('broken-code-test.kcl') - await expect(file).toBeVisible() - - await file.click() + await toolbar.openFile('broken-code-test.kcl') // error in guter await expect(page.locator('.cm-lint-marker-error')).toBeVisible() @@ -1092,7 +1086,7 @@ test(`Create a few projects using the default project name`, async ({ test( 'File in the file pane should open with a single click', { tag: '@desktop' }, - async ({ context, homePage, page, scene }, testInfo) => { + async ({ context, homePage, page, scene, toolbar }, testInfo) => { const projectName = 'router-template-slate' await context.folderSetupFn(async (dir) => { await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) @@ -1119,11 +1113,7 @@ test( await expect(u.codeLocator).toContainText('minClampingDistance') await page.getByRole('button', { name: 'Project Files' }).click() - - const file = scene.getFileRowFromExplorer('otherThingToClickOn.kcl') - await expect(file).toBeVisible() - - await file.click() + await toolbar.openFile('otherThingToClickOn.kcl') await expect(u.codeLocator).toContainText( 'A mounting bracket for the Focusrite Scarlett Solo audio interface'