After you install cypress successfully in the previous article – Cypress Tutorial | How To Install Cypress.io You are now ready to read how to run your first test.
Open Cypress For The First Time
To open Cypress you need to type in the open terminal:
npx cypress open
A new window should open, this is the cypress runner.
After you open the cypress runner successfully a cypress folder is just added to your project folder
Fixtures are used to store and manage test data. Fixture files are located in cypress/fixtures by default but can be configured to another directory. The test data is usually written inside a JSON file which can then be used throughout your tests.
The integration folder includes all the test files. The test files may be written as. js file
for example – demoTest.spec.js
Plugins enable you to tap into, modify, or extend the internal behavior of Cypress.
Normally, as a user, all of your test code, your application, and Cypress commands are executed in the browser. But Cypress is also a Node process that plugins can use.
Plugins are a “seam” for you to write your own custom code that executes during particular stages of the Cypress lifecycle. It also allows you to execute code within your own Node version when the nodeVersion is set in your configuration.
The support folder is a great place to put reusable behavior such as custom commands or global overrides that you want to be applied and available to all your spec files.
The Cypress Runner is an amazing GUI tool with this, we can manage our tests, run specific tests and watch the whole run from the start to the end.
Cypress runs the tests on an actual browser so to run your tests on a specific browser you must it will be installed on your computer.
By default cypress came with Electron browser, to read more about what browser can you use and how to perform cross-browser tests you can read more in this article – Cypress | How To Run Cross Browser Testing.
Now let’s run our first cypress test, open the cypress runner and click on the first demo spec test.
Cypress will open a new browser window and will run the test automatically.
In the top navbar, you can see the total run time, how many tests passed and failed.
For the right screen, you can see the actual run pages. And for the left side, you can see the whole DOM process of the tests.
Next article – Cypress Tutorial | How To Organize Cypress Test