fix(src/reflection && src/test_lib): Fixes bugs that caused benchmarks to fail.

Adjusts src/test_lib files to adhere to common TS module practices. Fixes bug with all files that causes benchmarks to fail.
This commit is contained in:
Ian Riley
2015-06-01 17:33:51 -07:00
committed by Tobias Bosch
parent 0602f68ae3
commit 9e36539052
4 changed files with 25 additions and 20 deletions

View File

@ -40,3 +40,11 @@ export function microBenchmark(name, iterationCount, callback) {
callback();
window.console.timeEnd(durationName);
}
export function windowProfile(name: string): void {
(<any>window.console).profile(name);
}
export function windowProfileEnd(name: string): void {
(<any>window.console).profileEnd(name);
}

View File

@ -1,5 +1,6 @@
/// <reference path="../../typings/node/node.d.ts" />
/// <reference path="../../typings/angular-protractor/angular-protractor.d.ts" />
/// <reference path="../../typings/jasmine/jasmine"/>
import webdriver = require('selenium-webdriver');

View File

@ -1,23 +1,14 @@
/// <reference path="../../typings/node/node.d.ts" />
/// <reference path="../../typings/angular-protractor/angular-protractor.d.ts" />
export {verifyNoBrowserErrors} from './e2e_util';
var testUtil = require('./e2e_util');
import {bind, Options} from 'benchpress/benchpress';
var benchpress = require('benchpress/benchpress');
module.exports = {
runClickBenchmark: runClickBenchmark,
runBenchmark: runBenchmark,
verifyNoBrowserErrors: testUtil.verifyNoBrowserErrors
};
function runClickBenchmark(config) {
export function runClickBenchmark(config) {
var buttons = config.buttons.map(function(selector) { return $(selector); });
config.work = function() { buttons.forEach(function(button) { button.click(); }); };
return runBenchmark(config);
}
function runBenchmark(config) {
export function runBenchmark(config) {
return getScaleFactor(browser.params.benchmark.scaling)
.then(function(scaleFactor) {
var description = {};
@ -32,13 +23,12 @@ function runBenchmark(config) {
}
var url = encodeURI(config.url + '?' + urlParams.join('&'));
return browser.get(url).then(function() {
return new benchpress.Runner().sample({
return global['benchpressRunner'].sample({
id: config.id,
execute: config.work,
prepare: config.prepare,
microMetrics: config.microMetrics,
bindings:
[benchpress.bind(benchpress.Options.SAMPLE_DESCRIPTION).toValue(description)]
bindings: [bind(Options.SAMPLE_DESCRIPTION).toValue(description)]
});
});
});