【问题标题】:CucumberJs cannot find steps using webdriverio5CucumberJs 找不到使用 webdriverio5 的步骤
【发布时间】:2020-02-11 09:15:46
【问题描述】:

我已经定义了 wdio.conf.js 文件(主文件)和环境特定的 dev-chrome.conf.js 文件。 我无法让黄瓜识别我的步骤定义文件夹。

这是我的结构:

这就是我在 dev-chrome.config.js 文件中的内容:

const wdioConfig = require('../../../../../wdio.conf.js');
const commands = require('../../../../../src/commands/commands');
wdioConfig.config.cucumberOpts = [{
// other stuff here
require:
    [
        './src/step_definitions/**/*.js',
        // Or search a (sub)folder for JS files with a wildcard
        // works since version 1.1 of the wdio-cucumber-framework
        //'./src/**/*.js',
    ],
// other stuff here
}];
exports.config = wdioConfig.config;

我收到一个错误:
“未定义步骤“当我将产品添加到购物车时”。您可以通过将 cucumberOpts.ignoreUndefinedDefinitions 设置为 true 来忽略此错误。”

当我在主 wdio.conf.js 文件上定义的步骤定义的路径相同时,它就可以工作。
我的主要 wdio.conf.js 文件位于项目的根文件夹中。

你知道我怎样才能让它在环境特定的 conf.js 文件中工作吗? 我正在使用@wdio/cucumber-framework": "^5.13.2"

【问题讨论】:

    标签: webdriver-io cucumberjs


    【解决方案1】:

    根据下面的示例配置,cucumberopts 应该是一个对象,我认为您正在尝试将其设置为一个数组。

    https://github.com/amiya-pattnaik/webdriverIO-with-cucumberBDD/blob/master/test/config/suite.cucumber.conf.js#L156

    也许你应该按照这个例子来帮助理解配置设置。

    干杯!

    【讨论】:

    • 这正是我的问题 :) 谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-16
    • 2020-12-12
    相关资源
    最近更新 更多