首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >步骤实现缺失:我登录到柏树黄瓜的应用程序。

步骤实现缺失:我登录到柏树黄瓜的应用程序。
EN

Stack Overflow用户
提问于 2022-09-04 12:43:31
回答 1查看 125关注 0票数 1

我有带cucumber-step-definition库的柏树。我试着运行feature文件,但它不起作用。

package.json

代码语言:javascript
复制
  "devDependencies": {
    "cypress": "^9.6.1",
    "cypress-cucumber-preprocessor": "^4.3.1"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "stepDefinitions": "cypress/integration/**/"
  }
}

plugin/index.js

代码语言:javascript
复制
const cucumber =require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
    on('file:preprocessor',cucumber())
}

cypress/integration/page-step/login-step.js

代码语言:javascript
复制
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.特性

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

发布于 2022-10-27 08:44:47

也不知道发生在我身上的事情。我在我的插件里累了这个,然后它就起作用了。

代码语言:javascript
复制
/**
 * @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())
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73599505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档