首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cypress-Cucumber缺少步骤实现

Cypress-Cucumber缺少步骤实现
EN

Stack Overflow用户
提问于 2021-12-13 12:59:31
回答 1查看 900关注 0票数 0

我试图实现黄瓜到模块化的角度项目,但不知道如何实现。我有几个模块和e2e文件夹来测试它们--让我们称之为工具

但是我不能配置黄瓜来使用他们的GitHub中的简单谷歌示例。一些cypress.json

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

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

代码语言:javascript
复制
    "cypress-cucumber-preprocessor": {
        "nonGlobalStepDefinitions": true
  }

plugins/index.js

代码语言:javascript
复制
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演示(然后给出)

现在,取决于"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时

代码语言:javascript
复制
Step implementation missing for: I open Google page

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-12-13 13:17:09

我需要把src文件夹重命名为柏树,看在上帝的份上

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70335085

复制
相关文章

相似问题

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