-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loosen WebElementCondition instance checks #5968
Conversation
Update WebElementCondition and Condition with custom static hasInstance methods so that `instanceof` checks are more lenient and don't cause issues with Babel. Fixes SeleniumHQ#5560
* @param {!(IThenable<T>| | ||
* Condition<T>| | ||
* function(!WebDriver): T)} condition - the condition instance | ||
* @returns {*|boolean} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return {boolean}
* @returns {*|boolean} | ||
*/ | ||
static [Symbol.hasInstance](condition) { | ||
return condition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return !!condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'd probably be a little stricter:
return !!condition && typeof condition === 'object'
(plus the next two lines)
* function(!WebDriver): T)} condition - the condition instance | ||
* @returns {*|boolean} | ||
*/ | ||
static [Symbol.hasInstance](condition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to define this a second time, it will be inherited from Condition
This reverts commit 5ec8094. This commit was intended to fix a babel-related issue #5560. Unfortunately it broke 'x instanceof WebElementCondition' check that returns true even if 'x' is an instance of the 'Condition' class (a base class for 'WebElementCondition'). All waits that return a boolean value or a string are affected.
I've reverted this change by commit 6158311 because it broke The issue will be reopened too. |
This reverts commit 5ec8094. This commit was intended to fix a babel-related issue SeleniumHQ#5560. Unfortunately it broke 'x instanceof WebElementCondition' check that returns true even if 'x' is an instance of the 'Condition' class (a base class for 'WebElementCondition'). All waits that return a boolean value or a string are affected.
Update WebElementCondition and Condition with custom
static hasInstance methods so that
instanceof
checksare more lenient and don't cause issues with Babel.
Fixes #5560
X
in the preceding checkbox, I verify that I have signed the Contributor License Agreement