Cypress 4: Now Supports Firefox and Edge

With the release of version 4, Cypress is now a cross-browser testing tool. It includes support for Firefox and the new Edge browser.

12th Feb. 2020

As of February 6th, Cypress is now a cross-browser testing tool!! Firefox support has been under development for the best part of two years now whilst support for Edge happened as a result of the new release of the browser.

As with any major release, or sometimes minor (I’m looking at you 3.5.0 😒), there will be breaking changes.

cy.contains() Ignores Invisible Whitespaces

Browsers ignore leading, trailing and duplicate whitespaces. And Cypress now does that, too.

<p>Hello, World</p>
// This should now pass in version 4+
cy.get(‘p’).contains(‘Hello, World’)

// This should now fail in version 4+
cy.get(‘p’).contains(‘Hello,\nWorld’)

Node.js 8+ Only

The minimum version for Node has been bumped up to 8+, however, you should already be at least on the latest LTS version.

Dependencies Update

Some of the underlying dependencies that Cypress uses has also been upgraded. As you can see below, the difference in versions are big, expect some API changes.

NameVersion BeforeVersion After
Mocha2.5.37.0.1
Chai3.5.04.2.0Migration Guide
Sinon.js3.2.08.1.1Migration Guide

Mocha

Calling the done() callback and returning a promise in test will result in an error. This error originates from Mocha itself.

Chai

Version 4.2.0 brings some breaking changes for some assertions.

Assertions that expect numbers will cause them to fail if non-numbers are passed in.

// This will fail
expect(‘text’).to.be.above(5)

Non-existent properties will also now appear as failures.

// Previously, this will pass.
// However, if you were using TypeScript this should not happen.
expect(true).to.be.ture

Sinon.js

Stubbing a non-existent properties of an object will cause the test to fail.

The reset() methods for stubs and spies have been renamed to resetHistory().

const spy = cy.spy()
const stub = cy.stub()

spy.resetHistory()
stub.resetHistory()

Get Started

If you still haven’t tried Cypress yet, here’s a post I wrote that should hopefully help you through.