DEV Community

Cover image for Installing Cypress and knowing the structure
Robertopaolo Ramirez
Robertopaolo Ramirez

Posted on

Installing Cypress and knowing the structure

Hello guys! What's going?
It was a long time that I publish a post, but it better late than never, right?

Well, to start, we'll open our terminal and create a paste.

$mkdir myFirstTest

Next, inside the paste, we will to install dependencies by cypress.

$cd myFirstTest
$npm init -y
$npm install cypress --save-dev

When we install cypress in our project just appear this thinks:

installing-cypress

But don't worry, we just need to run with this command to start cypress.

npx cypress open

Appear a windows like this:
cypress-windows

Nice, we can see two paste: 1-getting-started and 2-advanced-examples and inside this paste there are a lot of examples that cypress show us to learn.

You can see this examples, it's very interesting and bring us a vision that how we can create our test.

When we run for the first time cypress, he will create any other thinks as like we saw.

paste-cypress

Structure of Cypress project

  • Nice, let's talk about cypress.json file:

In this file, we will to put our configuration about cypress, we can put it what kind of files cypress will run or what it the default time out and more.

  • cypress paste structure-cypress Here, we will have 4 paste as like image show.

structure-cypress2

fixture= Usually we put it environment variables.
fixture

integration = We put it our test files, they finish with ".spec.js", I will not said "always" finish with ".spec.js" because we can change to cypress read others files, for example at the work we use "cucumber" to organized our test to better way, In this configuration we put it to read ".feature" files. It's nice to use, I can teach to use in other occasion.

integration

plugins = As like said the name, in this paste, we add plugins to the project.
plugins

support = In this paste we can organized other files and integrate with files of integration paste.

I hope that you liked it, just remember that all these things are in the Documentation of Cypress.io, and if you have any questions you can send me, I'll be happy to help you!

Top comments (0)