Rayrun
← Back to Discord Forum

Is there a way to run tests and assign specific user to a worker process?

Hello, Let's assume I am automating a webpage. The webpage has some sort of a protection in some views that session might end, if user has opened 2 browser windows and do some specific actions in both of the windows. There is a chance that, for example, saving might not work if worker 1 is in specific form and has filled the data but worker 2 attempts to save the data. I could run tests sequentially (with 1 worker) to solve the problem but test execution time might increase dramatically. I could create more test accounts and take them randomly to minimise risk to face such failures in tests. Let's say, I am running tests on 5 workers. Is there a way to run tests and assign specific user to a worker? worker 1 will use user1, worker 2 will use user2 and so on. Thanks for any advice in advance!

This thread is trying to answer question "Is there a way to run tests and assign specific user to a worker process?"

3 replies

I have a related problem I'd like to solve, in that we are creating a new user per test which seems wasteful & time consuming. I've had an idea this week that maybe project dependencies could help to just create a user once, then run the relevant tests. I've not tried it yet but I can't see why it wouldn't work. Here's more detail https://playwright.dev/docs/test-projects. Maybe it could help with your situation? Just an idea 💡

sandis9236
sandis9236

I did something similar to this. Solved the problem - https://playwright.dev/docs/auth#moderate-one-account-per-parallel-worker

This is great, thanks for sharing. Ill have a play too. Glad you sorted it 👍

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].