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.

egghead
egghead
~ 18 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today