question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] .not.toBeVisible with small timeouts always fails regardless of page content

See original GitHub issue

Context:

  • 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:closed
  • Created 10 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pavelfeldmancommented, Nov 17, 2022

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.

1reaction
pavelfeldmancommented, Nov 16, 2022

I did misunderstand the original request, this one makes it clear, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does jest-dom give the error "TypeError: expect(...).not ...
I tried using jest-dom to specifically use their toBeVisible function. Despite following the documentation I cannot get it to work in my test ......
Read more >
Making Content Usable for People with Cognitive and ... - W3C
It gives advice on how to make content usable for people with cognitive and learning disabilities. This includes, but is not limited to: ......
Read more >
2080-UM002M-EN-E Micro830, Micro850, and Micro870 ...
and a “not enough memory” error message will appear. Do not use RMC if you ... 10K Event Logging on page 119), regardless...
Read more >
RFC 3261 SIP: Session Initiation Protocol - IETF
Standards Track [Page 1] RFC 3261 SIP: Session Initiation Protocol June 2002 ... If the other party does not accept the change, he...
Read more >
Changelog — Python 3.11.1 documentation
gh-64490: Fix refcount error when arguments are packed to tuple in ... to always feed the function data in increments smaller than 4GiB...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found