← Back to Discord Forum

Playwright test execution order

altamashaliposted in #help-playwright
Open in Discord

Hi all, I have total of 6 playwright tests and i want to execute them in this order:

  • Execute **Test 1 **in serial mode ( no other tests should run parallelly when it is running )
  • All other remaining test should run in parallel when first test is completed.

How can i implement this with playwright nodejs?

Thank you in advance 🙏

This thread is trying to answer question "How can I execute Playwright tests in a specific order, with one test running in serial mode and the rest running in parallel mode?"

7 replies

Thank you .


@_xotabu4 I am not able to understand how to implement above test order using test.describe.configure function.

But I have another approach in mind. What about if I run my first test in beforeAll hook and then run all tests in parallel mode. Is this an anti pattern to run a test in beforeAll hook?

@altamashali yes, that will break your reporting, disable possibility to use fixtures, retries, preconditions and so on.

test.describe.configure({ mode: 'serial' });
test('runs first', async ({ page }) => {});
test('runs second', async ({ page }) => {});

@_xotabu4 yes i understand above code will run serially. But my usecase is after first test, all other tests can be run in parallel mode instead of serial. If i have set number of workers as 3 in playwright.config.ts file and my all tests are in a different files, then how can i ensure tests 2...6 run only (in parallel) when test1 is finished. Can we add a test (test 1 in my case ) as dependency for other tests?

Then i would setup Projects -> Dependencies -


And set your file that should run serial as dependency for other tests


Looks good for my usecase. Will try implementing the same. Thank you very much ❤️

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 luc@ray.run.