testing-library / webdriverio-testing-library

🕷️ Simple and complete WebdriverIO DOM testing utilities that encourage good testing practices.
16 stars 14 forks source link

fix: executing queries without chromedriver #9

Closed ohaibbq closed 3 years ago

ohaibbq commented 3 years ago

The test suite on master currently fails if you remove the services: ['chromedriver'] from wdio.conf.js.

executeAsync expects args to be passed in position order. It captures them using the rest operator (...args). The list of arguments is then passed to executeScriptAsync which transforms them.

The transformer checks the for the presence of the WebElement identifier. If it exists, it will transform it into a Puppeteer element handle. However, since the arg is a 2 dimensional array, it does not perform the transformation, as the WebElement identifier property does not exist.

As for why this works in Chromedriver.. 🤷

olivierwilkinson commented 3 years ago

Hi there 👋 Thanks for raising this!

You are absolutely right this is broken when not using the chromedriver service, I guess Chromedriver is able to process the untransformed elements by happy accident? I'm not sure either 🤷‍♂️.

The changes make sense to me and as you say this is how WebdriverIO expects arguments to be passed to executeAsync so this will likely prevent unexpected behaviour in future. 🙌

Once the branch has passed it's tests I'll squash and merge with a fix: prefix so that semantic-release publishes the new version. 😄 (edit: the only way to do this is to rename the PR it seems, sorry about that!)

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 2.1.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: