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

how to run the repo using just cucumberjs command?

Open shekss opened this issue 8 years ago • 5 comments
trafficstars

Hi ,

I really like the repo but I want to follow the standard cucumber structure and run from IDE ( from Webstorm). i followed the steps you mentioned in the intelliJ cucumber plugin section, and I am able to run the repo with command node ./index.js -s ./features/step_definitions -p ./features/page_objects -o ./features/shared_objects -r ./features/reports

but then when I run the repo using just cucumberjs command, i get various errors. for example it says 'by is not defined'. can you let me know how to structure the framework so that I can run from command line by just giving cucumberjs or in the intelliJ, right click on the scenario and run the scenario. I have attached snapshots , how I would like to run. The reason I want to run like this is, its easier to debug and run in one go everything from the editor.. Appreciate your help. The actual command the editor runs is ./node_modules/.bin/cucumberjs /Users/raja/projects/JavaScript_frameworks/selenium-cucumber-js/features/google-search.feature --format summary --require /Users/raja/projects/JavaScript_frameworks/selenium-cucumber-js/features --require /Applications/WebStorm.app/Contents/plugins/CucumberJavaScript/lib/cucumberjs_formatter_nix.js (copy pasted from editor) ideally if i can run with cucumberjs command, then I should be able to figure out how to run in editor. many thanks.

screen shot 2017-10-20 at 15 12 14 2 screen shot 2017-10-20 at 15 12 27 2 screen shot 2017-10-20 at 15 09 05 2

shekss avatar Oct 20 '17 10:10 shekss

Hi @shekss, I am not a WebStorm user so I would have no idea. @Temi89 can you help?

john-doherty avatar Oct 20 '17 14:10 john-doherty

Hi @shekss what version of Node and npm are you running ? Also have tried doing and Npm update. seems like you might have missing a dependencies

Temi89 avatar Oct 20 '17 15:10 Temi89

@shekss , @john-doherty Just had a look at your screenshot you are using "cucumber runner" . Edit your run configuration to use "node runner" which you can download as a plugin and point to the index.js file of selenium cucumber js . Or better still just execute Npm run test on the terminal and pass arguments you need e.g. (npm run test -- -b Firefox -t@search) . That is if you haven't already done this.

Temi89 avatar Oct 20 '17 15:10 Temi89

Thanks @Temi89. @shekss probably does not have the "test" entry in his package.json file. Are you able to share what you use?

john-doherty avatar Oct 20 '17 17:10 john-doherty

HI @Temi89 & @john-doherty , I wanted to run the tests using cucumberjs command actually. the reason i showed webstorm is , webstorm or any other IDE runs cucumberjs command. if i wanted to run the features using cucumberjs, what are all the changes I need to do ? cucumber loads everything in the support folder before running features , so may be you can store the index.js in there? I tried it but I was not successful. by using the cucumberjs as the runner, I can use the standard cucumber options like tags,hooks in the same way its defined in cucumber tool.

shekss avatar Oct 23 '17 10:10 shekss