Run a Cypress test in all browsers besides Firefox?

Answered
looper003 asked this question 2 months ago
looper003 on Mar 14 · Edited

I need to run a specific Cypress test in each browser besides Firefox.

So, when Cypress is using Firefox as the browser it runs tests in, this specific test would not be ran.

In my Cypress code, I could then do something like this:

if (!firefox) {
  // run the test
}

How can I do this in Cypress?

3 suggested answers
tweetybird 17 days ago

You can get the name of the current browser being used by Cypress via Cypress.browser.name. This will return a browser name in the "firefox", "chrome", "electron", etc. format.

To only run a test in browsers that are not Firefox, you can do this:

if (Cypress.browser.name !== "firefox") {
  // run the test
}
0 replies
coderguy 17 days ago

You use the Cypress.browser.name value.

const isFirefox = Cypress.browser.name === "firefox"
0 replies
nick 16 days ago

Cypress has @cypress/skip-test NPM package you can use for this.

It provides a skipOn() method you could use to skip Firefox:

it('skips on Firefox', () => {
  skipOn('firefox')
})
0 replies
Answered