diff --git a/packages/locators/lib/1.88.0.ts b/packages/locators/lib/1.88.0.ts index 4aa4acf20..fc27d266c 100644 --- a/packages/locators/lib/1.88.0.ts +++ b/packages/locators/lib/1.88.0.ts @@ -5,6 +5,11 @@ export const diff: LocatorDiff = { FindWidget: { toggleReplace: By.xpath(`.//div[@aria-label="Toggle Replace"]`), button: (title: string) => By.xpath(`.//div[@role='button' and starts-with(@aria-label, "${title}")]`) + }, + SettingsEditor: { + comboSetting: By.css('select'), + comboOption: By.css(`option`), + comboValue: 'value' } } } \ No newline at end of file diff --git a/packages/page-objects/src/components/editor/SettingsEditor.ts b/packages/page-objects/src/components/editor/SettingsEditor.ts index 100887566..9bc64d706 100644 --- a/packages/page-objects/src/components/editor/SettingsEditor.ts +++ b/packages/page-objects/src/components/editor/SettingsEditor.ts @@ -202,7 +202,7 @@ export class ComboSetting extends Setting { const rows = await this.getOptions(); for (let row of rows) { if ((await row.getAttribute('class')).indexOf('disabled') < 0) { - const text = await (await row.findElement(SettingsEditor.locators.SettingsEditor.comboOption)).getText(); + const text = await row.getAttribute(SettingsEditor.locators.SettingsEditor.comboValue); if (value === text) { return await row.click(); } @@ -219,34 +219,39 @@ export class ComboSetting extends Setting { const rows = await this.getOptions(); for (const row of rows) { - values.push(await (await row.findElement(SettingsEditor.locators.SettingsEditor.comboOption)).getText()) + // values.push(await (await row.findElement(SettingsEditor.locators.SettingsEditor.comboOption)).getText()) + values.push(await row.getAttribute(SettingsEditor.locators.SettingsEditor.comboValue)); } return values; } private async getOptions(): Promise { - const menu = await this.openCombo(); - return await menu.findElements(SettingsEditor.locators.SettingsEditor.itemRow); - } + // const menu = await this.openCombo(); + // return await menu.findElements(SettingsEditor.locators.SettingsEditor.itemRow); - private async openCombo(): Promise { const combo = await this.findElement(SettingsEditor.locators.SettingsEditor.comboSetting); - const workbench = await this.getDriver().findElement(SettingsEditor.locators.Workbench.constructor); - const menus = await workbench.findElements(SettingsEditor.locators.ContextMenu.contextView); - let menu!: WebElement; - - if (menus.length < 1) { - await combo.click(); - menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView); - return menu; - } else if (await menus[0].isDisplayed()) { - await combo.click(); - await this.getDriver().sleep(200); - } - await combo.click(); - menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView); - return menu; + + return await combo.findElements(SettingsEditor.locators.SettingsEditor.comboOption); } + + // private async openCombo(): Promise { + // const combo = await this.findElement(SettingsEditor.locators.SettingsEditor.comboSetting); + // const workbench = await this.getDriver().findElement(SettingsEditor.locators.Workbench.constructor); + // const menus = await workbench.findElements(SettingsEditor.locators.ContextMenu.contextView); + // let menu!: WebElement; + + // if (menus.length < 1) { + // await combo.click(); + // menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView); + // return menu; + // } else if (await menus[0].isDisplayed()) { + // await combo.click(); + // await this.getDriver().sleep(200); + // } + // await combo.click(); + // menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView); + // return menu; + // } } /** diff --git a/tests/test-project/src/test/editor/settingsEditor.test.ts b/tests/test-project/src/test/editor/settingsEditor.test.ts index a80e6f08f..8bc0c5ea3 100644 --- a/tests/test-project/src/test/editor/settingsEditor.test.ts +++ b/tests/test-project/src/test/editor/settingsEditor.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { SettingsEditor, Workbench, EditorView, ComboSetting, TextSetting, CheckboxSetting } from 'vscode-extension-tester'; -describe('Settings Editor', function () { +describe.only('Settings Editor', function () { let editor: SettingsEditor; before(async function () {