Not able to Run Feature Files

I am new to Webstorm and I have a JavaScript based Automation project built on Protractor with Cucumber support.

I am trying to run my feature file after giving proper run configuration to my cucumber.js file. The console says :

Test Framework Quick Unexpectedly.

Testing started at 2:01 PM ...
/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/.bin/cucumber.js /Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/features/loginpage.feature --format ../../../../../../../Applications/WebStorm.app/Contents/plugins/CucumberJavaScript/lib/cucumberjs_formatter_v2.js --format-options "{\"cucumberLibPath\": \"/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/cucumber/lib\"}" --require /Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/features
TypeError: Cannot read property 'bind' of undefined
at new formatter (/Applications/WebStorm.app/Contents/plugins/CucumberJavaScript/lib/cucumberjs_formatter_v2.js:11:69)
at Function.build (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/cucumber/lib/formatter/builder.js:86:14)
at /Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/cucumber/lib/cli/index.js:128:38
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/generators.js:97:49)
at /Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/generators.js:201:15
at /Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/cucumber/lib/cli/index.js:132:26
at tryCatcher (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/util.js:16:23)
at MappingPromiseArray._promiseFulfilled (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/map.js:61:38)
at MappingPromiseArray.PromiseArray._iterate (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/promise_array.js:114:31)
at MappingPromiseArray.init (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/promise_array.js:78:10)
at MappingPromiseArray._asyncInit (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/map.js:30:10)
at Async._drainQueue (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/lm10/Applications/Repo/hancock^mdmf.automations/mdmf_e2e_gui_testing/node_modules/bluebird/js/release/async.js:17:14)
 

9 comments
Comment actions Permalink

Cucumber 3.0 is not currently supported due to breaking API changes, please follow https://youtrack.jetbrains.com/issue/WEB-30241 for updates

0
Comment actions Permalink

What could be the possible alternate approach to this, if i need to run my feature files in Webstorm, as i need to use debug features to debug my code?

0
Comment actions Permalink

CucumberJS debugging is not supported in any case - this feature can only be expected in next major release (see https://youtrack.jetbrains.com/issue/WEB-15146)

You can try running Cucumber via Node.js or NPM run configurations, but you won't get test results represented as a tree, etc. - only plain console output (same as when running in terminal) will be available

0
Comment actions Permalink

Oh! I see, i do not see any ETA for both you tracks above. Can you tell, is there any time soon we can expect these support?

If not, momentarily can you suggest an IDE that can do the job for me, till these features are not available in webstorm?

0
Comment actions Permalink

there is an ETA for https://youtrack.jetbrains.com/issue/WEB-15146 - it's fixed in 2018.1

Unfortunately I can't suggest any other IDE, sorry:(

0
Comment actions Permalink

Oh! Okay. I think i should wait for a month or so.

Meanwhile, i have one more doubt. I have my js files written in ES6 syntax. When i try to run my feature files via Run GUI of webstorm, which in turn call those js files, it says some of the token are unexpected in terms of current javascript.

Initially it said that defined steps are missing for those feature files, but that i solved by moving my step_definition folder into features directory (Do, you see this right as well, can't we keep step_definition somewhere else?). Then, i started getting that token unexpected error.

Is there any way to run these js files without changing them to ES5 format?

PS : I have set javascript version to EMCA Script6 and also enabled Babel as file watcher.

0
Comment actions Permalink

> it says some of the token are unexpected in terms of current javascript.

This error has nothing to do with the IDE, it comes from Node.js. You need to either pass the precompiled files (produced by Babel) to cucumber or compile ES6 code on-the-fly with --compiler js:babel-register CLI flag

 

>that i solved by moving my step_definition folder into features directory (Do, you see this right as well, can't we keep step_definition somewhere else?)

 

Known issue - cucumber support only works when using fixed project structure: `features` folder with nested `step_definitions` folder:( See https://youtrack.jetbrains.com/issue/WEB-11505 and linked tickets

0
Comment actions Permalink

Hi Elena,

Thank you for the response. Can you tell me how can i compile ES6 code on-the-fly with --compiler js:babel-register CLI flag? I have never done that.

Any doc or steps that you can point me to?

 

While running pre-compiled babel files, i encounter an error that states "Cannot read property 'ExpectedConditions' of undefined" and this is with cucumber 2.3.0. Any idea?

0
Comment actions Permalink

see https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#transpilers

 

>While running pre-compiled babel files, i encounter an error that states "Cannot read property 'ExpectedConditions' of undefined" and this is with cucumber 2.3.0. Any idea?

 

No idea, sorry:(

0

Please sign in to leave a comment.