我有带cucumber-step-definition库的柏树。我试着运行feature文件,但它不起作用。
package.json
"devDependencies": {
"cypress": "^9.6.1",
"cypress-cucumber-preprocessor": "^4.3.1"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/integration/**/"
}
}plugin/index.js
const cucumber =require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor',cucumber())
}cypress/integration/page-step/login-step.js
import {Given,When,Then, And} from "cypress-cucumber-preprocessor/steps";
Given(/^I login to the app$/, function () {
});
Then(/^I see login on the account$/, function () {
});cypress/integration/cypress.特性
Feature: User buy a product on the website
Scenario: Buying a grocery with a proper test
Given I login to the app
Then I see login on the account


发布于 2022-10-27 08:44:47
也不知道发生在我身上的事情。我在我的插件里累了这个,然后它就起作用了。
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}https://stackoverflow.com/questions/73599505
复制相似问题