2016-04-28 20:50:03 -04:00
|
|
|
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
|
|
|
|
import {runClickBenchmark} from '@angular/testing/src/perf_util';
|
2015-05-30 00:40:15 -04:00
|
|
|
|
|
|
|
describe('ng2 cost benchmark', function() {
|
|
|
|
|
|
|
|
var URL = 'benchmarks/src/costs/index.html';
|
|
|
|
|
|
|
|
// Number of components to create in a single iteration
|
|
|
|
var benchmarkSize = 200;
|
|
|
|
|
2015-05-30 11:17:27 -04:00
|
|
|
afterEach(verifyNoBrowserErrors);
|
2015-05-30 00:40:15 -04:00
|
|
|
|
|
|
|
it('should log stats for baseline (plain components)', function(done) {
|
2015-05-30 11:17:27 -04:00
|
|
|
runClickBenchmark({
|
|
|
|
url: URL,
|
|
|
|
buttons: ['#reset', '#createPlainComponents'],
|
|
|
|
id: 'ng2.costs.baseline',
|
|
|
|
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
|
|
|
|
}).then(done, done.fail);
|
2015-05-30 00:40:15 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should log stats for components with decorators', function(done) {
|
2015-05-30 11:17:27 -04:00
|
|
|
runClickBenchmark({
|
|
|
|
url: URL,
|
|
|
|
buttons: ['#reset', '#createComponentsWithDirectives'],
|
|
|
|
id: 'ng2.costs.decorators',
|
|
|
|
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
|
|
|
|
}).then(done, done.fail);
|
2015-05-30 00:40:15 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should log stats for dynamic components', function(done) {
|
2015-05-30 11:17:27 -04:00
|
|
|
runClickBenchmark({
|
|
|
|
url: URL,
|
|
|
|
buttons: ['#reset', '#createDynamicComponents'],
|
|
|
|
id: 'ng2.costs.dynamic',
|
|
|
|
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
|
|
|
|
}).then(done, done.fail);
|
2015-05-30 00:40:15 -04:00
|
|
|
});
|
|
|
|
});
|