2
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;
4

1 回答 1

0

您增加了规范的超时,但我建议增加整体 PageTimeout 和 Script Timeout。

这些超时可能会覆盖您从 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' }

于 2016-09-01T07:07:52.220 回答