Reputation: 109
I am attempting to write a test to cover the 'create account' process of our software. The problem I'm running into is that once an account is created an account with the same credentials cannot be created again. I can delete the account during test teardown, however, since our test suite is set up to run tests in parallel with multiple browsers, the firefox, chromium and webkit tests will all run at the same time causing a race condition. Only one will pass and create an account, then the other browser tests will fail.
Is there any way in playwright to force a specific test file to run in each browser sequentially so I can avoid this race condition? There is a way to disable parallelism between test cases in a single file, however, I would need to whole file to be run in only one browser at a time.
My workaround would be to set up different account credentials for each browser we'd like to test and detect which browser each test context is using to adjust the credentials used, but I am wondering if there is a way to do this without having to resort to that.
Upvotes: 2
Views: 805
Reputation: 4207
Add timestamp to strings to make them unique while entering :
await page.getByRole('textbox').fill(Str+ Date.now());
This way you don't need to change anything on playwright level.
Upvotes: 1