Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps marked undefined in Cypress project #231

Closed
viditasatam opened this issue May 10, 2024 · 3 comments
Closed

Steps marked undefined in Cypress project #231

viditasatam opened this issue May 10, 2024 · 3 comments
Labels
🍼 incomplete Blocked until more information is provided

Comments

@viditasatam
Copy link

viditasatam commented May 10, 2024

👓 What did you see?

I am using Cypress (13.9.0) with cucumber (cucumber.io) plugin in VSCode IDE.

My file structure for feature file is cypress/e2e/features/SCC/*.feature, file structure for step definition is cypress/e2e/step_definitions/SCC/*.ts

tsconfig.json:

"include": [
	"**/*.ts", 
	"cypress/e2e/step_definitions/**/*.ts",
	"cypress.config.js",
	"cypress/plugins/*"
],

package.json:

"cypress-cucumber-preprocessor": {
	"stepDefinitions": [
		"cypress/e2e/step_definitions/**/*.{js,ts}"
	],
	"nonGlobalStepDefinitions": false
},

When I run the feature file, it runs fine but feature file shows warning on each step and am unable to navigate to step def through feature file. Please suggest.

image
image

✅ What did you expect to see?

Feature file steps should be glued to step definition file steps. Also I should be able to navigate to step def steps from feature files.

📦 Which tool/library version are you using?

"typescript": "^5.4.5"
"cypress": "^13.9.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"@badeball/cypress-cucumber-preprocessor": "^20.0.5",

🔬 How could we reproduce it?

No response

📚 Any additional context?

No response

@kieran-ryan
Copy link
Sponsor Member

kieran-ryan commented May 10, 2024

Hey @viditasatam, thanks for raising and appreciate your interest in the project! The extension provides default paths for locating glue files and feature files - following some typical project structures.

From the screenshots of your project, I observe your files would fall outside these default paths; thus some configuration of the extension is required. As a .vscode directory doesn't appear to be present in your project, I will make the assumption that the paths are yet to be configured in the workspace. I do observe settings.json in a tab, though suspect that may be for your user settings and while you could configure it from there, workspace settings may be better suited to your use case.

Inside your workspace in VSCode, can you create a .vscode directory containing a settings.json with the following configuration (see a sample configuration); and advise whether resolves the issue?

{
  "cucumber.features": [
    "cypress/e2e/features/**/*.feature"
  ],
  "cucumber.glue": [
    "cypress/e2e/step_definitions/**/*.js",
    "cypress/e2e/step_definitions/**/*.ts"
  ]
}

Should this not work, there are some known parsing issues with step definitions relating to TypeScript (e.g. cucumber/language-service#187); and if you could share some sample step definitions, I'd be happy to investigate the root cause of the issue and identify any work required to resolve.

@kieran-ryan kieran-ryan added the 🍼 incomplete Blocked until more information is provided label May 10, 2024
@kieran-ryan kieran-ryan changed the title Cucumber undefined step Steps marked undefined in Cypress project May 10, 2024
@viditasatam
Copy link
Author

Thanks. It works by adding this piece of code in my settings.json file :)

@kieran-ryan
Copy link
Sponsor Member

Delighted to hear that - thanks for the update @viditasatam!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍼 incomplete Blocked until more information is provided
Projects
None yet
Development

No branches or pull requests

2 participants