Skip to content

fix: executing queries without chromedriver #9

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

Merged

Conversation

ohaibbq
Copy link
Contributor

@ohaibbq ohaibbq commented May 19, 2021

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.. 🤷

@ohaibbq ohaibbq changed the title Splat script arguments so that is properly transformed Splat script arguments so that WebElements are properly transformed May 19, 2021
@olivierwilkinson
Copy link
Collaborator

olivierwilkinson commented May 23, 2021

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!)

@olivierwilkinson olivierwilkinson changed the title Splat script arguments so that WebElements are properly transformed fix: executing queries without chromedriver May 23, 2021
@olivierwilkinson olivierwilkinson merged commit 38da772 into testing-library:master May 23, 2021
@github-actions
Copy link

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants