Timeouts | Bondar Academy
Course: Playwright UI Testing with TypeScript
Module: Locators and Assertions
Instructor: Artem Bondar
Lesson Summary
This lesson focuses on the timeout system in Playwright , which is crucial for managing test execution durations effectively. Playwright employs a three-layer architecture for timeouts, consisting of: 1. Global Timeout The global timeout is the maximum time limit for the entire test suite execution. By default, it is not configured. You can set this timeout to limit how long your tests can run across multiple spec files. 2. Test Timeout The test timeout specifies how long a single test can run, with a default setting of 30,000 milliseconds (30 seconds). This timeout is nested within the global timeout. If a test takes longer than this limit, it will fail. 3. Action, Navigation, and Expect Timeouts Action Timeout: The maximum time limit for action commands (e.g., click ). If not configured, it defaults to the test timeout. Navigation Timeout: Relates to how long it takes for the application to load. It is not configured by default but can be set independently. Expect Timeout: The timeout for locator assertions, defaulting to 5 seconds . It cannot exceed the test timeout. To configure these timeouts, you can modify the Playwright configuration file. Key practices include: Setting appropriate values for action and test timeouts to avoid unnecessary waits. Using test.setTimeout to adjust timeouts for specific tests. Utilizing test.slow to increase the timeout for flaky tests. In summary, understanding and configuring the timeout system in Playwright is essential for efficient test execution and management.