As we all know testing is an important part of any application. To assist with our testing we are going to use both Cypress and Jest. We feel these tools complement each other and will help us get good coverage of our code. We will use Cypress for our end to end testing as we've found it quite user friendly. Jest will be used for our unit tests because we've seen how many larger companies use it with great success.
Tech Stacks are going to evolve and be replaced. We will have to keep up with it. Never heard a Developer asking for such a responsibility shift to QA to fix a bug. I have spent some time in an Organization and a Project where test automation responsibility was bestowed upon Developers. It turned out that we did not need any automation QA skilled person we ended up replacing them with Manual QA skilled person. Lets not push our responsibilities to others. There is a reason for keeping a Developer and QA team separate. So that the quality checks are not compromised.
In the company I will be building test automation framework and my new company develops apps mainly using AngularJS/TypeScript. I was planning to build Protractor-Jasmine framework but a friend of mine told me about Cypress and heard that its users are very satisfied with it. I am trying to understand the capabilities of Cypress and as the final goal to differentiate these two tools. Can anyone advice me on this in a nutshell pls...
I've used both Protractor and Cypress extensively. Cypress is the easier and more reliable tool, whereas Protractor is the more powerful tool. Your choice of tool should depend on your specific testing needs. Here are some advantages and disadvantages of each tool:
More reliable (tends to throw fewer intermittent false failures)
Easier to read code (handles promises gracefully)
Cannot switch between browser tabs
Cannot switch to iFrames
Cannot specify clicks or keypresses explicitly as if a real user was interacting
Cannot move the mouse to specific co-ordinates
Sometimes has trouble switching between different top-level domains, so not good for testing external links
Cypress is a newer tool with less extensive documentation and less community support
More powerful because it is Selenium-based - it can switch between tabs, it can handle external links to other domains, it can handle iFrames, simulate keypresses and clicks, and move the mouse to specific co-ordinates within the browser.
More extensive community support and documentation
Slower and more brittle - in general there is a higher likelihood of cryptic and/or intermittent errors which may cause your tests to fail even though there is nothing wrong with your application
For highly experienced automation engineers, the fundamental "brittle" nature of Selenium can be worked around - it can be reliable but only if you really know what you are doing
Less graceful handling of promises - relies on async/await or .then to manage the order of execution. Therefore it is a bit harder to read the code.
Harder to set up, and the method of setup impacts its reliability. For example, a hub/node configuration where the selenium jar is on a different physical machine than the browser under test will cause unreliability in your tests. Not everyone knows about this type of thing, so it's common to find Selenium frameworks that are set up poorly.
It's probably better to use Cypress if
you're at a smaller company and have a close relationship with developers who can help write hooks or stubs in their code to assist your testing
you don't need to do things like switch between tabs or test links to external top-level domains
It's probably better to use Protractor if
You might need to switch between tabs or test external links to other domains within the scope of your framework
You want to use a more accurate simulation of how a real user interacts with a browser (i.e. click at this location, type these keys)
You're at a company where you won't have any support from developers in writing hooks or stubs to make their code more testable in a less powerful framework like Cypress
Please try Handow, the e2e tool basing on Puppeteer.
Gherkin syntax compatible
Chrome/Chromium orentied, driven by Puppeteer engine
Create test suites rapidly without coding (or a little bit), basing on built-in steps library
Schedule test with plans and arrange stories with sequential stages
Fast running, execute story groups in parallel by multi-workers
Built-in single page report render
Cover page view, REST API and cookies test
Protractor or Cypress for ionic-angular?
We have a huge ionic-angular app with almost 100 pages and 10+ injectables. There are no tests written yet. Before we start, we need some suggestions about the framework. Would you suggest Cypress or Angular's Protractor with Jasmine / Karma for a heavy ionic app with Angular?
I work with two angular applications, one of them i already created a framework based on protractor. The other one i think using cypress instead of the protractor, the reason for that is the protrator will be deprecated at the end of the year. That reason for me is enough to select cypress as the better approach once it has a huge and increasing community and its downsides have been solved with time.
Makes sense, thank you for your suggestion :)
Hi Sai, Amir from the Cypress team here.
Angular team recently announced the deprecation of Protractor, so it's not a viable option for new projects or projects that have no tests.
Cypress can definitely help your team test your Ionic app, regardless of the size of the app. If you are using the Angular CLI, you can easily get started with the Cypress Angular Schematic: https://www.npmjs.com/package/@cypress/schematic
Please check Cypress limitations before investing in it. Look like cypress can't handle switching to multiple TABs, cross browser testing and switching to different domains.
cross-browser testing against 30+ browsers is possible with Cypress Automate through Browserstack
Agree handling multiple tabs is not supported but there are work arounds
Trade offs are clearly mentioned under cypress documentation https://docs.cypress.io/guides/references/trade-offs#Multiple-tabs
Hope this helps.
My main concern is:
- Browser support - Desktop - needs to support Google Chrome, Safari, Firefox and Microsoft Edge (minimum)
- Browser support - Mobile - Safari and Chrome (minimum)
- App - Android and iOS
If possible i would like to avoid using another tool for mobile (like Appium)
What do you use? What is the one you recommend (even another from the ones mentioned)
Thank you very much for your help!
Hello João Pires,
From my experience using API and Framework tests tools like Selenium Webdriver, CodeCeptJS, and Cypress I never ever see a unique test repository that can work over Web system and Native Mobile app. Many times, it is tried to use the same test suite to two kinds of app, a web, and native mobile app, and then the test flow is mapped using different selectors to both apps and conditional code are add growing the complexity of tests. Definitely, it is not a good practice.
I see great potential in using Cypress to modern web apps running on browsers to desktop or mobile. However, how your second point is to run on mobile browsers like Safari and Chrome may be a good approach will be using a service of Cross Browser as BrowserStack or SourceLabs.
It is important to have clear if is relevant run while tests to many browsers in the same platform. If the goal is to guarantee the e2e flow from an integrated environment, use the most popular browser to users can be enough. (ps: 80% of users use Chromer and just only 30% of users use Safari.)
From a Mobile perspective, I believe that today there are more efficient test approaches to guarantee the behaviors of the components of isolated way than using some technology base on Selenium. As per example an instrumentation-based API using Espresso. Just only using Appium for E2E critical scenarios.