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
[🐛 Bug]: Error allow custom commands scoped to element #8417
Comments
Does it occur if you remove trailing |
No, it does not occur but I'd need to use multiple await to call the new custom command i.e I would like to call the new custom comman in this way -> If I remove the '$, it forces me to use multiple await |
Tried with minimal code below, both commands are working fine async function setValueSafe(value) {
await this.waitForDisplayed();
await this.setValue(value);
}
describe('My Login application', () => {
beforeAll(() => {
browser.addCommand('setValueSafe$', setValueSafe, true);
browser.addCommand('setValueSafe', setValueSafe, true);
});
it('should login with valid credentials', async () => {
await browser.url(`https://the-internet.herokuapp.com/login`);
await $('#username').setValueSafe$('tomsmith');
await $('#password').setValueSafe('SuperSecretPassword!');
await $('button[type="submit"]').click();
await expect($('#flash')).toBeExisting();
await expect($('#flash')).toHaveTextContaining('You logged into a secure area!');
});
}); there might be issue with |
Could you share your package.json file ? I'd like to use the same version dependencies |
{
"devDependencies": {
"@wdio/cli": "^7.20.2",
"@wdio/jasmine-framework": "^7.20.0",
"@wdio/local-runner": "^7.20.2",
"@wdio/spec-reporter": "^7.20.0",
"chromedriver": "^102.0.0",
"wdio-chromedriver-service": "^7.3.2"
}
} |
@yopasa94 please provide a reproducible example to help us identify this issue for you, otherwise we can only close it. |
Closing due to inactivity. |
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
latest
Node.js Version
latest
Mode
Standalone Mode
Which capabilities are you using?
What happened?
Custom commands should use a '$' symbol at the end to be processed unfortunately it produce a new issue when we call wrapCommand from shim.js class
Related PR
#8134
SetValueSafe$
does not exist in the (this) (WebDriver:Element) context. Event though I can see the list of wdio default commands (i.e click,What is your expected behavior?
I should be able to call custom commands from elements
How to reproduce the bug.
wdio.chain.command.type.d.ts
wdio.command.type.d.ts
MyCustomCommand.ts
wdio-conf.ts
Relevant log output
Code of Conduct
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: