当我试图运行柏树时,它确实检测到了特性文件,但是无法得到步骤定义文件,下面是我要看到的错误。

在我的配置下面共享:
{...
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
}
}{
...
"testFiles": "**/*.{feature,features}"
}const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}还共享我的测试文件:
功能文件(google/check-title.feature)
Feature: The Google
I want to open google page
@focus
Scenario: Opening a social network page
Given I open Google page
Then I see "Google" in the title步骤定义文件(google/check/Chec-Title.js)
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
const url = 'https://google.com';
Given('I open Google page', () => {
cy.visit(url);
});
Then(`I see {string} in the title`, (title) => {
cy.title().should('include', title);
});发布于 2021-12-04 00:36:29
这可能会有所帮助:在package.json中,将标志nonGlobalStepDefinitions设置为false,并定义目录测试来自:"stepDefinitions":"cypress/integration/“
{
"devDependencies": {
"cypress": "^9.1.0",
"cypress-cucumber-preprocessor": "^4.3.0"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/integration/"
}
}https://stackoverflow.com/questions/65609668
复制相似问题