所以我刚刚下载了“ VSCode Cucumber(Gherkin)完整语言支持+格式+自动完成”插件,以帮助在我的vscode编辑器中进行黄瓜格式设置。从他们的文档看来,“ VSCode Cucumber(Gherkin)...”插件支持一项功能,通过将鼠标悬停在.feature文件中的相应文本上,您可以查看功能文件,步骤定义和页面对象之间的关系。 。
但是,关于文件之间路径映射的“ VSCode Cucumber(Gherkin)...”插件的文档很浅。谁知道在给定以下目录结构的情况下如何在功能文件,步骤定义和页面对象之间创建所需的语法链接?
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
作为参考,这是他们的文档示例,说明了如何使用vscode配置文件来启用这些功能
{
"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
}
cucumberautocomplete.steps
应该具有有效路径的数组。您可以仅指定["path_to_src/features/step_definitions/*.js"]
。如果您想阅读src中任何文件夹中的步骤,只需提及["path_to_src/**/*.js"]