Cypress
2 minutes read

Cypress.io announced that with v4.0, Mozilla Firefox and Microsoft Edge (Chromium based) browsers are supported.

Have a look how to get started with Cypress in less than 30 minutes.

Cypress

This update is quite huge for the software testing community, since the other competitor of Cypress.io, TestCafe was supporting Firefox and Edge browsers for a while now.

Check the full comparison between Cypress and TestCafe.

Running Tests in Firefox

All you need to do is to have Firefox installed on the machine from where you are running the tests:


cypress run --browser firefox

or


"scripts": {
  "cy:run:chrome": "cypress run --browser chrome",
  "cy:run:firefox": "cypress run --browser firefox"
}

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

Or Microsoft Edge Canary (Chromium-based):


cypress run --browser edge:canary

Running Specific Tests by Browser


// run Cypress tests only in Firefox
runOn('firefox', () => {
  describe('test suite', () => {
    it('...')
    it('...')
  })
})

Ignore tests if Cypress tests run in Firefox


// not recorded in Cypress Dashboard
ignoreOn('firefox', () => {
  it('test', function() {
    // ... test assertion
  })
}

Skipping tests is different than ignoring tests, since when a tests a skipped it’s still displayed in the test result reports:


// Skip the test, but still record it to the Cypress Dashboard
it('a test', function() {
  if (!Cypress.isBrowser('edge')) {
    this.skip()
  }
  // ... test body
})