WebdriverIO - VS Code Intellisense



Once we have completed installation of the Visual Studio Code, we should add the intellisense in the editor so that once we begin writing the WebdriverIO commands, the auto-suggestions of the WebdriverIO methods are displayed.

The details on how to do a VS Code installation are discussed in detail in the Chapter titled VS Code Installation.

This is a very important feature that should be added so that the end-users do not need to memorize the raw code for the WebdriverIO.

Add intellisense to VS Code

The steps to add intellisense to the VS Code for the WebdriverIO are listed below −

Step 1 − Click on the New File button appearing to the right of the WebdriverIO project.

The following screen will appear on your computer −

Add Intellisense

Step 2 − Enter the file name as jsconfig.json. Here, we have to specify the path of the spec files where we are implementing our test.

If we want to apply intellisense feature to all the spec files within the test folder, we can specify the relative path as test/spec/*.js.

The following screen will appear on your computer −

Intellisense Feature

Step 3 − Add the below code inside the file.

{
   "include": [
      //relative path of all spec files
      "test/specs/*.js",
      "**/*.json",
      "node_modules/@wdio/sync",
      "node_modules/@wdio/mocha-framework"
   ]
}

Step 4 − In the spec file, start writing a WebdriverIO object or a method and we shall obtain the entire auto - suggestions.

The following screen will appear on your computer −

WebdriverIO Object
Advertisements