javascript - protractor 3.0.0 and cucumber automated testing - Stack Overflow

I am currently using protractor, cucumber and chaichai-as-promised for my automated tests. My current

I am currently using protractor, cucumber and chai/chai-as-promised for my automated tests. My current code is using protractor 1.8.0 and I would like to update it to the most recent version. The problem is that the most recent version of protractor doesn't support cucumber.

To use cucumber as your framework, protractor () points you to using protractor-cucumber-framework (). I have tried integrating this with my current code and some smaller example projects with no luck at getting them working. The main error I get is:

Error: Step timed out after 5000 milliseconds at Timer.listOnTimeout (timers.js:92:15)

I have tried changing the default timeout globally as cucumber suggests by:// features/support/env.js

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

module.exports = configure;

But I seem to be missing something with my setup.

So, does anyone know of a good example that can show me the proper setup for the new protractor/cucumber framework? If not, does anyone know of an example that shows how to change the default timeout globally?

I am currently using protractor, cucumber and chai/chai-as-promised for my automated tests. My current code is using protractor 1.8.0 and I would like to update it to the most recent version. The problem is that the most recent version of protractor doesn't support cucumber.

To use cucumber as your framework, protractor (http://angular.github.io/protractor/#/frameworks) points you to using protractor-cucumber-framework (https://github./mattfritz/protractor-cucumber-framework). I have tried integrating this with my current code and some smaller example projects with no luck at getting them working. The main error I get is:

Error: Step timed out after 5000 milliseconds at Timer.listOnTimeout (timers.js:92:15)

I have tried changing the default timeout globally as cucumber suggests by:// features/support/env.js

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

module.exports = configure;

But I seem to be missing something with my setup.

So, does anyone know of a good example that can show me the proper setup for the new protractor/cucumber framework? If not, does anyone know of an example that shows how to change the default timeout globally?

Share Improve this question edited Jan 15, 2016 at 21:39 yvesmancera 2,9255 gold badges26 silver badges33 bronze badges asked Jan 15, 2016 at 21:27 OttoOtto 331 silver badge7 bronze badges 1
  • stackoverflow./questions/23785700/… – prat meh Commented Apr 6, 2016 at 7:05
Add a ment  | 

2 Answers 2

Reset to default 7

You should add

this.setDefaultTimeout(60000);

to one of your step_def files. For example:

module.exports = function () {

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

}

Or you should add //features/support/env.js to

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

to array with your stepDefinition files

thx to @Ivan, with cucumber-protractor-framework and typescript:

in protractor.conf.js

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

in src/env.ts:

import {setDefaultTimeout} from 'cucumber';

setDefaultTimeout(9001);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742372246a4431469.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信