Skip to content

Commit

Permalink
executeWorkbench args (#33)
Browse files Browse the repository at this point in the history
* Params when invoking vscode api

* Update test/specs/basic.e2e.ts

Co-authored-by: Christian Bromann <[email protected]>
  • Loading branch information
meguia-sfdc and christian-bromann authored Aug 18, 2022
1 parent fb2a267 commit 56d2632
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default class VSCodeWorkerService implements Services.ServiceInstance {
interface VSCodeCommands {
getWorkbench: () => Promise<Workbench>
// Todo(Christian): properly type VSCode object here
executeWorkbench: <T>(fn: (vscode: any, ...params: any[]) => T) => Promise<T>
executeWorkbench: <T>(fn: (vscode: any, ...params: any[]) => T, ...params: any[]) => Promise<T>
getVSCodeVersion: () => Promise<string>
getVSCodeChannel: () => Promise<string>
isVSCodeWebSession: () => Promise<boolean>
Expand Down
16 changes: 16 additions & 0 deletions test/specs/basic.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ describe('WDIO VSCode Service', () => {
timeoutMsg: 'Could not find another custom notification'
})
})

it('can send parameters to VSCode API invocation @skipWeb', async () => {
const workbench = await browser.getWorkbench()
const message = 'I passed this message as a parameter!'
await browser.executeWorkbench((vscode, msg) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
vscode.window.showInformationMessage(msg)
}, message)
await browser.waitUntil(async () => {
const notifs = await workbench.getNotifications()
const messages = await Promise.all(notifs.map((n) => n.getMessage()))
return messages.includes(message)
}, {
timeoutMsg: 'Could not find custom notification'
})
})
})

describe('settings @skipWeb', () => {
Expand Down

0 comments on commit 56d2632

Please sign in to comment.