diff --git a/page-objects/src/components/workbench/Workbench.ts b/page-objects/src/components/workbench/Workbench.ts index fc70a9539..19a407119 100644 --- a/page-objects/src/components/workbench/Workbench.ts +++ b/page-objects/src/components/workbench/Workbench.ts @@ -133,6 +133,11 @@ export class Workbench extends AbstractElement { async executeCommand(command: string): Promise { const prompt = await this.openCommandPrompt(); await prompt.setText(`>${command}`); - await prompt.confirm(); + const quickPicks = await Promise.all((await prompt.getQuickPicks()).map(item => item.getLabel())); + if(quickPicks.includes(command)) { + await prompt.selectQuickPick(command); + } else { + await prompt.confirm(); + } } } diff --git a/test/test-project/package.json b/test/test-project/package.json index 0940760c3..f2d959f8d 100644 --- a/test/test-project/package.json +++ b/test/test-project/package.json @@ -34,6 +34,11 @@ "title": "Hello World", "icon": "$(rocket)" }, + { + "command": "extension.helloWorld2", + "title": "Hello a World", + "icon": "$(rocket)" + }, { "command": "extension.warningMsg", "title": "Warning Message" diff --git a/test/test-project/src/extension.ts b/test/test-project/src/extension.ts index 70fa1fa4b..22307ba3e 100644 --- a/test/test-project/src/extension.ts +++ b/test/test-project/src/extension.ts @@ -7,9 +7,6 @@ import { TreeView } from './treeView'; export const ERROR_MESSAGE_COMMAND = 'extension.errorMsg'; export function activate(context: vscode.ExtensionContext) { - let disposable = vscode.commands.registerCommand('extension.helloWorld', () => { - vscode.window.showInformationMessage('Hello World!'); - }); let openCommand = vscode.commands.registerCommand('extension.openFile', async () => { const document = await vscode.workspace.openTextDocument(vscode.Uri.file( path.resolve(__dirname, '..', '..', 'resources', 'test-file.ts'))); @@ -36,7 +33,16 @@ export function activate(context: vscode.ExtensionContext) { vscode.window.showQuickPick(['test1', 'test2', 'test3'], { canPickMany: true, ignoreFocusOut: true }); }); - context.subscriptions.push(disposable); + context.subscriptions.push( + vscode.commands.registerCommand('extension.helloWorld', () => { + vscode.window.showInformationMessage('Hello World!'); + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand('extension.helloWorld2', () => { + vscode.window.showInformationMessage('Hello World, Test Project!'); + }) + ); context.subscriptions.push(openCommand); context.subscriptions.push(openFolder); context.subscriptions.push(closeFolder); diff --git a/test/test-project/src/test/workbench/workbench-test.ts b/test/test-project/src/test/workbench/workbench-test.ts index 95cc014b1..b9edd3c64 100644 --- a/test/test-project/src/test/workbench/workbench-test.ts +++ b/test/test-project/src/test/workbench/workbench-test.ts @@ -51,10 +51,13 @@ describe('Workbench', () => { }); it('executeCommand works', async () => { - await bench.executeCommand('hello world'); + await bench.executeCommand('Hello World'); await bench.getDriver().sleep(500); const notifications = await bench.getNotifications(); expect(notifications).not.empty; + + const message = await notifications[0].getMessage(); + expect(message).is.equal('Hello World!'); }); it('openSettings opens the settings editor', async function() {