Skip to content

Commit

Permalink
Bump 'max' placeholder to latest VS Code 1.83.0 (#962)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek authored Oct 6, 2023
1 parent d003906 commit 7e4b524
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
58 changes: 30 additions & 28 deletions page-objects/src/components/editor/SettingsEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { EditorView, EditorGroup } from "../..";
* Page object representing the internal VSCode settings editor
*/
export class SettingsEditor extends Editor {

private divider = SettingsEditor.versionInfo.version >= '1.83.0' ? '›' : ' › ';

constructor(view: EditorView | EditorGroup = new EditorView()) {
super(view);
Expand All @@ -26,21 +28,12 @@ export class SettingsEditor extends Editor {
* @returns Promise resolving to a Setting object if found, undefined otherwise
*/
async findSetting(title: string, ...categories: string[]): Promise<Setting> {
const category = categories.join(' › ');
const category = categories.join(this.divider);
const searchBox = await this.findElement(SettingsEditor.locators.Editor.inputArea);
await searchBox.sendKeys(Key.chord(SettingsEditor.ctlKey, 'a'));
await searchBox.sendKeys(`${category}: ${title}`);

let setting!: Setting;
const items = await this._getSettingItems();
await searchBox.sendKeys(`${category}${this.divider}${title}`);

for (const item of items) {
try {
return await (await this.createSetting(item, title, category)).wait();
} catch (err) {
}
}
return setting;
return await this._getSettingItem(title, category);
}

/**
Expand All @@ -56,25 +49,14 @@ 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;
const title = id.split('.').pop();
return await this._getSettingItem(title);
}

private async _getSettingItems(): Promise<WebElement[]> {
private async _getSettingItem(title: string = '', category: string = ''): Promise<Setting> {
const count = await this.findElement(SettingsEditor.locators.SettingsEditor.itemCount);
let textCount = await count.getText();

await this.getDriver().wait(async() => {
await this.getDriver().wait(async function() {
await new Promise(res => setTimeout(res, 1500));
const text = await count.getText();
if (text !== textCount) {
Expand All @@ -84,7 +66,27 @@ 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(category !== '') {
if(category.toLowerCase().replace(this.divider, '').replace(/\s/g, '').trim() !== _category.toLowerCase().replace(this.divider, '').replace(/\s/g, '').trim()) {
continue;
}
}
if(title !== '') {
if(title.toLowerCase().replace(/\s/g, '').trim() !== _title.toLowerCase().replace(/\s/g, '').trim()) {
continue;
}
}
return await (await this.createSetting(item, _title, _category)).wait();
} catch (err) {
}
}
return setting;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/extester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test-project/src/test/editor/settingsEditor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down

0 comments on commit 7e4b524

Please sign in to comment.