From e5e0fc38e2339595b0a171a93bbe499063fd69d8 Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Tue, 5 Mar 2024 00:42:55 +0100 Subject: [PATCH] test: Fix Debug tests for VS Code 1.87.0 Signed-off-by: Dominik Jelinek --- .../tree/debug/BreakpointSectionItem.ts | 10 +++---- .../test-project/src/test/debug/debug-test.ts | 28 +++++++++++++------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/page-objects/src/components/sidebar/tree/debug/BreakpointSectionItem.ts b/page-objects/src/components/sidebar/tree/debug/BreakpointSectionItem.ts index a25311af3..df88ed6dd 100644 --- a/page-objects/src/components/sidebar/tree/debug/BreakpointSectionItem.ts +++ b/page-objects/src/components/sidebar/tree/debug/BreakpointSectionItem.ts @@ -25,7 +25,7 @@ export class BreakpointSectionItem extends CustomTreeItem { */ async isBreakpointEnabled(): Promise { const locator = BreakpointSectionItem.locators.BreakpointSectionItem.breakpointCheckbox; - const el = this.findElement(locator.constructor); + const el = await this.findElement(locator.constructor); return await locator.value(el); } @@ -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 { const locator = BreakpointSectionItem.locators.BreakpointSectionItem.label; - const el = this.findElement(locator.constructor); + const el = await this.findElement(locator.constructor); return await locator.value(el); } @@ -54,7 +54,7 @@ export class BreakpointSectionItem extends CustomTreeItem { */ async getBreakpointFilePath(): Promise { const locator = BreakpointSectionItem.locators.BreakpointSectionItem.filePath; - const el = this.findElement(locator.constructor); + const el = await this.findElement(locator.constructor); return await locator.value(el); } @@ -64,7 +64,7 @@ export class BreakpointSectionItem extends CustomTreeItem { */ async getBreakpointLine(): Promise { 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)); } } diff --git a/test/test-project/src/test/debug/debug-test.ts b/test/test-project/src/test/debug/debug-test.ts index 45a41d6fb..7850b4840 100644 --- a/test/test-project/src/test/debug/debug-test.ts +++ b/test/test-project/src/test/debug/debug-test.ts @@ -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}` ); @@ -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'); });