Timeouts | Bondar Academy
Course: Playwright UI Testing with TypeScript
Module: Locators and Assertions
Instructor: Artem Bondar
Lesson Summary
This lesson focuses on timeouts in Playwright, explaining their types and configurations. Understanding timeouts is essential for creating stable and reliable tests. Types of Timeouts Global Timeout: The total time limit for all tests in a suite. If exceeded, all tests terminate. Test Timeout: The time limit for a single test execution, defaulting to 30 seconds . Action Timeout: The limit for executing action commands (e.g., click ), which cannot exceed the test timeout. Navigation Timeout: The time allowed for navigating to a page, also limited by the test timeout. Expect Timeout: The limit for locator assertions, defaulting to 5 seconds . Configuring Timeouts Timeouts can be configured at different levels: Globally in playwright.config.ts using timeout . Individually for tests using test.setTimeout() . For specific actions by providing a timeout in the command. Examples of Configuration timeout: 10000 // 10 seconds globalTimeout: 60000 // 60 seconds use: { actionTimeout: 5000, // 5 seconds navigationTimeout: 5000 // 5 seconds } Additionally, you can use test.slow to increase the timeout for flaky tests and modify timeouts for a test suite using a beforeEach hook. In summary, Playwright's timeout system includes a hierarchy of timeouts, with the ability to configure and override them at various levels to ensure effective test execution.