Open proto-n opened 6 years ago
Hi! After a fun debugging session I noticed the following bug: When you pass at least 11 arguments to the Application, for example:
Application
let app = new Application({ path: electronPath, args: [ __dirname, '--a', '0', '--b', '1', '--c', '2', '--d', '3', '--e', '4', ], })
The order gets messed up: the application receives
[ "xyz/node_modules/electron/dist/electron", "xyz", "--a", "4", "0", "--b","1", "--c","2", "--d","3", "--e", "--disable-background-networking", "--disable-client-side-phishing-detection", ... // bunch more chrome related stuff ]
This happens because the args are relayed to webdriverio as
['spectron-path=xyz/node_modules/electron/dist/electron', 'spectron-arg0=xyz', 'spectron-arg1=--a', 'spectron-arg2=0', 'spectron-arg3=--b', 'spectron-arg4=1', 'spectron-arg5=--c', 'spectron-arg6=2', 'spectron-arg7=--d', 'spectron-arg8=3', 'spectron-arg9=--e', 'spectron-arg10=4' ]
and apparently webdriverio orders the arguments alphabetically (?). Left padding numbers with zeros to a fixed size fixes this.
Cheers
I just bumped into this exact issue when passing my 11th argument.
Pull request 18 fixes the issue, along with a test.
https://github.com/electron-userland/spectron/pull/588
Hi! After a fun debugging session I noticed the following bug: When you pass at least 11 arguments to the
Application
, for example:The order gets messed up: the application receives
This happens because the args are relayed to webdriverio as
and apparently webdriverio orders the arguments alphabetically (?). Left padding numbers with zeros to a fixed size fixes this.
Cheers