Enable intelligent code completion for cypress tests in VSCode

Tomasz Łakomy
InstructorTomasz Łakomy
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

Even though cypress has a well-designed API, we're not going to remember every single command.

In this quick lesson we're going to learn how to enable intelligent code completion for cypress tests in VSCode so our editor will help us write e2e tests much quicker

Tomasz Łakomy: [0:00] In order write a test with Cypress, we have to use the cy global object in order to interact with the Cypress API to use commands like visit, contains, and many more.

[0:08] Right now, if I type cy., I'm not seeing all Cypress commands, I'm only seeing those that I already used before, like contains and visit over here.

[0:15] The simplest way of fixing that is to add this line at the top of our Cypress file. Basically, this is going to enable IntelliSense in our Cypress file, so right now, if I type in cy., I'm going to get the list of all Cypress commands.

[0:26] If I want to use a command such as get, I can start typing. It's going to show me three commands, so get, getCookie, and getCookies, but if I start using the get command, I will also get this handy documentation inside of my Visual Studio Code editor.

[0:39] I don't even have to access the online documentation, but if I want to, the link is over here.