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.

12 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.

Similar Posts

Cypress Part I: Getting Started

In this new series, we look at how we could include Cypress as part of our testing strategy for our single page applications.

15 Nov 20195-minute read

Cypress Part II: Configuration

Now that we have added Cypress to our existing SPA, let's have a look at overriding the default configurations.

04 Dec 20192-minute read

Typescript 3.7

The new version of TypeScript has been released and with it comes optional chaining as well as nullish coalescing!

05 Nov 20191-minute read