We are planning to switch to an automation tool as Protractor is not going to provide support.
Why does everyone prefer Cypress which is a paid tool if we have Nightwatchjs? Can someone help me understand which one to prefer with their advantages and disadvantages?
This is a great question!
Cypress is an overall testing solution of which e2e is a subset of its capabilities. The Cypress App is free to use and completely open source it was built with a developer experience first focus and it was geared toward solving the problem of web application testing by running in the browser's process.
I often encounter in my work with organizations adopting new tools a framing of why should I choose X tool over Y tool. This is a great place to start thinking, but what I like to challenge organizations I work with is to take one step back and ask, " Am I looking for a tool or a solution?"
A tool works in conjunction with other tools to achieve some mostly singular purpose; unit testing, API testing, integration testing, component testing, e2e testing, contract testing, analytics, etc. Tools also require learning a new syntax, continual training, implementation time, on-going maintenance and more a conjunction of other tools to accomplish an overall solution, in this case effectively and confidently testing.
Cypress is an overall testing solution of which there are two core product areas (right now), The Cypress App & Dashboard. The Cypress App is a completely free open source project that can test anything that runs in the browser.
Features of Cypress App - absolutely free - #1 tool recommended by Angular and Protractor team for migrating to after the deprecation of Protractor - automatic retries and baked in tests for actionability on elements - running in the browser's process - can test the following; front end unit, component, integration, api, e2e testing - can test multi-origin (currently in beta) - amazing docs - syntax is straight forward - no complex configs or setup - thriving and vibrant community - bi-weekly release cycle, so always iterating and improving - integrates with the Dashboard to show information from your runs in the cloud
The Cypress Dashboard is a paid subscription service that well to put it briefly makes testing even better with a focus on;
- speeding up your runs through parallelization
- unlocking an enhanced debugging workflow
- providing you analytics that help you better understand the ongoing health of your test suite
- handling all of your Cypress testing types in one place
- addressing flake through our flake analysis and mitigation workflows
- integrates all CI providers, Slack, Jira, and the top source control management tools to report directly on your runs
- and a lot more
I hope this was helpful for you and the team, but don't take my word for it come engage in our community forums on Discord and ask around.
Oh, and I almost forgot, our DX team built a free to use Protractor to Cypress migration tool that will help you swap your tests over to Cypress. It's a really great tool when you're getting started to learn more about Cypress syntax. Anything with a lot of complex logic may not migrate appropriately, but it should give you a running start!
Cypress tests are always fast in execution as compared to tools that use selenium. Cypress also operates at the network layer so you don't need to install any external libraries. Cypress tests are easy to set up and you don't need any browser drivers to run cypress tests. Any browser that is installed, you can run cypress tests on those browsers. It is very easy to write locators and tests in cypress as compared to any other tool. The only drawback of cypress is it doesn't handle subdomain change and multiple tabs. But there are workaround for subdomain change that one can use