sk_user
sk_user

Reputation: 149

Cucumber-js undefined step reference using IntelliJ IDEA - Ultimate Edition

Steps in feature file are highlighted saying:

"Undefined step reference: The following elements are visible on "logIn" page less... (Ctrl+F1) Inspection info: Highlights steps in Cucumber (or some other Gherkin) .feature files which do not have a matching step definitions. Use a quick-fix to automatically create a new step definition."

Tests are running properly, but the problem is that I am unable to navigate from feature files to step definitions, which complicates my work.

I've tried few of the solutions found here, but so far, nothing helped me.

Here is additional info for the dependencies:

"cucumber-html-reporter": "4.0.4", 
"cucumber-junit": "^1.7.1", 
"js-xlsx": "^0.8.22", 
"npm": "6.5.0", 
"selenium-server": "3.141.59" 
"chromedriver": "2.46.0", 
"cucumber": "^5.1.0", 
"cross-env": "^5.2.0", 
"cucumber-pretty": "^1.5.0", 
"geckodriver": "^1.14.1", 
"nightwatch": "^1.0.19", 
"nightwatch-api": "^2.1.1",

Thanks in advance!

Upvotes: 4

Views: 3213

Answers (1)

sk_user
sk_user

Reputation: 149

Since I came up with a solution to my problem I'll provide more details.

  1. Step definitions must be located in the default directory 'step_definitions', otherwise they won't be recognized. (mine was named 'step-definitions')

  2. .feature files recognize only steps written as regular expressions

Mine were written like this: this.When('I log in as a regular user'

Expected: this.When(/^I log in as a regular user$/

Reference:

https://youtrack.jetbrains.com/issue/WEB-15600

and

https://youtrack.jetbrains.com/issue/WEB-11505

Upvotes: 4

Related Questions