Eran Kinsbruner, an expert in web and mobile apps continuous testing, DevOps and Agile methods, SAST, and a product marketer with a strong GTM vision, talked about the key differences between Selenium and Cypress, their leading capabilities, and the benefits of cross-browser testing using the low-code methods combined in these frameworks.
When talking about web testing, Eran Kinsbruner always looks at it in three dimensions:
- Webdriver protocol (Selenium, Nightwatch, Webdriver.io). These tools are outdated. This is not to say that they are bad, just that they have been used for more than 10 years.
- Chrome Debugger protocol (Puppeteer, Playwright) is more advanced.
- JavaScript in the same browser tab (Cypress). Works with Chrome, Edge, and Firefox on Windows and Mac but does not support Webkit Safari.
Benefits and Use Cases of Cypress
- Runs in the browser. It is a robust asynchronous framework based on javascript, the most popular web app development language.
- Ability to use Stub Navigator APIs. You can receive data from a real-time web app.
- You can make several retries to avoid instability. This will help classify test cases or just ignore them. This is especially true if you want to, e.g., only test scripts on a specific platform: this is easily done using the Cypress configuration file.
- Permissibility of switching test environments. This is problematic to do, e.g., in Selenium.
- Cypress cy.clock and cy.intercept. These network management capabilities can be used to analyze what is happening in your web app in real-time.
- The framework comes with many plugins and also adds visual testing to its functionality. Cypress allows you not only to take a screenshot, but also to analyze the resulting image, and thus take you to a new level of user experience.
- Debugging with browser dev tools. This can be done with plugins that just need to be installed.
- Cypress has continuous integration capabilities. Once you’ve approved your test scripts, you can easily integrate them into Bitbucket, Github, etc.
- API testing capability. Cypress can be used for functional and non-functional testing.
- When used for Code Coverage Analysis, the framework provides a good output report and you can analyze all coverage elements.
- For Accessibility Testing, just install the plugin and you will get a report on your dashboard.
- The framework is also used for component testing, which allows you to fill in the gaps between unit and integration tests.
Selenium 4 Key Features
- Standard W3C implementation for all WebDriver browsers. Can integrate with CDP and block certain content types.
- To move from Selenium 3 to Selenium 4 you will only need to make a few code changes.
- New, intuitive Grid Architecture.
- Support for Relative Locators. You can focus your actions on an element locator based on the relative locator methods.
- Support for Multiple Tabs and Windows. Not supported by Cypress.
It is impossible to choose favor of one of these frameworks unambiguously. You can find something useful for yourself in each of them. Some of the features are available in one but not supported in the other, and vice versa. Therefore, combining these frameworks means creating a strong testing strategy for your web apps.