microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.82k stars 3.67k forks source link

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

Open dik-garri opened 2 years ago

dik-garri commented 2 years ago

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

rwoll commented 2 years ago

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

dik-garri commented 1 year ago

Any updates on this issue?

Kamal-Yalikun commented 1 year ago

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

eatonjl commented 1 year ago

I'm hoping for this functionality as well.

FrankNutreco commented 1 year ago

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

Terence625 commented 9 months ago

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

younesjallouli commented 9 months ago

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

FrankNutreco commented 9 months ago

@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.

younesjallouli commented 9 months ago

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.

Terence625 commented 9 months ago

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.

younesjallouli commented 8 months ago

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

zargham-leanix commented 8 months ago

@mxschmitt any update on this ?

michaeljoshuaclaro commented 8 months ago

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.

elyamurza commented 7 months ago

+1, feature would be helpful.

Estegar commented 7 months ago

+1

akash-k-cs commented 2 months ago

+1

younesjallouli commented 2 months ago

@yury-s @mxschmitt @pavelfeldman Please some update :D