2016-08-31 56 views
2
cucumberjs --version 1.2.2 
protractor --version 4.0.1 
Both installed globally via npm 

我在升級到上面的cucumberJs版本後不斷收到此錯誤。消息:功能在5000毫秒後超時 - 量角器&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文件 //功能/支持/ env.js

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

module.exports = configure; 

回答

0

您已增加規範超時,但我會建議增加整體PageTimeout和腳本超時。

這些超時可能會覆蓋你從env.js設置黃瓜默認的超時文件

與嘗試的東西像下面

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

+0

不是爲我工作;如果你從windows命令行使用量角器運行你的測試並在Windows shell(命令提示符)中單擊,你將暫停命令執行;如果您然後在同一個Windows Shell中右鍵單擊,該命令將繼續運行,並且您會注意到它失敗並出現相同的錯誤,即功能在5000毫秒後超時;不知道爲什麼env.js超時不起作用 – pelican

+0

也許問題在於我如何運行測試?我可以做'吞食量角器'或'量角器protractor.conf.js',但我也注意到在網上的一些文章中他們用'cucumber-js'運行他們的測試;這是正確的方式? – pelican

+0

我跑我的'量角器protractor.conf.js'與..something像下面 '框架下的黃瓜選項中定義的規範測試:「自定義」, frameworkPath:require.resolve(「量角器黃瓜框架」) , cucumberOpts:{ require:'./features/LoginDefinitions.js', format:'pretty' } – AdityaReddy

相關問題