Reputation: 1
Summary
I’m using Playwright with TypeScript and Cucumber.js on Windows, but my Gherkin steps in .feature
files aren’t linking to the step definitions. I've set up what I believe to be correct configurations, yet step matching and autocomplete aren’t working.
System Details
^10.9.0
^1.48.1
{
"description": "",
"dependencies": {
"@cucumber/cucumber": "^10.9.0",
"@types/node": "^20.16.13",
"dotenv": "^16.4.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
},
"devDependencies": {
"@playwright/test": "^1.48.1",
"@types/cucumber": "^7.0.0",
"open": "^10.1.0"
}
}
Configuration Files
cucumberConfig.js
/**
* @module cucumberConfig
*/
module.exports = {
default: {
requireModule: ['ts-node/register'],
require: ['./steps/**/*.ts', './hooks/**/*.ts', './features/**/*.feature'],
format: ['progress-bar', 'html:test-reports/cucumber-report.html'],
formatOptions: { snippetInterface: 'async-await' },
},
};
settings.json
{
"files.autoSave": "afterDelay",
"editor.fontSize": 20,
"code-runner.clearPreviousOutput": true,
"tabnine.experimentalAutoImports": true,
"window.menuBarVisibility": "compact",
"cucumberautocomplete.steps": "steps/**/*.js",
"cucumberautocomplete.syncfeatures": "features/**/*.features.js"
}
Problem Description
Despite the above configurations, the Gherkin steps in my feature files aren’t linked to the step definitions, and I get Undefined step
errors when running the tests. Additionally, Cucumber autocomplete isn’t working for steps in VS Code.
Steps Taken to Resolve
require
and cucumberautocomplete.steps
match the actual folder structure.ts
extensions directly in settings.json
(as shown above).Request for Assistance Could someone please help identify any misconfigurations or provide examples of working configurations for Playwright with TypeScript and Cucumber.js on Windows?
Thank you!
I made sure that the paths in both cucumberConfig.js and settings.json are correct and match the folder structure of my project. Specifically, I checked that:
In cucumberConfig.js: The require paths ('./steps//*.ts', './hooks//.ts', and './features/**/.feature') point to the correct directories for my step definitions, hooks, and feature files. In settings.json: The cucumberautocomplete.steps and cucumberautocomplete.syncfeatures options also match the expected directory structure. I expected this configuration to enable linking between Gherkin steps in feature files
Upvotes: 0
Views: 172