# How to Change Timeout Settings in Playwright

Playwright offers a variety of timeout configurations for different operations.
The standard timeout for each test is set to 30 seconds, and for each assertion,
it's 5 seconds.

Encountering errors like the ones below could indicate that your timeout
settings may require adjustments:

```text
example.spec.ts:3:1 › sample test ===========================

Timeout of 30000ms exceeded.
```

```text
example.spec.ts:3:1 › sample test ===========================

Error: expect(received).toHaveText(expected)

Expected string: "my text"
Received string: ""
Call log:
  - expect.toHaveText with timeout 5000ms
  - waiting for "locator('button')"
```

To alter the default global timeout for all tests, do the following:

```javascript
[label playwright.config.js]
import { defineConfig } from '@playwright/test';

export default defineConfig({
  timeout: 60 * 1000, // 60 seconds
});
```

Similarly, to modify the default global timeout for expect assertions, use this
approach:

```javascript
import { defineConfig } from '@playwright/test';

export default defineConfig({
  expect: {
    timeout: 10 * 1000, // 10 seconds
  },
});
```

For adjusting the timeout of a single test, apply the following methods:

```javascript
import { test, expect } from '@playwright/test';

test('slow test', async ({ page }) => {
  // Triples the test timeout (90 seconds by default)
  test.slow();
});

test('really slow test', async ({ page }) => {
  // set timeout to 120 seconds
  test.setTimeout(120 * 1000);
});
```

Likewise, you can change the timeout for a specific assertion like this:

```javascript
import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await expect(page.getByRole('button')).toHaveText('Sign in', {
    timeout: 10000,
  });
});
```

Playwright also allows for customization of timeout settings for actions,
navigation, test hooks, and the overall test suite. Comprehensive details can be
found in the
[test timeout documentation](https://playwright.dev/docs/test-timeouts).


Thanks for reading, and happy coding!

[summary]
## 🔭 Want to automate and scale your Playwright end-to-end tests?
Head over to [Better Stack](https://betterstack.com/website-monitoring) and start monitoring in 5 minutes.
[/summary]

[ad-uptime]