Cypress Firefox

It’s been more than two years since we last evaluated Cypress vs Selenium WebDriver, and as we all know, a lot can happen in two years.

Or Firefox Developer/Nightly Edition: cypress run -browser firefox:dev cypress run -browser firefox:nightly To run Firefox in the headless mode, you can pass the –headless argument to cypress run. By default, Firefox will launch in headed mode. Similar for Microsoft Edge: Microsoft Edge (Chromium-based): cypress run -browser edge. Cypress is the new standard in front-end testing that every developer and QA engineer needs. Recently a new major version of Cypress was released: 4.0.0. The biggest change in this release is the cross-browser support. Info: Cypress 4.0.0 release notes - changelog. This change means that Cypress now allows you to test in Chrome, Firefox, Microsoft Edge, and more. These are the three major browsers that we currently support. Run your Cypress tests. A quickstart guide to running your Cypress tests across 30+ desktop browsers. Running your first Cypress test suite on BrowserStack is super easy - just install our CLI, configure the test run settings and start testing. The Firefox dedicated cypress/run job will run a subset of tests in parallel, across 2 machines, defined by the spec parameter, against the Firefox browser and then it will report the result to the Cypress Dashboard under the group named firefox. 'version: 2.1 orbs: cypress: cypress-io/email protected workflows: build: jobs: - cypress.

Since then, Selenium WebDriver has made impressive improvements as they prepare for the major release of Selenium 4, and Cypress has grown from its infancy phase. Let’s see what’s changed!

WebFirefox

Target Audience

Cypress Firefox

In our previous post, we asserted that most of Selenium’s users are testers, while developers seemed to favor Cypress. While this was certainly true in its early days, the popularity of Cypress has increased with testers as well. Cypress has become the most widely used test automation tool amongst our JavaScript users, which comprises mostly of dedicated automation engineers.

My theory for the uptick in the use of Cypress amongst testers is that collaboration is a key factor in tooling. It’s hard enough to get developers to contribute to UI testing, and if Cypress is a way to bridge that gap, then testers are all for it!

Language Support

Since Cypress was designed for frontend developers, it only supports JavaScript – the language of the web. This has not changed since Cypress was released, and it does not seem to be on the product’s roadmap. Consequentially, this puts Cypress at a disadvantage to Selenium which supports JavaScript as well as Java, Python, C#, Ruby, and Kotlin. This gives Selenium a much wider target audience, especially since Java is the most popular programming language for UI testing.

Browser Support

Cypress Firefox Cors

Arguably, the biggest enhancement to Cypress since our last post is its move from Chrome-only to cross browser support!

Cypress’ lack of cross-browser support was a major con for those who needed to test their applications on more than just Chrome. Many Cypress users had to rely on third-party plugins such as Applitools’ Ultrafast Grid to gain test coverage on multiple browsers. However, with version 4 of Cypress, this now opens the possibility of testing on Firefox and Edge as well.

Of course, Selenium WebDriver has always supported Chrome, Firefox, and IE; and has also supported Edge and Safari for years. This gives Selenium an edge in this category for those who need to test on Internet Explorer and Safari (the default browser for iOS devices).

Browser Capabilities

The architecture for Cypress and Selenium varies quite a bit (see our original comparison for the details). Cypress runs tests in-browser while Selenium uses a browser driver. Both of these approaches have their pros and cons.

Cypress tests are faster since there are less processes to call for every browser interaction. However, features such as opening and manipulating multiple tabs and windows is not supported in Cypress. Likewise, Cypress has limited support for working with iframes and requires you to write custom code to be able to do so.

Selenium users do not have to concern themselves with these limitations. Not only are iframes fully supported in WebDriver, but Selenium 4 boasts updated support for multiple windows and tabs.

Server Manipulation

In our previous post, we admired Cypress’ built-in support for mocking and intercepting server requests and responses. At that time, this powerful feature was not available in Selenium. However, Selenium 4 provides a brand new Chrome DevTools Protocol API which enables Selenium tests to not only mock server requests and intercept responses, but to fully leverage all of the possibilities of Chrome DevTools. This is a game-changing feature for Selenium WebDriver!

Which is Better? Selenium or Cypress?

Cypress Firefox Docker

That depends on your needs.

Cypress integrates quite nicely into a given production codebase making it favorable for developers, which therefore fares better for collaboration between developers and automation engineers/testers. Cypress’ architecture also inherently speeds up test execution.

However, Selenium has far more reach and support for browsers, programming languages, and browser capabilities.

If your application is relatively simple and speed and collaboration are the most important factors, then Cypress is a great choice. However, if your application and user journeys are more complex and require extensive testing across multiple platforms, then Selenium would be a better choice.

Extension

I applaud you for reading to the end! Tools have their intended purposes and while multiple tools may seem similar, we shouldn’t be so quick to label one tool as “better” than another. Evaluate any given tool against your requirements to determine which would be the most efficient for your needs.

Cypress Firefox Headless

I’m excited to see the progress in both Selenium WebDriver and Cypress over the last two years. Both are clearly here to stay!