diff --git a/test/e2e/infra/workbench.ts b/test/e2e/infra/workbench.ts index 8f81556428f..153d2c1098e 100644 --- a/test/e2e/infra/workbench.ts +++ b/test/e2e/infra/workbench.ts @@ -110,7 +110,7 @@ export class Workbench { this.editorActionBar = new EditorActionBar(code.driver.page, this.viewer, this.quickaccess); this.problems = new Problems(code, this.quickaccess); this.references = new References(code); - this.scm = new SCM(code); + this.scm = new SCM(code, this.layouts); } } diff --git a/test/e2e/pages/scm.ts b/test/e2e/pages/scm.ts index d2180bbdd76..65cb1be9f25 100644 --- a/test/e2e/pages/scm.ts +++ b/test/e2e/pages/scm.ts @@ -5,6 +5,7 @@ import { expect } from '@playwright/test'; import { Code } from '../infra/code'; +import { Layouts } from './layouts'; /* * Reuseable Positron SCM functionality for tests to leverage. @@ -20,7 +21,7 @@ const HISTORY_ITEM_CURRENT = '.scm-history-view .history-item-current .label-nam export class SCM { - constructor(private code: Code) { } + constructor(private code: Code, private layout: Layouts) { } async openSCMViewlet(): Promise { await this.code.driver.page.keyboard.press('Control+Shift+G'); @@ -29,6 +30,9 @@ export class SCM { async waitForChange(name: string, type: string): Promise { await expect(async () => { + + await this.layout.enterLayout('fullSizedSidebar'); + const scmResources = await this.code.driver.page.locator(SCM_RESOURCE).all(); const resources: { name: string; type: string }[] = []; @@ -41,15 +45,21 @@ export class SCM { } } + // debug + resources.forEach(resource => this.code.logger.log(`Name: ${resource.name}, Type: ${resource.type}`)); + // Check if at least one resource matches both name and type expect(resources).toEqual( expect.arrayContaining([{ name, type }]) ); + + await this.layout.enterLayout('stacked'); + }).toPass({ timeout: 20000 }); } async openChange(name: string): Promise { - await this.code.driver.page.locator(SCM_RESOURCE_CLICK(name)).click(); + await this.code.driver.page.locator(SCM_RESOURCE_CLICK(name)).last().click(); } async stage(name: string): Promise { diff --git a/test/e2e/tests/problems/problems.test.ts b/test/e2e/tests/problems/problems.test.ts index 2300c5e37c7..4a3ff1888ed 100644 --- a/test/e2e/tests/problems/problems.test.ts +++ b/test/e2e/tests/problems/problems.test.ts @@ -36,9 +36,11 @@ test.describe('Problems', { await app.workbench.problems.showProblemsView(); await test.step('Verify Problems Count', async () => { - const errorLocators = await app.code.driver.page.locator(errorsSelector).all(); + await expect(async () => { + const errorLocators = await app.code.driver.page.locator(errorsSelector).all(); - expect(errorLocators.length).toBe(4); + expect(errorLocators.length).toBe(4); + }).toPass({ timeout: 20000 }); }); await test.step('Revert error', async () => {