playwright
playwright copied to clipboard
[Feature] Have the ability to set workers count on a per project basis
Would it be feasible to make the workers count be configurable on a per project basis?
My use case is that I'm have a project as a dependency which does various setup tasks. The main thing it does is stores login state and then creates some data via a few api calls. Our application uses Auth0 for authentication and because of this there are rate limits on the number of logins within a minute for the same user.
I currently have my workers set to 10 on my laptop, eventually when this goes into CI/CD it'll be running many more. I login once per project and we have 18 projects defined (19 including the setup project). 10 workers in parallel is a good number for the setup project because the length of time it takes to do the login and the api calls means that I never get rate limited.
Obviously setting the workers to 10 does not make my tests scalable in CI/CD but at the same time, setting the workers to a much greater number also does not help as I'll then be rate limited with the authentication.
By being able to specify a global number of workers and then override this number on a per project basis would be very handy. The alternative is to move everything back into a global-setup file which I don't really want to do if I don't have to.
We would also like this feature, reason: our projects are separated by regions and users have session limitations, so logging in with the same user twice as would inadvertently happen if on the global level workers>1 would fail some other tests, we can't control the test data so we need to use the given test users, ideally by specifying inside each project worker:1, but current workaround is that we are running "concurrency" by executing X containers concurrently in Jenkins where X is the amount of regions in test.
We would also like this feature! We see projects as composable 'slices' of config so supporting more options (especially workers) would be great.
If you have a project that connects to a single Android device, it seems to be the best option to set workers to 1 to execute tests one by one. It would be great if we could configure it on the project level.
This feature would be very useful to us.
We have some tests that write to the database and these tests should never run at the same time. They should run with workers = 1.
Other tests don't write to (but do read from) the database. The more of them running together, the better. For performance.
Upvote. I would like to create one repository for the whole application. The project would not only be other browsers but a real part of apps. But those parts have completely different structures/specifics. Two workers are max in one project, but I can double it in the other.
I would like this even more on a file level:
test.describe.configure({ workers: 1 });
That would make it possible to have some destructive tests in a file marked with workers: 1 to be used in any project and be confident that it will never run together with another test.
that would really be useful for us, we have a small amount of test files with tests which check a documents signing behaviour and should run sequentially, other tests may run in parallel. Specifying workers count per test file would really help
I would like this even more on a file level:
test.describe.configure({ workers: 1 });That would make it possible to have some destructive tests in a file marked with
workers: 1to be used in any project and be confident that it will never run together with another test.
that would really be useful for us, we have a small amount of test files with tests which check a documents signing behaviour and should run sequentially, other tests may run in parallel. Specifying workers count per test file would really help
Same for us. Some Tests (Testfiles) are independent/randomized so they are not disturbing each other. However, the reality is that some tests must run only on one (the same) worker sequentially. Maybe another wording would be: "Pinned to worker#1".
Also such a simple line is easier to communicate/teach in a team.
Upvote
Up vote
Up vote
Up
Up
Up vote
Up
up vote!
up
definitely UP 😃
I would like this even more on a file level:
test.describe.configure({ workers: 1 });That would make it possible to have some destructive tests in a file marked with
workers: 1to be used in any project and be confident that it will never run together with another test.that would really be useful for us, we have a small amount of test files with tests which check a documents signing behaviour and should run sequentially, other tests may run in parallel. Specifying workers count per test file would really help
Same for us. Some Tests (Testfiles) are independent/randomized so they are not disturbing each other. However, the reality is that some tests must run only on one (the same) worker sequentially. Maybe another wording would be: "Pinned to worker#1".
Also such a simple line is easier to communicate/teach in a team.
FYI I think you may be able to get away with
setup.describe.configure({ mode: `serial` });
up
up
Up
up
Another option that would work well for us would be to be able to specify a (dynamic; see #32365) limit on worker fixtures themselves, so that a worker fixture is only ever used on N number of workers at the same time (limiting the number of concurrent Android emulators, VM:s or whatever).
But this might just make things unnecessarily complicated. A per-project worker config would be good enough.
We also have a case in which workers per project will be super beneficial. We wanted to set two projects:
- P1 - order dependent tests. Those are actions that have strict executions order. - set up with 1 worker.
- P2 - order independent tests. - set up with more workers .
Currently, we have no workaround at all for this problem.
Hello, for information I made a solution (with GitLab but may be similar with GitHub) using script to launch wanted tagged feature file to be run with 1 worker while other use X worker. A bit tricky but it work fine, and you can add multiple tag to it 👌🏻
On Wed, Sep 4, 2024 at 08:42 Hagop Shishmanyan @.***> wrote:
We also have a case in which workers per project will be super beneficial. We wanted to set two projects:
- P1 - order dependent tests. Those are actions that have strict executions order. - set up with 1 worker.
- P2 - order independent tests. - set up with more workers .
Currently, we have no workaround at all for this problem.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/playwright/issues/21970#issuecomment-2328040072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJFCGBRLTCKOVNVYGLERNLZU2TTXAVCNFSM6AAAAAAWHBEV26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRYGA2DAMBXGI . You are receiving this because you commented.Message ID: @.***>
I would like this even more on a file level:
test.describe.configure({ workers: 1 });That would make it possible to have some destructive tests in a file marked with
workers: 1to be used in any project and be confident that it will never run together with another test.
This would be really helpful for us
Would it be feasible to make the workers count be configurable on a per project basis?
My use case is that I'm have a project as a dependency which does various setup tasks. The main thing it does is stores login state and then creates some data via a few api calls. Our application uses Auth0 for authentication and because of this there are rate limits on the number of logins within a minute for the same user.
I currently have my workers set to 10 on my laptop, eventually when this goes into CI/CD it'll be running many more. I login once per project and we have 18 projects defined (19 including the setup project). 10 workers in parallel is a good number for the setup project because the length of time it takes to do the login and the api calls means that I never get rate limited.
Obviously setting the workers to 10 does not make my tests scalable in CI/CD but at the same time, setting the workers to a much greater number also does not help as I'll then be rate limited with the authentication.
By being able to specify a global number of workers and then override this number on a per project basis would be very handy. The alternative is to move everything back into a global-setup file which I don't really want to do if I don't have to.
Curious on how you are authenticating per project, is it through dependency?
I would like this even more on a file level:
test.describe.configure({ workers: 1 });That would make it possible to have some destructive tests in a file marked with
workers: 1to be used in any project and be confident that it will never run together with another test.
Upvote upvote!! This will reduce 10-15 dependency files for us. Very helpful. Any update?
Would be really useful to have this config per project e. g. in playwright.config.ts. E.g if we have several envs and on one of the we want to run tests with workers=1, while on other projects we can run tests in parallel. { name: 'webkit', workers: 1, use: { ...devices['Desktop Safari'] }, }