Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Cypress 5.x Adds Test Retries and Shadow DOM Support

Cypress 5.x Adds Test Retries and Shadow DOM Support

This item in japanese

Cypress, a browser-based test runner and dashboard, recently introduced native support for test retries in the Cypress 5.0 release, helping developers avoid intermittent test failures. Other recent Cypress advances include networking stubbing and shadow DOM support.

As explained by Ben Hong, senior developer experience engineer at Cypress,

In the course of an end-to-end (E2E) test run, it is fairly common for tests to fail intermittently due to integration dependencies temporarily going offline, random network failures, race conditions, etc.. And just like how you would expect a user to refresh their browser if they got a 404 error, it seems like a waste to fail an entire test run due to a random outage.

The Cypress team provides a guide to migrating to version 5, including information to enable test retries, a change in the name for whitelisting cookies and blocking various hosts during tests, and other dependency updates including blobs, Node.js, and TypeScript.

Since the 5.0 release, Cypress 5.1 introduces experimental network stubbing support, and Cypress 5.2. adds shadow DOM support.

Cypress was originally only available for Chrome and Chromium-based browsers, though beta support is also available for Firefox.

Cypress' founders created it after frustration in working with testing tools like Selenium. While Selenium runs commands outside the browser and remotely over the network, Cypress executes commands in the same loop as a web application. Cypress is then backed by a Node.js process that communicates, synchronizes, and performs tasks.

Cypress supports end-to-end, integration, and unit tests. Cypress provides time travel testing, capturing snapshots as tests execute. Cypress also touts easy debuggability using browser-based developer tools. Other features of Cypress include automatic waiting, spies, stubs, clocks, network traffic control.

Cypress is open source software available under the MIT license. Contributions and feedback are encouraged via the TypeScript GitHub project and should follow the Cypress contribution guidelines and code of conduct. Beyond the test runner, Cypress optionally provides a commercial testing dashboard service.

Rate this Article