【问题标题】:cypress-cucumber-preprocessor to connect both testing frameworks doesn't work连接两个测试框架的 cypress-cucumber-preprocessor 不起作用
【发布时间】:2019-09-30 10:09:08
【问题描述】:

我想连接 Cypress 和 Cucumber,我找到了以下插件:https://www.npmjs.com/package/cypress-cucumber-preprocessor

但是我的实现不起作用并且找不到。我还将插件添加到plugins/index.js 文件夹中。

cypess/integration/test.feature

Feature: Background Section

   Background:
    Given counter has been reset

   Scenario: Basic example #1
     When counter is incremented
     Then counter equals 1

   Scenario: Basic example #2
     When counter is incremented
     When counter is incremented
     Then counter equals 2

cypess/integration/test.js

let counter = 0;

Given("counter has been reset", () => {
  counter = 0;
});

When("counter is incremented", () => {
  counter += 1;
});

Then("counter equals {int}", value => {
  expect(counter).to.equal(value);
});

cypess/plugins/index.js

// Cucumber Plugin
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
  on('file:preprocessor', cucumber())
}

错误

【问题讨论】:

  • 自己做的。请参阅 https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues/126 的 jogelin 回答

标签: javascript angular typescript cucumber cypress


【解决方案1】:

如果你想自定义它,你必须配置到 step_definitions 的路径。

但如果您更喜欢简单的方法,默认情况下 cypress-cucumber-preprocessor 使用文件夹 cypress/support/step_definitions

所以我相信如果你把你的 test.js 文件移动到上面描述的文件夹中,将会解决你的问题。

【讨论】:

    猜你喜欢
    • 2023-02-21
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2022-11-20
    • 2022-09-30
    • 2023-01-31
    • 2022-06-28
    • 2021-08-07
    相关资源
    最近更新 更多