使用Protractor运行多个测试规范导致其中一些超时,导致以下错误:
Jasmine spec timed out. Resetting the WebDriver Control Flow.
失败并不一致;每次运行都没有相同的规格失败,但规格的百分比有所不同,并且它们会不时变化。下面是量角器的配置文件:
'use strict';
exports.config = {
baseUrl: 'http://www.example.com/',
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu"]
},
specs: 'specs/**/*Spec.js'
shardTestFiles: true,
maxInstances: 4
},
"scripts": {
"test": "protractor conf.js",
"test-in-parallel": "node -r parallel-protractor node_modules/.bin/protractor conf.js"
},
useAllAngular2AppRoots: true,
allScriptsTimeout: 30000,
getPageTimeout: 30000,
restartBrowserBetweenTests: true,
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},
onPrepare: function() {
browser.ignoreSynchronization = false;
}
};
注意:我已尝试增加Jasmine的超时间隔,但仍有一部分规格失败(他们只需花费较长时间)