Cucumber support on Webstorm - Run individual scenario

Guys,

Here is my environment details:

Webstorm Version: 2021.2.3

Platform OS: mac

Cucumber version: 9.X

 

Im trying to run Cucumber Feature/scenario individually. However it is failing to execute with the following warning

My project structure is as follows

Configuration looks like as below

 

Please let me know if I have to adjust the project directory?

 

Thanks

Mahi

0
14 comments

Try passing paths to your step definition files, world, etc. with --require in Cucumber.js Arguments: field. Path in --require should be relative to specified working directory

0

On the run terminal, I can see the following command is triggered, while I was trying to run the selected scenario

As you can see, the --require param is already carrying the path to steps def. Please note, those steps are referencing some common methods, those are defined in another folder, which is from cypress/pages/google   (Please refer the folder structure above)

/Documents/Solutions/cypress-cucumber-example/node_modules/cucumber/bin/cucumber-js /Documents/Solutions/cypress-cucumber-example/cypress/integration/google/search.feature --name "Common search" --format /Applications/WebStorm.app/Contents/plugins/CucumberJavaScript/lib/cucumberjs_formatter_v3.js --format-options "{\"cucumberLibPath\": \"/Documents/Solutions/cypress-cucumber-example/node_modules/cucumber/lib\"}" --require /Documents/Solutions/cypress-cucumber-example/cypress/integration/google

0

I can hardly advise on this unless you provide a project

What command do you use to run your tests in terminal? As far as I can see, it's a cypress project, you are sure these tests can be run with cucumber test runner?

 

0

You may clone the project from here - jmarti-theinit/cypress-cucumber-example: An example skeleton with Cypress and Cucumber (github.com)

Just for your information, I was able to run the entire scenario at once, using the conventional approach on terminal - npm run test

 

0

npm run test runs tests with cypress; I'm not sure if they can be run with cucumber test runner, it was designed to be run with cypress

0

Alternatively, could you provide an example repo/ a way to execute individual scenario from WebStorm?

 

0

Is it about cucumber or cypress tests?

0

Cucumber styled cypress tests.

Detail:

We would need to accomplish the e2e (end to end testing) for angular application. Cucumber on it own, is a representation of gherkin language syntax. It does not do the e2e test for the front-end applications. It only provides the feature/scenario scaffolding, which in turn be driven by cypress/protractor/selenium etc. In our case, we prefer to go with the cucumber in conjunction with cypress.

0

Additional info from eco-system:

Kinda similar issue (but for back-end) - Running single cucumber scenario from .feature file – IDEs Support (IntelliJ Platform) | JetBrains

Documentation for intellij to run individual scenario (Cucumber with JUnit) - Run Cucumber tests | IntelliJ IDEA (jetbrains.com)

 

But the problem stated in this ticket is still undocumented? or not clear enough how to achieve it

0

Running individual features from IDE works fine for pure Cucumber tests

Can you run any of your cucumber styled cypress tests in terminal using Cucumber test runner (i.e. with cucumber-js features/my_feature.feature) and not Cypress?

0

The Cucumber is also not running on the test runner. (At least it is not finding the steps). Please check the screen shot below

The quickest way is, if you could clone the repo and try to run it - that may give an insight about the problem.

Cypress is not involved yet. At least steps should be found. Then only cypress will come into the picture. But, it is failing well before that, stating steps are undefined.

0

>The quickest way is, if you could clone the repo and try to run it - that may give an insight about the problem.

I do have a similar repo locally, and I have no idea how to make Cypress tests work without Cypress. For me, the issue is different (steps are found, but tests fail anyway due to ReferenceError: window is not defined)

0

For the simplicity, I have commented cypress related code. If you could look at the code below, to my understanding, the runner should reach the When and Then stubs from the right-hand side. But it isn't.

May be, you could give me an insight as to whether we can execute e2e test only with the Cucumber and without any support from libraries like Cypress/Protractor/Selenium?

If so, I guess, you may have a sample repo. Would it be possible to share the sample code with me

0

I have no idea if Cucumber can be used for e2e testing without involving special libraries, sorry. You'd better submit this query to https://github.com/cucumber/cucumber-js/issues

0

Please sign in to leave a comment.