selenium-cucumber-js
selenium-cucumber-js copied to clipboard
How to get command line arg before executing tests?
I need to pass in something like --environment "qa". Then I need to use this value to determine which variables to pull in from my ./shared-objects/environment.js file. I was hoping I could pull in CLI arguments from within this.BeforeFeatures but I can't. Any ideas? Any help at all would be appreciated.
I had this same problem and the only thought I had was to update my files directly. So I created a shared/config.js to provide shared options, in my case just baseUrl.
I'm using Jenkins to run this, so I scripted something to the effect of: sed -i -r -e "s|(baseUrl: )[^\n]|\1'$URL'|g" shared/config.js
This will update config.js to use the $URL which I generate based on my environment.