[BUG] .not.toBeVisible with small timeouts always fails regardless of page content
See original GitHub issueContext:
- Playwright Version: Version 1.25.0
- Operating System: Linux
- Node.js version: v18.10.0
- Browser: Chromium, but probably all
This test ALWAYS fails, regardless of page content:
await expect(page.locator('text=this text does not exist, or it does, there is no difference, the test will fail')).not.toBeVisible({ timeout: 10 })
I think it’s rather obvious that using expect
should perform some work and not just be a no-op (even if the specified timeout is small).
Previous ticket (https://github.com/microsoft/playwright/issues/18815) was closed because there was some confusion about the intent of such code (and also because I wasn’t very precise in my description). The intent of small timeouts is completely irrelevant, the retry logic should not suddenly break just because a smaller timeout is passed. Note that timeouts higher than 10ms seem to be flaky (instead of always failing like it is for 10ms), so I’m not sure what is the usable range of timeouts. 50ms seems to work correctly, while 20ms has about 50% chance of working.
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (5 by maintainers)
Not really, the contract is to respect the timeout. If you don’t care about the timeout or retry, you can just query the state.
I did misunderstand the original request, this one makes it clear, thanks!