angular/modules/benchmarks/src/largeform/largeform.perf-spec.ts
2020-02-07 16:14:27 -08:00

51 lines
1.3 KiB
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {$} from 'protractor';
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
import {runBenchmark} from '../../../e2e_util/perf_util';
interface Worker {
id: string;
prepare?(): void;
work(): void;
}
const CreateAndDestroyWorker = {
id: 'createDestroy',
work: () => {
$('#createDom').click();
$('#destroyDom').click();
}
};
describe('largeform benchmark spec', () => {
afterEach(verifyNoBrowserErrors);
[CreateAndDestroyWorker].forEach((worker) => {
describe(worker.id, () => {
it('should run for ng2', async() => {
await runLargeFormBenchmark({url: '/', id: `largeform.ng2.${worker.id}`, worker: worker});
});
});
});
function runLargeFormBenchmark(
config: {id: string, url: string, ignoreBrowserSynchronization?: boolean, worker: Worker}) {
return runBenchmark({
id: config.id,
url: config.url,
params: [{name: 'copies', value: 8}],
ignoreBrowserSynchronization: config.ignoreBrowserSynchronization,
prepare: config.worker.prepare,
work: config.worker.work
});
}
});