量角器3.0.0和黄瓜自动化测试

时间:2016-01-15 21:27:29

标签: javascript angularjs cucumber automated-tests protractor

我目前正在使用量角器,黄瓜和柴/柴作为我的自动化测试。我目前的代码是使用量角器1.8.0,我想将它更新到最新版本。问题是最新版本的量角器不支持黄瓜。

要使用黄瓜作为框架,量角器(http://angular.github.io/protractor/#/frameworks)指向您使用量角器 - 黄瓜 - 框架(https://github.com/mattfritz/protractor-cucumber-framework)。我已经尝试将它与我当前的代码和一些较小的示例项目集成,但没有运气让它们正常工作。我得到的主要错误是:

  

错误:在Timer.listOnTimeout上5000毫秒后步进超时   (timers.js:92:15)

我已尝试全局更改默认超时,因为黄瓜建议:// features / support / env.js

var configure = function () {
  this.setDefaultTimeout(60 * 1000);
};

module.exports = configure;

但我的设置似乎遗漏了一些东西。

那么,有没有人知道一个很好的例子可以告诉我新的量角器/黄瓜框架的正确设置?如果没有,有没有人知道一个示例,说明如何全局更改默认超时?

2 个答案:

答案 0 :(得分:6)

你应该添加

this.setDefaultTimeout(60000);

到您的step_def个文件中。例如:

module.exports = function () {

    this.setDefaultTimeout(60000);
    this.After(function (callback) { ... } 

}

或者您应该将//features/support/env.js添加到

cucumberOpts:{require:[' // features / support / env.js']}

使用stepDefinition文件进行数组

答案 1 :(得分:1)

thx到@Ivan, Product 21 22 23 Date 1/1/2001 1200.0 1000.0 1500.0 2/1/2001 300.0 200.0 NaN 3/1/2001 400.0 NaN NaN 4/1/2001 NaN 500.0 NaN cucumber-protractor-framework

在protractor.conf.js中

typescript

在src / env.ts中:

cucumberOpts: {
    compiler: "ts:ts-node/register",
    require: [
      './src/env.ts', //<- added
      './src/**/*.steps.ts'
    ]
  },