【发布时间】:2021-01-07 09:24:36
【问题描述】:
当我尝试运行 cypress 时,它会检测到功能文件,但无法获取步骤定义文件,下面是我看到的错误。
在我的配置下分享:
- 打包json文件sn-p
{...
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
}
}
- cypress.json
{
...
"testFiles": "**/*.{feature,features}"
}
- plugins/index.js
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-title/check-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);
});
【问题讨论】:
-
你解决过这个问题吗?
标签: javascript reactjs angular cypress cucumberjs