webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO

Home Page:https://webdriverio-community.github.io/wdio-vscode-service/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help for openContextMenu in TextEditor

YvesMichon opened this issue · comments

Hello,

I'm writing test for private extension.
I want to automate the opening of the contextMenu to send command by click.

When i open the contextMenu

const workbench = await browser.getWorkbench();
const editorView = workbench.getEditorView();
const currentEditor = await editorView.openEditor(`${fic}`) as TextEditor;
const mnu = await currentEditor.openContextMenu();

I've got the error

invalid argument: invalid argument: invalid locator
  (Session info: chrome=102.0.5005.167)
    at getErrorFromResponseBody (C:\dev\webio\adv-e2e\node_modules\webdriver\build\utils.js:198:12)
    at NodeJSRequest._request (C:\dev\webio\adv-e2e\node_modules\webdriver\build\request\index.js:166:60)
    at async Browser.wrapCommandFn (C:\dev\webio\adv-e2e\node_modules\@wdio\utils\build\shim.js:137:29)
    at async Browser.$ (C:\dev\webio\adv-e2e\node_modules\@wdio\runner\node_modules\webdriverio\build\commands\browser\$.js:91:17)
    at async Browser.wrapCommandFn (C:\dev\webio\adv-e2e\node_modules\@wdio\utils\build\shim.js:137:29)
    at async ContextMenu.wait (C:\dev\webio\adv-e2e\node_modules\wdio-vscode-service\src\pageobjects\menu\ContextMenu.ts:80:16)
    at async World.<anonymous> (C:\dev\webio\adv-e2e\e2e\step-definitions\vscode.step.ts:82:21)

On debugging my test, I see the menu opening but it hangs just after

We ran into this as well. I think the issue is that VS Code now uses the operating system's native UI controls for contextual menus, and they aren't able to be automated by wdio. We've gotten around it (so far) by doing most things in the command palette, but it would be nice if there was a means to automate the context menus.

Also, I think this is a duplicate issue of #57

@jeffb-sfdc good call.

Closing as duplicate of #57