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 = { 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() { onPrepare: function() {
browser.ignoreSynchronization = true; patchProtractorWait(browser);
var _get = browser.get; // During benchmarking, we need to open a new browser
var sleepInterval = process.env.TRAVIS || process.env.JENKINS_URL ? 7000 : 3000; // for every benchmark, otherwise the numbers can get skewed
browser.get = function() { // from other benchmarks (e.g. Chrome keeps JIT caches, ...)
var result = _get.apply(this, arguments); if (argv['benchmark']) {
browser.sleep(sleepInterval); var originalBrowser = browser;
return result; 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) { exports.createBenchpressRunner = function(options) {
var nodeUuid = require('node-uuid'); var nodeUuid = require('node-uuid');
var benchpress = require('./dist/js/cjs/benchpress/benchpress'); var benchpress = require('./dist/js/cjs/benchpress/benchpress');