How do I add delays between test runs in Playwright during CI/CD pipelines?


Adding Delays Between Test Runs in CI/CD

To introduce a delay between test runs in CI/CD using @playwright/test, you can adjust the timeout property. This property sets the maximum timeout in milliseconds for each test and defaults to 30 seconds. You can modify the timeout value in the playwright.config.ts file or pass it as a command-line argument using --timeout.

For example, to add a 5-second delay between test runs, increase the timeout value to 35 seconds (30 seconds for the test run + 5 seconds for the delay):

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  timeout: 35000,

export default config;

Alternatively, you can use Playwright's retry mechanism to introduce delays between retries, effectively adding delays between test runs. Set the maximum number of retries using the retries property in the configuration file or by passing it as a command-line argument with --retries.

Another option is to use the repeat-each command-line argument, which repeats each test multiple times before moving to the next one. By setting this value greater than one, you introduce delays between each repetition of an individual test:

npx playwright test --repeat-each=2

By combining these options based on your requirements, you can achieve the desired behavior of adding delays between test runs during CI/CD pipelines.

Thank you!
Was this helpful?
Still have questions?

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

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.