量角器jasmine2-protractor-util TypeError:无法读取未定义的属性'forEach'

时间:2016-08-22 12:55:23

标签: protractor jasmine2.0

我对分离的量角器规格有疑问。我试图划分1个测试1规格。并收到一条错误消息,如

16993: Locking /run/lock/locks-func1-b 16985: Locking /run/lock/locks-func1-a 16987: Locking /run/lock/locks-func1-a 16995: Locking /run/lock/locks-func1-b 16994: Locking /run/lock/locks-func1-a 16987: Locked /run/lock/locks-func1-a 16987: WORK 16999: Locking /run/lock/locks-func1-b 16995: Locked /run/lock/locks-func1-b 16995: WORK 16987: Release /run/lock/locks-func1-a 16995: Release /run/lock/locks-func1-b 16985: Locked /run/lock/locks-func1-a 16985: WORK 16993: Locked /run/lock/locks-func1-b 16993: WORK 16985: Release /run/lock/locks-func1-a 16993: Release /run/lock/locks-func1-b 16994: Locked /run/lock/locks-func1-a 16994: WORK 16999: Locked /run/lock/locks-func1-b 16999: WORK 16994: Release /run/lock/locks-func1-a 16999: Release /run/lock/locks-func1-b

测试用例运行正常,所有套件完成后都会发生错误。 如果规格超过“它”甚至是空的,问题就会消失。你有什么想法会有什么问题吗?

2 个答案:

答案 0 :(得分:0)

我建议在你的onPrepare Protractor配置文件块中添加一段返回promise的代码。

例如:

onPrepare: function () {

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

        });
        }

答案 1 :(得分:-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-protractor-utils'。如果我有两个规格和一个测试,则每个错误都会发生。没有这个插件或者如果我将空测试添加到其中一个,它工作正常。