javascript - 连接两个测试框架的 cypress-cucumber-preprocessor 不起作用
问题描述
我想连接 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/集成/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/插件/index.js
// Cucumber Plugin
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
错误
解决方案
如果要自定义它,则必须配置 step_definitions 的路径。
但是,如果您更喜欢简单的方法,默认情况下 cypress-cucumber-preprocessor 使用文件夹cypress/support/step_definitions
所以我相信如果你把你的 test.js 文件移动到上面描述的文件夹中,将会解决你的问题。
推荐阅读
- python - PyInstaller 致命错误:找不到“zmq.h”文件
- r - 使用 vcd 包的卡方检验
- java - 在单独的线程中创建文件
- typescript - 如何在 TypeScript 中编辑全局类型?
- angular - TypeScript 要求将类型添加到键值
- python - 有没有一种方法可以让我延迟执行请求?
- coldfusion - 我可以使用 cfspreadsheet 更新现有模板中的数据而不会丢失其中的样式吗?
- database - 如果其他表为空,则在 mysql 中的 mRename 表中重命名表
- jquery - 输入值更改时我无法检测到事件
- javascript - 对齐圆圈和球没有弹跳