Cypress-Cucumber 缺少步骤实现

Posted

技术标签:

【中文标题】Cypress-Cucumber 缺少步骤实现【英文标题】:Cypress-Cucumber getting Step implementation missing for 【发布时间】:2022-01-16 22:49:01 【问题描述】:

我正在尝试将 cucumber 实现到模块化 Angular 项目中,但不知道如何。 我有几个模块和 e2e 文件夹来测试它们,我们称它们为工具

但我无法配置 cucumber 以使用他们 GitHub 中的简单谷歌示例。 cypress.json的一些


  "reporter": "junit",
  "baseUrl": "https://localhost/",
  "reporterOptions": 
    "mochaFile": "../../test-results/tool3/reports/[hash].xml",
    "testsuitesTitle": "tool3",
    "useFullSuiteTitle": false
  ,
  "fileServerFolder": "./",
  "testFiles": "**/*.feature,features",
  "fixturesFolder": "./src/fixtures",
  "integrationFolder": "./src/integration",
  "pluginsFile": "./src/plugins/index.js",
  "supportFile": "./src/support/index.ts",
  "chromeWebSecurity": false,
  "viewportHeight": 799,
  "viewportWidth": 1199,
  "retries": 
    "runMode": 1,
    "openMode": 0
  ,
  "responseTimeout": 90000,
  "env": 
    "ServerAddress": "localhost"
  

添加到 e2e 文件夹内的 package.json 中

    "cypress-cucumber-preprocessor": 
        "nonGlobalStepDefinitions": true
  

插件/index.js

const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const resolve = require('resolve');

module.exports = (on, config) => 
    const options = 
        ...browserify.defaultOptions,
        typescript: resolve.sync('typescript',  baseDir: config.projectRoot ),

    ;
    on('file:preprocessor', cucumber(options));
;

而 Google.feature 和 google.ts 来自 github demo (Given, Then)

现在取决于"nonGlobalStepDefinitions" 配置,我遇到了错误。

当为真时 - Error: We've tried to resolve your step definitions at cypress\integration, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress.

当 stepDefinition 为 false 时

Step implementation missing for: I open Google page

没有黄瓜的柏树效果很好。感谢您的帮助。

【问题讨论】:

【参考方案1】:

看在上帝的份上,我需要将 src 文件夹重命名为 cypress

【讨论】:

以上是关于Cypress-Cucumber 缺少步骤实现的主要内容,如果未能解决你的问题,请参考以下文章

Exchange 2013 cu16补丁更新

本地通知swift上缺少徽章和声音

虚拟机CDlinux中怎么安装无线网卡的linux驱动rtl8192cu usb

Exchange 2013 CU17和office 365混合部署

Linux 环境 Pentaho 中缺少步骤插件

Exchange 2013CU17和office 365混合部署-部署ADFS Proxy