Skip to content

Commit

Permalink
test: Fix Debug tests for VS Code 1.87.0
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek committed Mar 8, 2024
1 parent aae6433 commit e5e0fc3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class BreakpointSectionItem extends CustomTreeItem {
*/
async isBreakpointEnabled(): Promise<boolean> {
const locator = BreakpointSectionItem.locators.BreakpointSectionItem.breakpointCheckbox;
const el = this.findElement(locator.constructor);
const el = await this.findElement(locator.constructor);
return await locator.value(el);
}

Expand All @@ -38,13 +38,13 @@ export class BreakpointSectionItem extends CustomTreeItem {
return;
}
const locator = BreakpointSectionItem.locators.BreakpointSectionItem.breakpointCheckbox;
const el = this.findElement(locator.constructor);
const el = await this.findElement(locator.constructor);
await el.click();
}

async getLabel(): Promise<string> {
const locator = BreakpointSectionItem.locators.BreakpointSectionItem.label;
const el = this.findElement(locator.constructor);
const el = await this.findElement(locator.constructor);
return await locator.value(el);
}

Expand All @@ -54,7 +54,7 @@ export class BreakpointSectionItem extends CustomTreeItem {
*/
async getBreakpointFilePath(): Promise<string> {
const locator = BreakpointSectionItem.locators.BreakpointSectionItem.filePath;
const el = this.findElement(locator.constructor);
const el = await this.findElement(locator.constructor);
return await locator.value(el);
}

Expand All @@ -64,7 +64,7 @@ export class BreakpointSectionItem extends CustomTreeItem {
*/
async getBreakpointLine(): Promise<number> {
const locator = BreakpointSectionItem.locators.BreakpointSectionItem.lineNumber;
const el = this.findElement(locator.constructor);
const el = await this.findElement(locator.constructor);
return Number.parseInt(await locator.value(el));
}
}
28 changes: 19 additions & 9 deletions test/test-project/src/test/debug/debug-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,36 @@ describe('Debugging', function () {
});

it('BreakpointSectionItem.setBreakpointEnabled', async function () {
const item = await getBreakpointItem(view, this.timeout() - 2000);
let item = await getBreakpointItem(view, this.timeout() - 2000);
const driver = item.getDriver();
let status = await item.isBreakpointEnabled();
let status = await item.isBreakpointEnabled(); // true

await item.setBreakpointEnabled(status);
await item.setBreakpointEnabled(status); // true --> true
await driver.wait(
async () => await item.isBreakpointEnabled() === status,
async () => {
item = await getBreakpointItem(view, this.timeout() - 2000);
return await item.isBreakpointEnabled() === status;
},
this.timeout() - 2000,
`could not set status from ${status} to ${status}`
);

await item.setBreakpointEnabled(!status);
await item.setBreakpointEnabled(!status); // true --> false
await driver.wait(
async () => await item.isBreakpointEnabled() === !status,
async () => {
item = await getBreakpointItem(view, this.timeout() - 2000);
return await item.isBreakpointEnabled() === !status;
},
this.timeout() - 2000,
`could not set status from ${status} to ${!status}`
);

await item.setBreakpointEnabled(status);
await item.setBreakpointEnabled(status); // false --> true
await driver.wait(
async () => await item.isBreakpointEnabled() === status,
async () => {
item = await getBreakpointItem(view, this.timeout() - 2000);
return await item.isBreakpointEnabled() === status;
},
this.timeout() - 2000,
`could not set status from ${!status} to ${status}`
);
Expand Down Expand Up @@ -187,9 +196,10 @@ describe('Debugging', function () {
});

it('Variable view: setVariableValue', async function () {
const item = await getNumVariable(view, this.timeout() - 2000);
let item = await getNumVariable(view, this.timeout() - 2000);
expect(await item.getVariableValue()).equals('5');
await item.setVariableValue('42');
item = await getNumVariable(view, this.timeout() - 2000);
expect(await item.getVariableValue()).equals('42');
});

Expand Down

0 comments on commit e5e0fc3

Please sign in to comment.