Skip to content

Commit

Permalink
E2E test: fix issues with SCM test and Problems test (#6147)
Browse files Browse the repository at this point in the history
Fix issues with SCM and problems tests.

SCM needed more screen real estate to read filenames and a fix for when
retries happen.
Problems needed to wait longer for all problems to appear.

### QA Notes

All tests should pass
  • Loading branch information
testlabauto authored Jan 29, 2025
1 parent bfdc517 commit f4b7966
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/e2e/infra/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

14 changes: 12 additions & 2 deletions test/e2e/pages/scm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<any> {
await this.code.driver.page.keyboard.press('Control+Shift+G');
Expand All @@ -29,6 +30,9 @@ export class SCM {

async waitForChange(name: string, type: string): Promise<void> {
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 }[] = [];
Expand All @@ -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<void> {
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<void> {
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/tests/problems/problems.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit f4b7966

Please sign in to comment.