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
addCommand does not work for multiremote with wdio testrunner #2073
Conversation
Hi @christian-bromann ! Is there a plan to make this work soon? Currently if we want to convert tests to multi remote, we have to duplicate the custom commands, and keep tabs at what is core and what is custom. |
@amitaibu I recommend to use page objects instead of custom commands. This has not a high priority. |
Indeed we're using page objects. I was just hoping to remove some of the duplication, but as there's already a solution it's good enough for now. Thanks for the update! btw, would be interesting to see one day how you execute multiremote on TVs 😉 |
There was indeed an issue not being able to register custom command on a multiremote instance. E.g. matrix.addCommand('go', async function (url) {
await this.url(url + '#custom')
await this.pause(4000)
return this.getCurrentUrl()
}) Would still not attach the The behavior described by @zinserjan in the initial issue still exists though. After some testing I realised that this would be not a nice experiences because the return value of a multiremote command call is always an array of results. So you would never be able to use the same logic with a multiremote instance than with a standard one, e.g. browser.addCommand('myCustomCommand', async function (param) {
const commandResult = await this.execute(() => 'foobar')
return { param, commandResult }
})
I think this is ok and an expected behavior. |
Codecov Report
@@ Coverage Diff @@
## master #2073 +/- ##
==========================================
+ Coverage 96.38% 96.38% +<.01%
==========================================
Files 124 124
Lines 2652 2656 +4
Branches 547 548 +1
==========================================
+ Hits 2556 2560 +4
Misses 87 87
Partials 9 9
Continue to review full report at Codecov.
|
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.
Nothing stands out to me
a0b1955
to
fea604d
Compare
The problem
Custom commands, registered via the addCommand on the global multi browser instance in wdio testrunner, does not work for the respective browser instances. Seems like the command is not registered on each single browser instance.
But it's working fine in standalone mode.
The following code fails in wdio-testrunner in multiremote mode:
I created a sample repo to reproduce (see below).
Environment
Link to Selenium/WebdriverIO logs
Code To Reproduce Issue
https://github.com/zinserjan/webdriverio-multiremote-experiments