Cypress和Cucumber的集成似乎进行得很好,但是当执行测试时,我得到了以下错误:
Step implementation missing for: I open login pagecypress.json
{
"video": false,
"baseUrl": "http://localhost:8080",
"testFiles": "**/*.feature",
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
}./cypress/integration/login.feature
Feature: Login Feature
I want to login
@focus
Scenario: Navigate to Login
Given I open login page
Then I see Login./cypress/integration/Login/login.js
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
Given( 'I open login page', () => cy.visit( '/Login' ) );
Then( 'Login page should be shown', () => cy.url().should( 'include', '/Login' ) );发布于 2020-04-06 19:25:17
您的cypress-cucumber-preprocessor配置应该在package.json中,而不是在cypress.json中。
此外,我认为步骤实现文件夹名必须匹配功能文件名。因此,您应该将步骤实现文件夹重命名为登录,而不是登录(./cypress/integration/login/login.js)。
见这里博士
发布于 2020-11-01 08:43:57
使用自定义路径在您的step_defintions中添加package.json
"cypress-cucumber-preprocessor": {
"step_definitions": "cypress/integration/features/step_definitions/**/"
}发布于 2020-04-06 19:25:35
虽然我不认为这个答案是理想的,但我成功地将"cypress-cucumber-preprocessor"从cypress.json中移除,并将子目录从"cypress/integration“目录移到"cypress/support/step_definitions”。
https://stackoverflow.com/questions/61050617
复制相似问题