2014-12-22 17:50:10 -08:00
|
|
|
"use strict";
|
2015-01-06 15:19:22 -08:00
|
|
|
var benchpress = require('../../../tools/benchpress/index.js');
|
2014-12-22 17:50:10 -08:00
|
|
|
|
|
|
|
describe('ng2 di benchmark', function () {
|
|
|
|
|
|
|
|
var URL = 'benchmarks/web/di/di_benchmark.html';
|
|
|
|
|
2014-12-29 15:36:29 -08:00
|
|
|
afterEach(benchpress.verifyNoBrowserErrors);
|
2014-12-22 17:50:10 -08:00
|
|
|
|
|
|
|
it('should log the stats for getByToken', function() {
|
2014-12-29 16:15:41 -08:00
|
|
|
browser.get(URL);
|
2015-01-07 11:31:18 -08:00
|
|
|
runClickBenchmark({
|
2014-12-22 17:50:10 -08:00
|
|
|
buttons: ['#getByToken'],
|
2014-12-29 15:36:29 -08:00
|
|
|
logId: 'ng2.di.getByToken'
|
2014-12-22 17:50:10 -08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should log the stats for getByKey', function() {
|
2014-12-29 16:15:41 -08:00
|
|
|
browser.get(URL);
|
2015-01-07 11:31:18 -08:00
|
|
|
runClickBenchmark({
|
2014-12-22 17:50:10 -08:00
|
|
|
buttons: ['#getByKey'],
|
2014-12-29 15:36:29 -08:00
|
|
|
logId: 'ng2.di.getByKey'
|
2014-12-22 17:50:10 -08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should log the stats for getChild', function() {
|
2014-12-29 16:15:41 -08:00
|
|
|
browser.get(URL);
|
2015-01-07 11:31:18 -08:00
|
|
|
runClickBenchmark({
|
2014-12-22 17:50:10 -08:00
|
|
|
buttons: ['#getChild'],
|
2014-12-29 15:36:29 -08:00
|
|
|
logId: 'ng2.di.getChild'
|
2014-12-22 17:50:10 -08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should log the stats for instantiate', function() {
|
2014-12-29 16:15:41 -08:00
|
|
|
browser.get(URL);
|
2015-01-07 11:31:18 -08:00
|
|
|
runClickBenchmark({
|
2014-12-22 17:50:10 -08:00
|
|
|
buttons: ['#instantiate'],
|
2014-12-29 15:36:29 -08:00
|
|
|
logId: 'ng2.di.instantiate'
|
2014-12-22 17:50:10 -08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2014-12-29 15:36:29 -08:00
|
|
|
|
2015-01-07 11:31:18 -08:00
|
|
|
function runClickBenchmark(config) {
|
2014-12-29 15:36:29 -08:00
|
|
|
var buttons = config.buttons.map(function(selector) {
|
|
|
|
return $(selector);
|
|
|
|
});
|
2015-01-07 14:35:42 -08:00
|
|
|
var params = Object.create(browser.params.benchmark);
|
|
|
|
params.logId = browser.params.lang+'.'+config.logId;
|
|
|
|
benchpress.runBenchmark(params, function() {
|
2014-12-29 15:36:29 -08:00
|
|
|
buttons.forEach(function(button) {
|
|
|
|
button.click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|