Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping features to step definitions in the settings file for the "VSCode Cucumber (Gherkin) Full Language Support + Formatting + Autocomplete" plugin

So I just downloaded the "VSCode Cucumber (Gherkin) Full Language Support + Formatting + Autocomplete" plugin to help with cucumber formatting inside my vscode editor. It seems like from their documentation, the "VSCode Cucumber (Gherkin)..." plugin supports a feature which will let you see the relationship between feature files, step definitions, and page objects via hovering over the corresponding text in the .feature file.

However, the "VSCode Cucumber (Gherkin)..." plugins' documentation on path mapping between files is light. Does anyone know how you would create the desired syntax linking between feature files, step-definitions, and page-objects given the following directory structure?

src
├── features
│   ├── accessibility
│   │   └── FeatureFile.feature
│   ├── Directory
│   │   ├── featureFile.feature
│   │   ├── SomeDirectory
│   │   │   ├── FeatureFile.feature
│   ├── step_definitions
│   │   ├── SomeDirectory
│   │   │   ├── someFile.js
│   │   │   ├── given.js
│   │   │   └── then.js
│   │   ├── given.js
│   │   ├── someFeature.js
│   │   ├── then.js
│   │   └── when.js
├── pageobjects
│   ├── SomeDirectory
│   │   ├── SomeFeature

For reference, this is their documentation example of how the vscode configs file should look to enable these features

{
"cucumberautocomplete.steps": [
    "test/features/step_definitions/*.js",
    "node_modules/qa-lib/src/step_definitions/*.js"
],
"cucumberautocomplete.syncfeatures": "test/features/*feature",
"cucumberautocomplete.strictGherkinCompletion": true,
"cucumberautocomplete.strictGherkinValidation": true,
"cucumberautocomplete.smartSnippets": true,
"cucumberautocomplete.stepsInvariants": true,
"cucumberautocomplete.customParameters": [
    {
        "parameter":"{ab}",
        "value":"(a|b)"
    },
    {
        "parameter":/\{a.*\}/,
        "value":"a"
    },
],
"cucumberautocomplete.pages": {
    "users": "test/features/page_objects/users.storage.js",
    "pathes": "test/features/page_objects/pathes.storage.js",
    "main": "test/features/support/page_objects/main.page.js"
},
"cucumberautocomplete.skipDocStringsFormat": true,
"cucumberautocomplete.formatConfOverride": {
    "And": 3,
    "But": "relative",
},
"cucumberautocomplete.onTypeFormat": true,
"editor.quickSuggestions": {
    "comments": false,
    "strings": true,
    "other": true
}
like image 477
Luke Avatar asked Jan 18 '20 03:01

Luke


1 Answers

cucumberautocomplete.steps should have array of valid paths. In your case you can just specify ["path_to_src/features/step_definitions/*.js"]. And if you want to read the steps in any folders in src you can simply mention ["path_to_src/**/*.js"]

like image 52
supputuri Avatar answered Oct 22 '22 15:10

supputuri