Running tests across multiple browsers in playwright

Hi folks,

Fairly new to this tool, so apologies if this is a silly question or a duplicate!

I’m trying out CodeceptJS to wrap playwright tests. One of the huge benefits of playwright is of course the easy cross browser testing, and how it can easily run a batch of tests across chromium, firefox and webkit in one command.

I don’t see a simple way to do that in CodeceptJS. I’ve managed to setup switching the browser based on passing through the profile when you run the tests, and can then run the whole suite three times on each browser, and I can even chain commands to do that sequentially. But it does mean reporting-wise that I will end up with three separate reports to analyse, and doesn’t feel quite right.

I’m hoping I am missing something here, possibly to do with run-multiple? Or has anyone configured this in a better way?

Thanks,

Paul

To do what you want, you can do the folllowing:

in codecept.conf.js add this node after ‘helpers’:

multiple: {
  localcombo: {    
    browsers: [
      { browser: 'firefox'},
      { browser: 'webkit'},
      { browser: 'chromium'}
    ]
  }
},

NOTE: ‘localcombo’ is just an example grouping name.
– it could be any grouping name

then at command line run:

npx codeceptjs run-multiple <grouping name e.g. localcombo> --steps

Hope that gets you what you’re looking for.

1 Like

That’s exactly what I’m after! Thank you!

Paul

Is it possible to use emulate with this? For example, {browser: 'chromium', emulate: devices['Pixel 2']}?

This seems to work in the main helpers config, but not in multiple.

Thanks!

Thanks, I tried and it works too, and work for emulate as well, nice :slight_smile: