selenium-cucumber-js icon indicating copy to clipboard operation
selenium-cucumber-js copied to clipboard

How to get command line arg before executing tests?

Open DallasEpperson opened this issue 6 years ago • 1 comments
trafficstars

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.

DallasEpperson avatar Mar 01 '19 15:03 DallasEpperson

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.

itjstagame avatar Aug 07 '19 19:08 itjstagame