badeball / cypress-cucumber-preprocessor

Run cucumber/gherkin-syntaxed specs with Cypress
MIT License
1.32k stars 149 forks source link

Reusable Step Definitions in common folder doesnt seem to work #673

Closed pprasanth91 closed 2 years ago

pprasanth91 commented 2 years ago

I have two feature files Featurefile1 and FeatureFile2 and in both the files i have a Step "User Logs into the Application" used. When i define this step in .js file under cypress/integration/common/ folder and run my test it throws an Error stating "Step implementation is missing".

I tried configuring the following in my package.json file "cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false, "commonPath": "cypress/integration/common" }

For nonGlobalStepDefinitions i tried with true replacing false but still this doesn't seem to work.

@lgandecki

andrei-s-buta commented 2 years ago

Have you tried to use commonPath like this "step_definitions": "cypress/integration"? I have a folder inside integration folder that contains all steps and it's working fine without having to give the full path.

pprasanth91 commented 2 years ago

@andrei-s-buta - can you share me the configuration that i need to do in package.json file please ?

andrei-s-buta commented 2 years ago

Replace this part "cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": false, "commonPath": "cypress/integration/common" } with "cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": false, "step_definitions": "cypress/integration" } And see if it works, if not rename the common folder to step_definitions like here

Screenshot 2022-02-22 at 19 13 04
pprasanth91 commented 2 years ago

Thanks @andrei-s-buta its working for me now... :)