Home > Software design >  Adding duplicate code in common file cypress
Adding duplicate code in common file cypress

Time:04-14

Sorry it this is an obvious question, I just cant seem to figure it out.

I am using cypress and cucumber to create my tests. My file structure looks like this

enter image description here

What I am wanting to do is add steps in the assertionStepDifinition.js file that can be used in my login.feature and my register.feature

This is my cypress.json

{

  "chromeWebSecurity": false,
  "failOnStatusCode": false,
  "defaultCommandTimeout": 60000,
  "testFiles": "**/*.feature"

}

Currently I am getting the error Step implementation missing for: I am at the login page

Thanks in advance!

CodePudding user response:

most probably you need to add to your package.json

  "cypress-cucumber-preprocessor": {
    "step_definitions": "cypress/integration/**/"
  }

CodePudding user response:

You can add the direct path from where the step definition file is located in your package.json like this:

  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "stepDefinitions": "cypress/integration/cucumber-test/"
  }
  • Related