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
[💡 Feature]: Allow custom commands scoped to element to be chainable in async mode #8043
Comments
Thanks for reporting! I am totally for this and I believe it is just a matter on how these commands are being wrapped. Any contributions that resolves the bug are highly appreciated. Please take a look into our contribution guidelines and let us know if you have any questions. Cheers! |
Do you think you can point me in the right direction? Something like import { wrapper } from 'webdriverio/???'
await browser.addCommand('$foo', async function () {
// Do something with an element
return wrapper(element);
}, true) or import { wrapper } from 'webdriverio/???'
await browser.addCommand('$foo', wrapper(async function () {
// Do something with an element
return element;
}), true) |
I honestly haven't invested time looking into a workaround because I would be more interested into a fix.
I think we should investigate where the core command wrapper fails to properly chain the commands. |
Just ran into the same problem. webdriverio/packages/wdio-utils/src/shim.ts Lines 70 to 73 in 92f073f
An effortless way to fix it will be assuming the user added commands which need to be chained contains |
@jayrepo I think this is a good solution you are suggesting. We would chain commands as long as they end with |
Resolved by #8134 |
Is your feature request related to a problem?
With async mode, we can do this:
but if we add a custom command to the element scope that we would like to chain:
and try to do this:
we get a
TypeError: $(...).$foo(...).click is not a function
Context:
I'm trying to add a custom locator strategy through the
addCommand
feature.Describe the solution you'd like.
What I'm requesting is that if:
Then that command should be chainable in
async
mode.Describe alternatives you've considered.
I've considered using the custom locator strategy feature:
custom$
.I cannot use it for this purpose because that only works in a web context (not my use case).
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: