playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] Allow both, parallel and ordered test execution at the same time

Open dik-garri opened this issue 2 years ago • 17 comments

As a playwright user, I want to be able to run some spec files in parallel and some in a specific order at the same time. I have a situation when I have a lot of spec files and some of them depend on others. Currently, I turned off parallel execution workers: 1 but it increases time on all tests execution a lot

dik-garri avatar Sep 23 '22 11:09 dik-garri

There's an open PR that is on the way to addressing this: https://github.com/microsoft/playwright/pull/17548

rwoll avatar Sep 23 '22 16:09 rwoll

Any updates on this issue?

dik-garri avatar Dec 21 '22 09:12 dik-garri

Are there any updates on this issue? This is a very important feature for our purposes

Kamal-Yalikun avatar Mar 03 '23 17:03 Kamal-Yalikun

I'm hoping for this functionality as well.

eatonjl avatar Mar 20 '23 18:03 eatonjl

Any update on this feature @mxschmitt ? Would very much like this functionality so I have more flexibility in using parallel testing.

FrankNutreco avatar Mar 21 '23 15:03 FrankNutreco

Upvote to this feature, and wonder why PR https://github.com/microsoft/playwright/pull/17548 is removed

Terence625 avatar Jan 29 '24 04:01 Terence625

Same here, we really need this one.

Today there is no way to tell playwright, run these test files sequentially, but inside each test file, go full steam and run tests in parallel.

image

younesjallouli avatar Jan 31 '24 03:01 younesjallouli

@younesjallouli Have you tried the following?

In the playwright.config.ts file you can set the dependencies: image

In the package.json file you can set the following: image

When running your tests, you can set the workers: npm run tests:exampleTests -- --workers 4

These test files will be run in sequential order: setup, CreateExampleA, CreateExampleB, CreateExampleC

These test files will be run in parallel: UpdateExampleA, UpdateExampleB

Inside each test file you can set .parallel to run testcases within a test file in parallel (or decide not to add .parallel for sequential running of testcases within a file).

Downside to this method is when you have a file that has to be ran in sequential order and also contains testcases that cannot be run in parallel, since it will only use one worker and slows down the total run speed.

FrankNutreco avatar Jan 31 '24 08:01 FrankNutreco

I don't think this is the solution I was hoping for. To give context: to test our SaaS app, we have multiple tests across multiple files, and we run these tests in parallel on multiple workers. However, you need to create some objects in previous tests, before moving on to the next tests (like testing registering a payment method, before testing the creation of a payment, before testing a refund of that payment). We do not believe in loading data in the DB and maintaining those scripts.

In an ideal world, there should be a mode in Playwright that tells Playwright to run files sequentially (create payment method first, then create payments, then ...) without even having to specify the test file names in the config files. Even if workers become available playwright should not pick up tests from the following file until the current file is 100% done.

younesjallouli avatar Feb 04 '24 15:02 younesjallouli

I don't think this is the solution I was hoping for. To give context: to test our SaaS app, we have multiple tests across multiple files, and we run these tests in parallel on multiple workers. However, you need to create some objects in previous tests, before moving on to the next tests (like testing registering a payment method, before testing the creation of a payment, before testing a refund of that payment). We do not believe in loading data in the DB and maintaining those scripts.

In an ideal world, there should be a mode in Playwright that tells Playwright to run files sequentially (create payment method first, then create payments, then ...) without even having to specify the test file names in the config files. Even if workers become available playwright should not pick up tests from the following file until the current file is 100% done.

I believe I have the same situation as you here: https://github.com/microsoft/playwright/issues/29282. I was using serial mode, but it's not recommended, maybe you can try this solution https://github.com/microsoft/playwright/issues/29282#issuecomment-1920505421, I'm using project dependencies for multiple applications.

Terence625 avatar Feb 04 '24 21:02 Terence625

Any news on @dik-garri 's request playwright team? @yury-s @mxschmitt @pavelfeldman

This feature is a no-brainer for me. It was asked many times by the community

younesjallouli avatar Mar 05 '24 11:03 younesjallouli

@mxschmitt any update on this ?

zargham-leanix avatar Mar 06 '24 23:03 zargham-leanix

I don't think this is the solution I was hoping for. To give context: to test our SaaS app, we have multiple tests across multiple files, and we run these tests in parallel on multiple workers. However, you need to create some objects in previous tests, before moving on to the next tests (like testing registering a payment method, before testing the creation of a payment, before testing a refund of that payment). We do not believe in loading data in the DB and maintaining those scripts.

In an ideal world, there should be a mode in Playwright that tells Playwright to run files sequentially (create payment method first, then create payments, then ...) without even having to specify the test file names in the config files. Even if workers become available playwright should not pick up tests from the following file until the current file is 100% done.

I agree, I wish playwright would have that feature wherein we can prioritize a test first before running another set of tests.

michaeljoshuaclaro avatar Mar 07 '24 05:03 michaeljoshuaclaro

+1, feature would be helpful.

elyamurza avatar Mar 18 '24 22:03 elyamurza

+1

Estegar avatar Apr 09 '24 08:04 Estegar