Message: function timed out after 5000 milliseconds - Protractor & CucumberJS

假如想象 提交于 2019-12-21 21:03:06

问题


cucumberjs --version 1.2.2
protractor --version 4.0.1
Both installed globally via npm 

I keep getting this error after upgrading to cucumberJs version above.

Failures:

1) Scenario: Get records from DB
 e2e\features\transac.feature:7
   Step: Given I am logged in as "username" with "password"- e2e\features\transac.feature:8
   Step Definition: e2e\steps\loginSteps.js:17
   Message:
     function timed out after 5000 milliseconds

1 scenario (1 failed)
1 step (1 failed)
0m06.608s

Please note I included my env.js above in the cucumber options block and here's my env.js content:

exports.config = {
  // set to "custom" instead of cucumber.
  framework: 'custom',

  // path relative to the current config file
  frameworkPath: require.resolve('./node_modules/protractor-cucumber-framework'),

  // relevant cucumber command line options
  cucumberOpts: {
        require: [
          conf.paths.e2e + '/steps/**/*Steps.js',
          conf.paths.e2e + '/support/env.js',
        ],
        format: 'pretty'
      }
};

Here's the env.js file // features/support/env.js

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

module.exports = configure;

回答1:


You have increased the timeout of spec, but I would suggest increasing the overall PageTimeout and Script Timeout.

These timeouts might override the Cucumber default timeout you are setting from env.js file

Try with something like below

specs: ['./features/*.feature'], allScriptsTimeout: 50000, //This is the overall Timeout getPageTimeout: 50000, //This is the Page timeout cucumberOpts : { require : './features/LoginDefinitions.js', format : 'pretty' }



来源:https://stackoverflow.com/questions/39254392/message-function-timed-out-after-5000-milliseconds-protractor-cucumberjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!