Skip to content
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

Array parameters become non-array when passed from inside a step #387

Closed
priyanksaroha opened this issue Aug 31, 2020 · 4 comments
Closed

Comments

@priyanksaroha
Copy link

Describe the bug

I'm using gauge+webdriverio to write automation tests, and when I do a shift+tab operation using browser.keys(['Shift', 'Tab]), I get Error: "keys" command requires a string or array of strings as parameters. I tested in a poc with just webdriverio and it worked correctly, but with gauge I'm facing this problem. I put logs before calling the keys method, and inside the keys method of webdriverio, and instanceof Array is true before calling the method, but false inside the method. The value of the parameter isn't changed, but it fails any checks in a method to ensure that the parameter is an array. This behavior is consistent regardless of what method I call — I pass an array parameter, but when it reaches the method, it's not an array anymore.

Tested with webdriverio versions: 5.18.6, 6.0.0, and 4.11.0

@zabil
Copy link
Member

zabil commented Sep 1, 2020

@zabil zabil closed this as completed Sep 1, 2020
@zabil zabil reopened this Sep 8, 2020
@zabil zabil transferred this issue from getgauge/gauge Sep 8, 2020
@zabil
Copy link
Member

zabil commented Sep 8, 2020

Might be related to #384

@zabil
Copy link
Member

zabil commented Sep 8, 2020

Webdriver uses the instanceof operator to check for the array

https://github.com/webdriverio/webdriverio/blob/18967aba9be475ab15d3c7197d7bbe9cf6abe578/packages/webdriverio/src/commands/browser/keys.js#L38-L42

This does not work in how Gauge uses node js vm

nodejs/node-v0.x-archive#1277 (comment)

@NivedhaSenthil
Copy link
Member

A fix for this is merged in Webdriverio..webdriverio/webdriverio#5806 should be available as part of next release.

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

No branches or pull requests

3 participants