In the last few years, Cypress has gained immense traction in the market and has positioned itself as one of the best tools for functional test automation.
Whenever the idea of starting an automation process comes up, Cypress is one of the first tools to be mentioned and is often the tool of choice for many projects.
But what makes Cypress such a popular tool? What sets Cypress apart from the crowd? And more importantly, is Cypress really the best choice for most projects?
The Popularity of Cypress
Cypress was created at the end of 2015, initially for integration testing, and quickly accepted by the world as a better alternative to existing tools. Its differences were quickly appreciated by users, and you could see an improvement in terms of speed, and reliability, but, above all, what stood out the most was its ease of use.
This unique Cypress architecture provides many advantages but also brings several limitations.
Some of the advantages are:
- It is developer-friendly since the test code can access all the same objects as the application code, which allows easy integration between both projects to implement unit, integration, and end-to-end tests.
- By having full control of the application, network traffic, and access to any object of the application and the system, users can attain new levels of testing in which they can even create artificial states as it would be done in unit tests.
- Cypress allows users to interact with the application programmatically, that is, it is not necessary to use the UI to build or reach a state.
Cypress knows and understands everything that happens in the application, so it automatically waits for the page to load, for the elements to be visible, enabled, covered, etc. So, there is no need to add explicit waits in the code.
Its most important limitations are:
- By running directly inside the browser Cypress does not support multiple browser tabs or use two browsers at the same time.
- Performing actions outside the browser, for example, communication with the back end such as servers and databases takes extra work in configuration and plugins to achieve.
Currently, Cypress only supports Chrome, Firefox, and Edge. Safari is not supported. (In version 10.8.0 Cypress released an experimental feature to support Webkit which is the browser engine used by Safari, but it still presents problems).
So, how do I know if Cypress is the best tool for my project?
No matter what the tool is, during the tool selection process, it is necessary to know and have total clarity of the requirements and expectations from the project. With this information we must then investigate if the limitations of the tool affect in any way what we intend to achieve with the tests and if the tool fits our expectations. Cypress specifically may be the ideal tool for one project and be totally useless for another since all projects are different and their requirements vary.
Fast-growing tech companies partner with Encora to outsource product development and drive growth. Contact us to learn more about our software engineering capabilities.