From 2bd561baec7b30df248278b1d178adfce421d7d7 Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Thu, 5 Oct 2023 10:36:56 +0200 Subject: [PATCH] Bump 'max' placeholder to latest VS Code 1.83.0 Signed-off-by: Dominik Jelinek --- .github/workflows/insiders.yml | 2 +- .github/workflows/main.yml | 4 +- .../src/components/editor/SettingsEditor.ts | 48 ++++++++----------- src/extester.ts | 4 +- .../src/test/editor/settingsEditor-test.ts | 2 +- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index 13f2520ba..0c22f7b44 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 18.15.0 + node-version: 18.15.x cache: npm - name: Run Tests (macOS, windows) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 729d23730..1e02848b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - version: [ min, 1.81.1, max ] + version: [ min, 1.82.3, max ] fail-fast: false env: @@ -30,7 +30,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 18.15.0 + node-version: 18.15.x cache: npm - name: Run Tests (macOS, windows) diff --git a/page-objects/src/components/editor/SettingsEditor.ts b/page-objects/src/components/editor/SettingsEditor.ts index af485e06e..5039ed013 100644 --- a/page-objects/src/components/editor/SettingsEditor.ts +++ b/page-objects/src/components/editor/SettingsEditor.ts @@ -26,21 +26,12 @@ export class SettingsEditor extends Editor { * @returns Promise resolving to a Setting object if found, undefined otherwise */ async findSetting(title: string, ...categories: string[]): Promise { - const category = categories.join(' › '); + const category = categories.join('>'); const searchBox = await this.findElement(SettingsEditor.locators.Editor.inputArea); await searchBox.sendKeys(Key.chord(SettingsEditor.ctlKey, 'a')); - await searchBox.sendKeys(`${category}: ${title}`); + await searchBox.sendKeys(`${category}>${title}`); - let setting!: Setting; - const items = await this._getSettingItems(); - - for (const item of items) { - try { - return await (await this.createSetting(item, title, category)).wait(); - } catch (err) { - } - } - return setting; + return await this._getSettingItem(title); } /** @@ -56,24 +47,12 @@ export class SettingsEditor extends Editor { await searchBox.sendKeys(Key.chord(SettingsEditor.ctlKey, 'a')); await searchBox.sendKeys(id); - let setting!: Setting; - const items = await this._getSettingItems(); - - for (const item of items) { - try { - const category = (await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingCategory)).getText()).replace(':', ''); - const title = await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingLabel)).getText(); - return await (await this.createSetting(item, title, category)).wait(); - } catch (err) { - } - } - return setting; + return await this._getSettingItem(); } - private async _getSettingItems(): Promise { + private async _getSettingItem(title: string = ''): Promise { const count = await this.findElement(SettingsEditor.locators.SettingsEditor.itemCount); let textCount = await count.getText(); - await this.getDriver().wait(async() => { await new Promise(res => setTimeout(res, 1500)); const text = await count.getText(); @@ -84,7 +63,22 @@ export class SettingsEditor extends Editor { return true; }); - return await this.findElements(SettingsEditor.locators.SettingsEditor.itemRow); + let setting!: Setting; + const items = await this.findElements(SettingsEditor.locators.SettingsEditor.itemRow); + for (const item of items) { + try { + const _category = (await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingCategory)).getText()).replace(':', ''); + const _title = await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingLabel)).getText(); + if(title.length > 0) { + if(title !== _title) { + continue; + } + } + return await (await this.createSetting(item, _title, _category)).wait(); + } catch (err) { + } + } + return setting; } /** diff --git a/src/extester.ts b/src/extester.ts index 066e0898b..54bc2c65e 100644 --- a/src/extester.ts +++ b/src/extester.ts @@ -26,8 +26,8 @@ export const DEFAULT_SETUP_OPTIONS = { installDependencies: false } -export const VSCODE_VERSION_MIN = '1.80.2'; -export const VSCODE_VERSION_MAX = '1.82.3'; +export const VSCODE_VERSION_MIN = '1.81.1'; +export const VSCODE_VERSION_MAX = '1.83.0'; /** * VSCode Extension Tester diff --git a/test/test-project/src/test/editor/settingsEditor-test.ts b/test/test-project/src/test/editor/settingsEditor-test.ts index 54519ac02..86f95fb62 100644 --- a/test/test-project/src/test/editor/settingsEditor-test.ts +++ b/test/test-project/src/test/editor/settingsEditor-test.ts @@ -21,7 +21,7 @@ describe('Settings Editor', function () { it('findSetting by ID works', async function () { this.timeout(15000); - const setting = await editor.findSettingByID('testProject.general.helloWorld'); + const setting = await editor.findSettingByID('workbench.editor.enablePreview'); expect(setting).not.undefined; });