将功能映射到“VSCode Cucumber (Gherkin) Full Language Support + Formatting + Autocomplete”插件的设置文件中的步骤定义

Luk*_*uke 7 javascript bdd cucumber selenium-webdriver vscode-settings

所以我刚刚下载了“VSCode Cucumber (Gherkin) Full Language Support + Formatting + Autocomplete”插件来帮助我在我的 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
Run Code Online (Sandbox Code Playgroud)

作为参考,这是他们的文档示例,说明 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
}
Run Code Online (Sandbox Code Playgroud)

sup*_*uri 1

cucumberautocomplete.steps应该有有效路径的数组。在您的情况下,您只需指定["path_to_src/features/step_definitions/*.js"]. 如果您想阅读 src 中任何文件夹中的步骤,您只需提及["path_to_src/**/*.js"]