question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Common steps feature is not working

See original GitHub issue

Current behavior

I have downloaded the project of Alapan, from the following link: https://github.com/alapanme/Cypress-Automation I executed “login.feature” test scenario and is working fine.

scenarioWorking

I have added a common folder under the e2e folder and inside that I have add a common.js file. Inside common.js, I have import cucumber and added the first step from the scenario (meaning that this step does not exist anymore at login.js)

commonJS

Executing the scenario again, this is what I get:

scenarioNotWorking

Desired behavior

This should be working, as it was working before Cypress 10

Test code to reproduce

Versions

  • Cypress version: 10.2.0
  • Preprocessor version: 11.0.0
  • Node version: 16.15.1

Checklist

  • I’ve read the FAQ.
  • I’ve read Instructions for logging issues.
  • I’m not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tinu-harbrcommented, Jun 27, 2022

@uaru I have below snippet on my package.json. My common step definitions are under cypress/e2e/common/ folder and feature specific steps are under sub folder on cypress/e2e/features/.

 "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
    "stepDefinitions": [
      "cypress/e2e/common/*.{js,ts}",
      "cypress/e2e/features/**/*.{js,ts}"
    ]
  },
1reaction
badeballcommented, Jun 27, 2022

I might be able to help if you provide me a reproducible example, IE. a Git repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cucumber: Unable to find step definition - Stack Overflow
It looks like Cucumber isn't finding your step defintion class. In your unit test class you say: glue = {"com.macro.definition"}.
Read more >
Feature file in different directory gives missing step ... - GitHub
So it seems if feature files are not in the default cypress folder then step files can not be located away from the...
Read more >
4 - Cucumber Feature File mapping with Step Definition
CucumberBDD #BDD #NaveenAutomationLabsIn this video, I have explained how to map feature file steps with step definition methods in step ...
Read more >
Step Organization - Cucumber Documentation
How Cucumber finds your features and step definitions. Be aware that, regardless of the directory structure employed, Cucumber effectively flattens the features ......
Read more >
Background in Cucumber - Tools QA
Working example of background with Hooks in Cucumber Java. ... step or series of steps that are common to all the tests in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found