Rayrun

How do I execute Playwright tests one after another instead of concurrently?

Answer

To run your @playwright/test tests sequentially, you can use the --workers=1 flag when running your test suite. This ensures that each test is executed one after the other, instead of concurrently.

npx playwright test --workers=1

If you prefer using Jest with Playwright, you can utilize the test.concurrent function to specify the order of your tests. This function accepts an array of test cases and executes them sequentially.

For more control over the test order, create a custom script that runs each test file individually in the desired order:

npx playwright test ray.run/tests/file1.spec.ts
npx playwright test ray.run/tests/file2.spec.ts
npx playwright test ray.run/tests/file3.spec.ts

This approach executes each file sequentially in the specified order.

Thank you!
Was this helpful?
Still have questions?

If you still have questions, please ask a question and I will try to answer it.

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