Search code examples
playwright

Prevent Playwright test from timing out after 30 seconds


Is there a way to force Playwright to wait for a specific amount of time, say 15 minutes? I have tried using page.waitForTimeout(900000);, but this throws an error: "Test timeout of 30000ms exceeded". Sometimes, there is no message, just a fail status at the page.waitForTimeout(900000); statement.


Solution

  • It fails because default Playwright timeout is 30 sec. You can change it in the config file or directly in the test. See docs - https://playwright.dev/docs/test-timeouts#test-timeout

    test("Example", async ({ page }) => {
      test.setTimeout(150_000);
    
      await page.waitForTimeout(120_000);
    });