How to Do Cross Browser Testing in Cypress

How to Do Cross Browser Testing in Cypress

Ferenc Almasi β€’ 2021 December 06 β€’ Read time 1 min read
  • twitter
  • facebook

To do cross-browser testing in Cypress, we can pass in the required browser to a describe or an it block using the browser flag in the following way:

Copied to clipboard! Playground
// Passing for describe:
describe('Features on Firefox', { browser: 'firefox' }, () => {
   it(...);
   it(...);
});

// Passing for it:
it('Should work perfectly in Chrome', { browser: 'chrome' }, () => {
    ...
});

We can also exclude certain browsers by negating it with an exclamation mark, for example, to exclude Chrome, we can say:

Copied to clipboard!
it('Should skip Chrome', { browser: '!chrome' }, () => {
    ...
});

The browser flag can accept the same arguments as Cypress.isBrowser can take on.

Want to learn Cypress from end to end? Check out my Cypress course on Educative where I cover everything:

Learn Cypress with Educative
How to Do Cross Browser Testing in Cypress
If you would like to see more webtips, follow @flowforfrank

Resources:

  • twitter
  • facebook
Did you find this page helpful?
πŸ“š More Webtips
Mentoring

Rocket Launch Your Career

Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies:

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.