I have my suite set up to run against 4 browsers using 3 workers (2 desktops and 2 mobile) I have a test that I need to either not run in parallel or limit to just run in one desktop browser.
Is that possible?
The reason I need to do this is that the test is triggering an event that can take a few seconds to run, when running nobody else can start this event so if 3 tests are running at once only the first one can pass. Also, on mobile, you can't trigger the event, so I skip parts of the test if isMobile is true.
Ideally, I'd like to just run this test in Firefox and leave the rest of the suite running in 3 workers with 4 browsers.
I looked at test.describe.configure({ mode: 'serial' }); but that doesn't seem to make a difference I still see
Running 4 tests using 3 workers
when I try just running this single spec file.
There are actually multiple ways to conditionally skip tests based off a condition like browserName being Firefox - which one you might choose depends on your goal, setup, and/or criteria:
test.skip
Based on what I understand to be your ideal setup and having just the one test within one file, I would probably recommend the whole file skip, so that not only would any beforeEach not run, but also any custom fixture setup required by the test wouldn’t run I imagine either. So something like the below before your test:
test.skip(({ browserName }) => browserName !== 'firefox');
And in the chance one of your mobile browsers is also Firefox, may need the isMobile check too. (Or actually, since apparently isMobile is not supported by Firefox, could probably check the hasTouch option instead)
Of course, choose whichever approach works best for you and your tests!
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With