refactor(perf): move navigation into test files and rename `runSimpleBenchmark`

This commit is contained in:
Tobias Bosch 2014-12-29 16:15:41 -08:00
parent 35ac3f3d97
commit 3a80c4197d
8 changed files with 31 additions and 36 deletions

View File

@ -8,16 +8,16 @@ describe('ng2 change detection benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log ng stats', function() { it('should log ng stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#ng2DetectChanges'], buttons: ['#ng2DetectChanges'],
name: browser.params.lang+'.ng2.changeDetection' name: browser.params.lang+'.ng2.changeDetection'
}); });
}); });
it('should log baseline stats', function() { it('should log baseline stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#baselineDetectChanges'], buttons: ['#baselineDetectChanges'],
name: browser.params.lang+'.baseline.changeDetection' name: browser.params.lang+'.baseline.changeDetection'
}); });

View File

@ -8,16 +8,16 @@ describe('ng2 compiler benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log withBindings stats', function() { it('should log withBindings stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#compileWithBindings'], buttons: ['#compileWithBindings'],
name: browser.params.lang+'.ng2.compile.withBindings' name: browser.params.lang+'.ng2.compile.withBindings'
}); });
}); });
it('should log noBindings stats', function() { it('should log noBindings stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#compileNoBindings'], buttons: ['#compileNoBindings'],
name: browser.params.lang+'.ng2.compile.noBindings' name: browser.params.lang+'.ng2.compile.noBindings'
}); });

View File

@ -8,32 +8,32 @@ describe('ng2 di benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log the stats for getByToken', function() { it('should log the stats for getByToken', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#getByToken'], buttons: ['#getByToken'],
name: browser.params.lang+'.ng2.di.getByToken' name: browser.params.lang+'.ng2.di.getByToken'
}); });
}); });
it('should log the stats for getByKey', function() { it('should log the stats for getByKey', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#getByKey'], buttons: ['#getByKey'],
name: browser.params.lang+'.ng2.di.getByKey' name: browser.params.lang+'.ng2.di.getByKey'
}); });
}); });
it('should log the stats for getChild', function() { it('should log the stats for getChild', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#getChild'], buttons: ['#getChild'],
name: browser.params.lang+'.ng2.di.getChild' name: browser.params.lang+'.ng2.di.getChild'
}); });
}); });
it('should log the stats for instantiate', function() { it('should log the stats for instantiate', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#instantiate'], buttons: ['#instantiate'],
name: browser.params.lang+'.ng2.di.instantiate' name: browser.params.lang+'.ng2.di.instantiate'
}); });

View File

@ -8,16 +8,16 @@ describe('ng2 element injector benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log the stats for instantiate', function() { it('should log the stats for instantiate', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#instantiate'], buttons: ['#instantiate'],
name: browser.params.lang+'.ng2.elementInjector.instantiate' name: browser.params.lang+'.ng2.elementInjector.instantiate'
}); });
}); });
it('should log the stats for instantiateDirectives', function() { it('should log the stats for instantiateDirectives', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#instantiateDirectives'], buttons: ['#instantiateDirectives'],
name: browser.params.lang+'.ng2.elementInjector.instantiateDirectives' name: browser.params.lang+'.ng2.elementInjector.instantiateDirectives'
}); });

View File

@ -8,16 +8,16 @@ describe('ng2 tree benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log the ng stats', function() { it('should log the ng stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#ng2DestroyDom', '#ng2CreateDom'], buttons: ['#ng2DestroyDom', '#ng2CreateDom'],
name: browser.params.lang+'.ng2.tree' name: browser.params.lang+'.ng2.tree'
}); });
}); });
it('should log the baseline stats', function() { it('should log the baseline stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#baselineDestroyDom', '#baselineCreateDom'], buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
name: browser.params.lang+'.baseline.tree' name: browser.params.lang+'.baseline.tree'
}); });

View File

@ -8,16 +8,15 @@ describe('ng1.x compiler benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log withBinding stats', function() { it('should log withBinding stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#compileWithBindings'], buttons: ['#compileWithBindings'],
name: browser.params.lang+'.ng1.compile.withBindings' name: browser.params.lang+'.ng1.compile.withBindings'
}); });
}); });
it('should log noBindings stats', function() { it('should log noBindings stats', function() {
util.runSimpleBenchmark({ util.runClickBenchmark({
url: URL,
buttons: ['#compileNoBindings'], buttons: ['#compileNoBindings'],
name: browser.params.lang+'.ng1.compile.noBindings' name: browser.params.lang+'.ng1.compile.noBindings'
}); });

View File

@ -8,8 +8,8 @@ describe('ng1.x tree benchmark', function () {
afterEach(util.verifyNoErrors); afterEach(util.verifyNoErrors);
it('should log the stats', function() { it('should log the stats', function() {
util.runSimpleBenchmark({ browser.get(URL);
url: URL, util.runClickBenchmark({
buttons: ['#destroyDom', '#createDom'], buttons: ['#destroyDom', '#createDom'],
name: browser.params.lang+'.ng1.tree' name: browser.params.lang+'.ng1.tree'
}); });

View File

@ -3,16 +3,12 @@ var webdriver = require('protractor/node_modules/selenium-webdriver');
module.exports = { module.exports = {
perfLogs: perfLogs, perfLogs: perfLogs,
sumTimelineRecords: sumTimelineRecords, sumTimelineRecords: sumTimelineRecords,
runSimpleBenchmark: runSimpleBenchmark, runClickBenchmark: runClickBenchmark,
verifyNoErrors: verifyNoErrors, verifyNoErrors: verifyNoErrors,
printObjectAsMarkdown: printObjectAsMarkdown printObjectAsMarkdown: printObjectAsMarkdown
}; };
// TODO: rename into runSimpleBenchmark function runClickBenchmark(config) {
function runSimpleBenchmark(config) {
// TODO: move this into the tests!
browser.get(config.url);
var buttons = config.buttons.map(function(selector) { var buttons = config.buttons.map(function(selector) {
return $(selector); return $(selector);
}); });