What makes Cypress great for automation beginners?

Documentation


I am sure that no other testing framework has such clear, voluminous and extensive documentation. It is written in simple English, contains an API description , a ton of useful guides from project developers, for example, configuration settings .

image
Each page describing default methods contains a similar table. It contains a description of variables, arguments, opshins and their default values. It also provides examples and tips on how to properly use the methods and combine them with others to achieve results. On the right is a menu for quick navigation through sections of the page. It is very convenient to work, when you forget something, immediately jump into the “Examples” for any function.

The documentation is a huge plus for Cypress, I believe that the developers spent many times more time on creating it than on the development itself. If you set aside a couple of hours to read, you can easily write tests on Cypress and customize them to your needs.

PS If you are not friends with English at all, it doesn’t matter - the site has Russian localization.



Community


Of course, it is not as big as Selenium, but I always managed to find a solution to the problems in Google. Moreover, developers actively read github issues and listen to the opinions of consumers. Useful podcasts are often released and blogs are kept .

image

Easy installation and speed


Installing Cypress is incredibly easy!

npm install cypress- anything you need.



The speed of his work deserves special praise. For example, my test case with 100+ steps runs in less than 3 minutes. All thanks to its architecture: Cypress is written in JavaScript, and test runner is the browser. The higher the speed of the Internet, the faster Cypress does its job. The Framework automatically waits for the completion of commands, queries, and assertions before proceeding further. So you don’t have to rack your brains with async await!

Cypress stimulates learning API of the tested application


Sooner or later, you will encounter tests failing due to files in server requests, and it would be cool to process them.

In the Cypress runner we can observe requests that are sent to the server.



So, you can handle them usingcy.route



And at the right time, check the server response:



Thus, you reduce the likelihood of a fail, always in the know why a specific endpoint is needed, what data it takes and what it should return. In addition, to determine the cause of the defect at times easier!

Test runner



This window is a great tool for debugging the process, because you see in real time how the test is being performed. In addition, if the code changes, Cypress will automatically restart the test, and you do not need to do any extra work. Even after completing the test, you can return to any part of it and see what happened, since Cypress saves screenshots and videos.

Special attention should be paid to the assistant for selectors. Click on the “sight” icon, hover over the desired element and get a selector:



Learning selectors and assertions


Out of the box Cypress includes jQuery , Chai, and Sinon extensions . What does it give? You get powerful tools for searching and checking DOM elements that have long been proven. Google is replete with information about each of them. My helpers example: Xpath helpers , JQueary cheat sheet , CSS selectors

Summary


If you are only trying your hand at automation, I recommend studying at Cypress. Of course, it is not perfect, for example, I came across in work: a problem with sending form-data and cross origin error . Also, Cypress does not allow you to run tests in several tabs at the same time and switch to other resources . But I wanted to emphasize the merits of this tool for an easy start in automated testing! After all, learning to write tests using this framework is not difficult thanks to the chic documentation and intuitive syntax. You must admit that getting involved in something else will not be a problem if you get a good base.

All Articles