Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Sep 4, 2023
1 parent af0f039 commit 63d4fe7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,16 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
order: 3
}));

this.registerExtensionAction({
id: 'workbench.extensions.action.focusExtensionsView',
title: { value: localize('focusExtensions', "Focus on Extensions View"), original: 'Focus on Extensions View' },
category: ExtensionsLocalizedLabel,
f1: true,
run: async (accessor: ServicesAccessor) => {
await accessor.get(IPaneCompositePartService).openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true);
}
});

this.registerExtensionAction({
id: 'workbench.extensions.action.installExtensions',
title: { value: localize('installExtensions', "Install Extensions"), original: 'Install Extensions' },
Expand Down
22 changes: 5 additions & 17 deletions test/automation/src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@ import path = require('path');
import fs = require('fs');
import { ncp } from 'ncp';
import { promisify } from 'util';
import { Commands } from './workbench';

const SEARCH_BOX = 'div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea';
const REFRESH_BUTTON = 'div.part.sidebar.left[id="workbench.parts.sidebar"] .codicon.codicon-extensions-refresh';

export class Extensions extends Viewlet {

constructor(code: Code) {
constructor(code: Code, private commands: Commands) {
super(code);
}

async openExtensionsViewlet(): Promise<any> {
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+shift+x');
} else {
await this.code.dispatchKeybinding('ctrl+shift+x');
}

await this.code.waitForActiveElement(SEARCH_BOX);
}

async searchForExtension(id: string): Promise<any> {
await this.code.waitAndClick(SEARCH_BOX);
await this.code.waitForActiveElement(SEARCH_BOX);
await this.code.waitForTypeInEditor(SEARCH_BOX, `@id:${id}`);
await this.commands.runCommand('workbench.extensions.action.focusExtensionsView');
await this.code.waitForTypeInEditor('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea', `@id:${id}`);
await this.code.waitForTextContent(`div.part.sidebar div.composite.title h2`, 'Extensions: Marketplace');

let retrials = 1;
Expand All @@ -41,7 +29,7 @@ export class Extensions extends Viewlet {
return await this.code.waitForElement(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"]`, undefined, 100);
} catch (error) {
this.code.logger.log(`Extension '${id}' is not found. Retrying count: ${retrials}`);
await this.code.waitAndClick(REFRESH_BUTTON);
await this.commands.runCommand('workbench.extensions.action.refreshExtension');
}
}
throw new Error(`Extension ${id} is not found`);
Expand Down
2 changes: 1 addition & 1 deletion test/automation/src/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Workbench {
this.explorer = new Explorer(code);
this.activitybar = new ActivityBar(code);
this.search = new Search(code);
this.extensions = new Extensions(code);
this.extensions = new Extensions(code, this.quickaccess);
this.editor = new Editor(code, this.quickaccess);
this.scm = new SCM(code);
this.debug = new Debug(code, this.quickaccess, this.editors, this.editor);
Expand Down
3 changes: 1 addition & 2 deletions test/smoke/src/areas/extensions/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import { Application, Logger } from '../../../../automation';
import { installAllHandlers } from '../../utils';

export function setup(logger: Logger) {
describe.skip('Extensions', () => {
describe('Extensions', () => {

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

it('install and enable vscode-smoketest-check extension', async function () {
const app = this.app as Application;

await app.workbench.extensions.openExtensionsViewlet();
await app.workbench.extensions.installExtension('ms-vscode.vscode-smoketest-check', true);

// Close extension editor because keybindings dispatch is not working when web views are opened and focused
Expand Down
1 change: 0 additions & 1 deletion test/smoke/src/areas/workbench/localization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export function setup(logger: Logger) {
it('starts with "DE" locale and verifies title and viewlets text is in German', async function () {
const app = this.app as Application;

await app.workbench.extensions.openExtensionsViewlet();
await app.workbench.extensions.installExtension('ms-ceintl.vscode-language-pack-de', false);
await app.restart({ extraArgs: ['--locale=DE'] });

Expand Down

0 comments on commit 63d4fe7

Please sign in to comment.