[BUG] WaitFor timeout doesn't work, if it bigger than default global timeout
See original GitHub issueContext:
- Playwright Version: 1.25.2
- Operating System: Linux
- Node.js version: v16.14.0
- Browser: Chromium, WebKit
- Extra: Headless and headed mode
Code Snippet
import {test} from '@playwright/test';
test(`test waiting top limit`, async ({page}) => {
await page.goto('https://playwright.dev/docs/actionability');
await page.locator('.search123').waitFor({state: "visible", timeout: 60000})
});
Describe the bug
playwright.config.ts
doesn’t have any timeout options, so default 30 seconds are taken.
When I’m setting up a bigger timeout than the default for a single action, the test above waits for 30 seconds instead of the expected 60.
Running 1 test using 1 worker
1) [webkit] › tests/testwaitings.spec.ts:3:1 › test waiting top limit ============================
Test timeout of 30000ms exceeded.
locator.waitFor: Target closed
=========================== logs ===========================
waiting for selector ".search123" to be visible
============================================================
3 | test(`test waiting top limit`, async ({page}) => {
4 | await page.goto('https://playwright.dev/docs/actionability');
> 5 | await page.locator('.search123').waitFor({state: "visible", timeout: 60000})
| ^
6 | });
7 |
at file:///Projects/playwright-tests/tests/testwaitings.spec.ts:5:38
Pending operations:
- locator.waitFor at tests/testwaitings.spec.ts:5:38
Additional info:
Debug mode doesn’t have above issue. When running the test with PWDEBUG=1, it waits for 60 seconds.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Exceeded timeout of 5000 ms for a test · Issue #11607 - GitHub
I have started getting this issue: thrown: "Exceeded timeout of 5000 ms for a test. Use jest.setTimeout(newTimeout) to increase the timeout ...
Read more >Message "Async callback was not invoked within the 5000 ms ...
The default timeout value is 5000 (5000 ms - 5 seconds). This will be applicable for all test cases. Or if you want...
Read more >Async Methods - Testing Library
The default timeout is 1000ms . The default onTimeout takes the error and appends the container 's printed state to the error message...
Read more >Tip: change default timeout of `waitFor` in React Testing Library
In React Testing Library, there is no global configuration to change default timeout of waitFor , but we can easily wrap this function...
Read more >Troubleshoot query time-out errors - SQL Server
Assume that an application queries data from a SQL Server database. If the query doesn't return any data within the configured time-out ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If a function has an option to set maximum timeout it’s logical to be able to use it.
Unfortunately, it’s not possible with the current implementation. Decreasing the waiting time doesn’t have logical sense, because
If target element already satisfies the condition, the method returns immediately.
Anyway, thanks for the suggested workarounds.
This is an unsolvable problem, because the scopes are different, one per whole test execution and one for a single statement.
Unfortunately this is not a valid feature request, since this is working as expected and changes to the behaviour would not make logical sense.
So to recap, either increase test timeout for all the tests, use test.slow()/setTimeout for a single test or decrease the waiting time of waitFor.