2016-08-22 42 views
-3

我有分離的量角器規格的問題。我試圖劃分1個測試1規範。並得到了錯誤消息,像量角器jasmine2-protractor-util TypeError:無法讀取屬性'forEach'的undefined

E/launcher - Cannot read property 'forEach' of undefined E/launcher - TypeError: Cannot read property 'forEach' of undefined at C:\Users\mako\AppData\Roaming\npm\node_modules\jasmine2-protractor-utils\reporter\jasmine2_reporter.js:112:24 at Array.forEach (native) at self.jasmineDone (C:\Users\mako\AppData\Roaming\npm\node_modules\jasmine2-protractor-utils\reporter\jasmine2_reporter.js:108:16) at dispatch (C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1966:28) at ReportDispatcher.jasmineDone (C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1 949:11) at C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:758:18 at QueueRunner.clearStack (C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:660:9) at QueueRunner.run (C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1881:12) at C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1898:16 at C:\Users\mako\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1842:9 E/launcher - Process exited with error code 199

測試用例運行正常,所有套房都做了之後會發生錯誤。 如果規格超過「it」甚至爲空,問題就會消失。你有什麼想法可以成爲一個問題?

+2

能否請您發佈您的代碼? –

+1

發佈您的配置文件。 – Gunderson

回答

-1

我「解決」了問題。

/*plugins: [{ package: 'jasmine2-protractor-utils', disableHTMLReport: false, disableScreenshot: false, screenshotPath:'./test_results/E2E/screenshots', screenshotOnExpectFailure:true, screenshotOnSpecFailure:true, clearFoldersBeforeTest: true, htmlReportDir: './test_results/E2E/htmlReports', /*failTestOnErrorLog: { failTestOnErrorLogLevel: 900, excludeKeywords: ['keyword1', 'keyword2'] }*/ // }],

而且問題是插件 'jasmine2-量角器-utils的'。如果我有兩個規格和一個測試,每個錯誤都會發生。沒有這個插件,或者如果我將空測試添加到其中一個,它工作正常。

0

我會建議添加一段代碼,它返回一個承諾,您的onPrepare塊的量角器配置文件。

例如:

onPrepare: function() { 

     // returning the promise makes protractor wait for the reporter config before executing tests 
     return global.browser.getProcessedConfig().then(function (config) { 

     }); 
     } 
相關問題