2

I am wonder, if it is way how to enable autocompletion for WDIO global variables ( $, $$, browser ) in VSCode. I know, that wdio has support for Webstorm, but it doesn't work for VSCode.

Any idea, how to use autocompletion in VSCode? Without it is pretty hard to create some tests.

Vojtech Cerveny
  • 686
  • 1
  • 4
  • 18

2 Answers2

3

I struggled with this as well. Firstly, ensure you've followed the "Autocompletion" Setup described on the website; for example, they require something like the following exist in a file called jsconfig.json at the root of your project:

{
  "include": [
    "**/*.js",
    "**/*.json",
    "node_modules/@wdio/sync",
    "node_modules/@wdio/mocha-framework"
  ]
}

You may already have a jsconfig.json; if so, ensure that the node_modules directories are not in a section called "exclude": { ... }. When setting up other things like Babel (for mocha) this may get installed as a default configuration entry. When node_modules is in both include and exclude, exclude takes precedence.

I had zero success importing npm @types pacakges, adding typeAcquisition: {} to jsconfig.json, or adding interface browser; into the file global.d.ts as other people have suggested in various forums.

rand'Chris
  • 788
  • 4
  • 17
0

Auto completion is pre-installed on vs code. If it is not working you might want to check through extension and install. And to use, once the open tag is created, it often auto suggest, just do appropriately then input your attribute.

  • Yeah, I know that, but it doesn't know global variables. It works properly, if you want autosuggestion on imported object, but on global var, it is something else. – Vojtech Cerveny Oct 01 '19 at 15:01