消息:功能在5000毫秒后超时 - 量角器& CucumberJS

时间:2016-08-31 16:11:16

标签: angularjs protractor e2e-testing cucumberjs webdriverjs

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

升级到上面的cucumberJs版本后,我一直收到此错误。

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

请注意我在黄瓜选项中包含了我的env.js 阻止,这是我的env.js内容:

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'
      }
};

以下是env.js文件 // features / support / env.js

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

module.exports = configure;

1 个答案:

答案 0 :(得分:0)

您已经增加了规范的超时,但我建议增加整体PageTimeout和脚本超时。

这些超时可能会覆盖您从env.js文件设置的Cucumber默认超时

尝试使用以下内容

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