forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlargeform_perf.ts
53 lines (46 loc) · 1.33 KB
/
largeform_perf.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* @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 {runBenchmark, verifyNoBrowserErrors} from 'e2e_util/perf_util';
import {$} from 'protractor';
interface Worker {
id: string;
prepare?(): void;
work(): void;
}
const CreateAndDestroyWorker: Worker = {
id: 'createDestroy',
work: () => {
$('#createDom').click();
$('#destroyDom').click();
}
};
describe('largeform benchmark perf', () => {
afterEach(verifyNoBrowserErrors);
[CreateAndDestroyWorker].forEach((worker) => {
describe(worker.id, () => {
it('should run for ng2', (done) => {
runLargeFormBenchmark({
id: `largeform.ng2.${worker.id}`,
url: 'all/benchmarks/src/largeform/ng2/index.html',
worker: worker
}).then(done, done.fail);
});
});
});
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
});
}
});