1

学习者并不断收到“步骤实施缺失:我打开 Google 页面”错误。

这是我的回购https://github.com/PatoDeVille/TsBDDtest.git

检查了这里的文档https://www.npmjs.com/package/cypress-cucumber-preprocessor#cypress-configuration一切似乎都还好。

我正在关注的教程是https://www.youtube.com/watch?v=ZM7bzu0zIT8

还检查了Cypress.io 和 Cucumber.io 测试集成中的问题,缺少步骤实现:并且错误仍然存​​在

/package.json devDependencies

{
    "browserify": "^16.2.3",
    "cypress": "^7.3.0",
    "cypress-cucumber-preprocessor": "^4.1.0",
    "node-static": "^0.7.11",
    "typescript": "^2.9.2"
  }

/cypress.json

{
    "testFiles": "**/*.feature"
}

/.cypress-cucumber-preprocessorrc.json

{
    "nonGlobalStepDefinitions": true,
    "step_definitions": "cypress/support/step_definitions/"
  }
4

1 回答 1

2

如果您通过以下方式指定

 "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true
  }

赛普拉斯将在集成文件夹中检查您的测试定义,但如果您想更改集成文件夹外的位置,您应该将其设置为以下方式(将 nonGlobalStepDefinitions 定义为 false 并定义 stepDefinitions 文件夹)

"cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "stepDefinitions": "cypress/stepsDefinition"
  }

它应该可以工作,在这里我附上我的结构示例

在此处输入图像描述

于 2021-11-02T02:18:42.623 回答