Introduction
Intellisense is a feature in IDE's(Integrated Development Environment) which helps Developers/Testers to write code faster.
Intellisense helps us to know what are the various functions, and methods available when we create an object.
Once we type the object and type dot, the IDE will show all the methods that developer can make use of it for his respective needs.
Javascript Test Automation frameworks like Cypress, Typescript, and WebDriverIO provide the Intellisense feature in visual studio code which can be helpful for the Automation Testers to know what are the functions that can be performed using the Browser object.
Let us look how to set up this Intellisense or auto-completion feature for different Javascript Test Automation Frameworks.
The IDE used here is Visual Studio Code.
1. WebdriverIO
To set up IntelliSense or auto-completion feature for WebdriverIO framework
Create a jsconfig.json file in the project folder.
Add the below JSON content to it.
{
"compilerOptions": {
"types": [
"node",
"@wdio/globals/types",
"@wdio/mocha-framework"
]
}
}
2. Cypress
To set up IntelliSense or auto-completion feature for cypress framework
We can add IntelliSense for a single cypress file by adding the below triple slash directive command in the start of the cypress file.
/// <reference types="Cypress" />
or
If you want the intellisence to all the Test/spec files in your tests folder then create a jsconfig.json file in the project folder.
Add the below JSON content to it.
{
"include": ["./node_modules/cypress", "cypress/**/*.js"]
}
if you are using cypress with typescript language then add the below content to the jsconfig.json file
{
"compilerOptions": {
"allowJs": true,
"types": ["cypress"]
},
"include": ["**/*.*"]
}
3. Playwright
By default Playwright provides the IntelliSense/autocompletion feature if you are using playwright with typescript language in visual studio code
Summary
Hope this blog will be helpful for Automation Testers for setting up the Autocompletion/IntelliSense features in their respective frameworks in their IDE.
Thanks............
Happy Learning...........