Engin Akman
Engin Akman

Reputation: 1

Gherkin Steps Not Linked to Step Definitions in Playwright TypeScript Cucumber Setup on Windows

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

Configuration Files

  1. 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' },
      },
    };
    
  2. 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

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

Answers (0)

Related Questions