fix(build): open new window for every benchmark

This commit is contained in:
Tobias Bosch 2015-03-04 10:27:26 -08:00
parent 91426a8efe
commit eb6385e143
1 changed files with 32 additions and 10 deletions

View File

@ -122,17 +122,25 @@ var getBenchmarkFiles = function (benchmark, spec) {
};
var config = exports.config = {
// Disable waiting for Angular as we don't have an integration layer yet...
// TODO(tbosch): Implement a proper debugging API for Ng2.0, remove this here
// and the sleeps in all tests.
onPrepare: function() {
browser.ignoreSynchronization = true;
var _get = browser.get;
var sleepInterval = process.env.TRAVIS || process.env.JENKINS_URL ? 7000 : 3000;
browser.get = function() {
var result = _get.apply(this, arguments);
browser.sleep(sleepInterval);
return result;
patchProtractorWait(browser);
// During benchmarking, we need to open a new browser
// for every benchmark, otherwise the numbers can get skewed
// from other benchmarks (e.g. Chrome keeps JIT caches, ...)
if (argv['benchmark']) {
var originalBrowser = browser;
var _tmpBrowser;
beforeEach(function() {
global.browser = originalBrowser.forkNewDriverInstance();
patchProtractorWait(global.browser);
global.element = global.browser.element;
global.$ = global.browser.$;
global.$$ = global.browser.$$;
});
afterEach(function() {
global.browser.quit();
global.browser = originalBrowser;
});
}
},
@ -166,6 +174,20 @@ var config = exports.config = {
}
};
// Disable waiting for Angular as we don't have an integration layer yet...
// TODO(tbosch): Implement a proper debugging API for Ng2.0, remove this here
// and the sleeps in all tests.
function patchProtractorWait(browser) {
browser.ignoreSynchronization = true;
var _get = browser.get;
var sleepInterval = process.env.TRAVIS || process.env.JENKINS_URL ? 7000 : 3000;
browser.get = function() {
var result = _get.apply(this, arguments);
browser.sleep(sleepInterval);
return result;
}
}
exports.createBenchpressRunner = function(options) {
var nodeUuid = require('node-uuid');
var benchpress = require('./dist/js/cjs/benchpress/benchpress');