feat(locator): warn when deprecated timeout is passed to isVisible/isHidden#40028
Closed
aydinomer00 wants to merge 1 commit intomicrosoft:mainfrom
Closed
feat(locator): warn when deprecated timeout is passed to isVisible/isHidden#40028aydinomer00 wants to merge 1 commit intomicrosoft:mainfrom
aydinomer00 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…Hidden Add a console warning when the deprecated `timeout` option is passed to `locator.isVisible()` or `locator.isHidden()`. The timeout option has been deprecated and silently ignored for years, causing confusion among users who rely on it for waiting behavior. Fixes microsoft#33017
Member
|
We don't like writing into the console outside reporters, sorry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a console warning when the deprecated
timeoutoption is passed tolocator.isVisible()orlocator.isHidden(). The timeout option has been deprecated and silently ignored for years, causing confusion among users who rely on it for waiting behavior.Changes
packages/playwright-core/src/client/locator.ts: Addedconsole.warn()whentimeoutoption is provided toisVisible()andisHidden()tests/page/locator-is-visible.spec.ts: Added 2 test cases to verify the deprecation warning is emittedMotivation
As described in #33017, the
timeoutargument toLocator.isVisibleandLocator.isHiddenhas been deprecated for years but is silently ignored. This leads to incorrect code where users think their visibility check waits for the timeout period, when it actually returns immediately.This PR adds a visible
console.warnmessage so users are aware the option has no effect and can update their code accordingly.Fixes #33017