2016-08-30 12:29:39 -04:00
|
|
|
/**
|
|
|
|
* @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 {openBrowser, verifyNoBrowserErrors} from 'e2e_util/e2e_util';
|
|
|
|
|
2016-08-30 17:17:37 -04:00
|
|
|
describe('tree benchmark spec', () => {
|
2016-08-30 12:29:39 -04:00
|
|
|
|
|
|
|
afterEach(verifyNoBrowserErrors);
|
|
|
|
|
2016-08-30 17:17:37 -04:00
|
|
|
it('should work for ng2', () => {
|
|
|
|
testTreeBenchmark({
|
|
|
|
url: 'all/benchmarks/src/tree/ng2/index.html',
|
2016-08-30 12:29:39 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-30 12:09:31 -04:00
|
|
|
it('should work for ng2 ftl', () => {
|
|
|
|
testTreeBenchmark({
|
|
|
|
url: 'all/benchmarks/src/tree/ng2_ftl/index.html',
|
|
|
|
// Can't use bundles as we use AoT generated code
|
|
|
|
// which relies on deep imports
|
|
|
|
extraParams: [{name: 'bundles', value: false}]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-01 13:29:35 -04:00
|
|
|
it('should work for ng2 static', () => {
|
|
|
|
testTreeBenchmark({
|
|
|
|
url: 'all/benchmarks/src/tree/ng2_static/index.html',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-30 12:09:31 -04:00
|
|
|
it('should work for ng2 static ftl', () => {
|
|
|
|
testTreeBenchmark({
|
|
|
|
url: 'all/benchmarks/src/tree/ng2_static_ftl/index.html',
|
|
|
|
// Can't use bundles as we use AoT generated code
|
|
|
|
// which relies on deep imports
|
|
|
|
extraParams: [{name: 'bundles', value: false}]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-01 19:56:45 -04:00
|
|
|
it('should work for ng2 switch', () => {
|
2016-08-30 17:17:37 -04:00
|
|
|
testTreeBenchmark({
|
2016-09-01 19:56:45 -04:00
|
|
|
url: 'all/benchmarks/src/tree/ng2_switch/index.html',
|
2016-08-30 12:29:39 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-01 19:56:45 -04:00
|
|
|
it('should work for the baseline', () => {
|
2016-09-01 13:31:11 -04:00
|
|
|
testTreeBenchmark({
|
2016-09-01 19:56:45 -04:00
|
|
|
url: 'all/benchmarks/src/tree/baseline/index.html',
|
2016-09-01 13:31:11 -04:00
|
|
|
ignoreBrowserSynchronization: true,
|
|
|
|
});
|
|
|
|
});
|
2016-09-01 13:31:31 -04:00
|
|
|
|
2016-09-01 19:56:45 -04:00
|
|
|
it('should work for incremental dom', () => {
|
2016-09-01 13:31:31 -04:00
|
|
|
testTreeBenchmark({
|
|
|
|
url: 'all/benchmarks/src/tree/incremental_dom/index.html',
|
|
|
|
ignoreBrowserSynchronization: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-08-30 16:44:52 -04:00
|
|
|
it('should work for polymer binary tree', () => {
|
2016-08-30 17:17:37 -04:00
|
|
|
testTreeBenchmark({
|
2016-08-30 12:29:39 -04:00
|
|
|
url: 'all/benchmarks/src/tree/polymer/index.html',
|
|
|
|
ignoreBrowserSynchronization: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-08-30 16:44:52 -04:00
|
|
|
it('should work for polymer leaves', () => {
|
2016-08-30 17:17:37 -04:00
|
|
|
testTreeBenchmark({
|
2016-08-30 16:44:52 -04:00
|
|
|
url: 'all/benchmarks/src/tree/polymer_leaves/index.html',
|
|
|
|
ignoreBrowserSynchronization: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-30 12:09:31 -04:00
|
|
|
function testTreeBenchmark(openConfig: {
|
|
|
|
url: string,
|
|
|
|
ignoreBrowserSynchronization?: boolean,
|
|
|
|
extraParams?: {name: string, value: any}[]
|
|
|
|
}) {
|
|
|
|
let params = [{name: 'depth', value: 4}];
|
|
|
|
if (openConfig.extraParams) {
|
|
|
|
params = params.concat(openConfig.extraParams);
|
|
|
|
}
|
2016-09-01 19:56:45 -04:00
|
|
|
openBrowser({
|
|
|
|
url: openConfig.url,
|
|
|
|
ignoreBrowserSynchronization: openConfig.ignoreBrowserSynchronization,
|
2016-09-30 12:09:31 -04:00
|
|
|
params: params,
|
2016-09-01 19:56:45 -04:00
|
|
|
});
|
2016-08-30 17:17:37 -04:00
|
|
|
$('#createDom').click();
|
|
|
|
expect($('#root').getText()).toContain('0');
|
2016-09-01 19:56:45 -04:00
|
|
|
$('#createDom').click();
|
|
|
|
expect($('#root').getText()).toContain('A');
|
2016-08-30 17:17:37 -04:00
|
|
|
$('#destroyDom').click();
|
|
|
|
expect($('#root').getText()).toEqual('');
|
|
|
|
}
|
2016-08-30 12:29:39 -04:00
|
|
|
});
|