最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - protractor 3.0.0 and cucumber automated testing - Stack Overflow

programmeradmin0浏览0评论

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);
发布评论

评论列表(0)

  1. 暂无评论