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);
it('should log ng stats', function() {
util.runSimpleBenchmark({
url: URL,
browser.get(URL);
util.runClickBenchmark({
buttons: ['#ng2DetectChanges'],
name: browser.params.lang+'.ng2.changeDetection'
});
});
it('should log baseline stats', function() {
util.runSimpleBenchmark({
url: URL,
browser.get(URL);
util.runClickBenchmark({
buttons: ['#baselineDetectChanges'],
name: browser.params.lang+'.baseline.changeDetection'
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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