Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Settings editor smoke tests (take 2) #189867

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,7 @@ export class SettingsEditor2 extends EditorPane {
this.searchResultLabel = null;
this.updateInputAriaLabel();
this.countElement.style.display = 'none';
this.countElement.innerText = '';
this.layout(this.dimension);
}

Expand Down
19 changes: 19 additions & 0 deletions test/automation/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,23 @@ export class SettingsEditor {
await this.quickaccess.runCommand('workbench.action.openSettingsJson');
await this.editor.waitForEditorFocus('settings.json', 1);
}

async openUserSettingsUI(): Promise<void> {
await this.quickaccess.runCommand('workbench.action.openSettings2');
await this.code.waitForElement('.settings-editor');
}

async searchSettingsUI(query: string): Promise<void> {
await this.openUserSettingsUI();
await this.code.waitAndClick('.settings-editor .suggest-input-container .monaco-editor textarea');
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+a');
} else {
await this.code.dispatchKeybinding('ctrl+a');
}
await this.code.dispatchKeybinding('Delete');
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => !results || (results?.length === 1 && !results[0].textContent));
await this.code.waitForTypeInEditor('.settings-editor .suggest-input-container .monaco-editor textarea', query);
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => results?.length === 1 && results[0].textContent.includes('Found'));
}
}
32 changes: 31 additions & 1 deletion test/smoke/src/areas/preferences/preferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function setup(logger: Logger) {
await app.code.waitForElements('.line-numbers', false, elements => !!elements.length);

await app.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"');
await app.code.waitForElements('.line-numbers', false, result => !result || result.length === 0);
await app.code.waitForElements('.line-numbers', false, elements => !elements || elements.length === 0);
});

it('changes "workbench.action.toggleSidebarPosition" command key binding and verifies it', async function () {
Expand All @@ -33,4 +33,34 @@ export function setup(logger: Logger) {
await app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.RIGHT);
});
});

describe('Settings editor', () => {

// Shared before/after handling
installAllHandlers(logger);

it('shows a modified indicator on a modified setting', async function () {
const app = this.app as Application;

await app.workbench.settingsEditor.searchSettingsUI('@id:editor.tabSize');
await app.code.waitForSetValue('.settings-editor .setting-item-contents .setting-item-control input', '6');
await app.code.waitForElement('.settings-editor .setting-item-contents .setting-item-modified-indicator');
await app.code.waitForSetValue('.settings-editor .setting-item-contents .setting-item-control input', '4');
});

it('turns off editor line numbers and verifies the live change', async function () {
const app = this.app as Application;

await app.workbench.editors.newUntitledFile();
await app.code.dispatchKeybinding('enter');
await app.code.waitForElements('.line-numbers', false, elements => !!elements.length);

await app.workbench.settingsEditor.searchSettingsUI('editor.lineNumbers');
await app.code.waitAndClick('.settings-editor .monaco-list-rows .setting-item-control select', 2, 2);
await app.code.waitAndClick('.context-view .option-text', 2, 2);

await app.workbench.editors.selectTab('Untitled-1');
await app.code.waitForElements('.line-numbers', false, elements => !elements || elements.length === 0);
});
});
}