diff --git a/modules/benchmarks/src/expanding_rows/BUILD.bazel b/modules/benchmarks/src/expanding_rows/BUILD.bazel index 2d1f00d691..0592ca38ca 100644 --- a/modules/benchmarks/src/expanding_rows/BUILD.bazel +++ b/modules/benchmarks/src/expanding_rows/BUILD.bazel @@ -1,5 +1,6 @@ package(default_visibility = ["//modules/benchmarks:__subpackages__"]) +load("//tools:defaults.bzl", "ts_library") load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle") load("@npm_bazel_typescript//:index.bzl", "ts_devserver") load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test") @@ -8,7 +9,7 @@ ng_module( name = "application_lib", srcs = glob( ["**/*.ts"], - exclude = ["**/*_spec.ts"], + exclude = ["**/*.spec.ts"], ), deps = [ "//packages:types", @@ -19,14 +20,13 @@ ng_module( ], ) -ng_module( - name = "application_spec", - srcs = glob(["**/*_spec.ts"]), +ts_library( + name = "perf_lib", + testonly = 1, + srcs = ["benchmark_perf.spec.ts"], deps = [ - "//packages:types", - "//packages/common", - "//packages/core", - "@npm//reflect-metadata", + "//modules/e2e_util", + "@npm//protractor", ], ) @@ -69,6 +69,6 @@ benchmark_test( name = "perf", server = ":prodserver", deps = [ - ":application_spec", + ":perf_lib", ], ) diff --git a/modules/benchmarks/src/expanding_rows/benchmark.ts b/modules/benchmarks/src/expanding_rows/benchmark.ts index c7c8b90640..2fc9492f0a 100644 --- a/modules/benchmarks/src/expanding_rows/benchmark.ts +++ b/modules/benchmarks/src/expanding_rows/benchmark.ts @@ -22,7 +22,7 @@ import {BenchmarkableExpandingRowModule} from './benchmarkable_expanding_row_mod
- +
@@ -38,6 +38,8 @@ export class InitializationRoot implements AfterViewInit { reset() { this.expandingRow.reset(); } + init() { this.expandingRow.init(); } + async runAll() { await execTimed('initialization_benchmark', async() => { await this.doInit(); }); } diff --git a/modules/benchmarks/src/expanding_rows/benchmark_perf.spec.ts b/modules/benchmarks/src/expanding_rows/benchmark_perf.spec.ts new file mode 100644 index 0000000000..d8aec894e3 --- /dev/null +++ b/modules/benchmarks/src/expanding_rows/benchmark_perf.spec.ts @@ -0,0 +1,26 @@ +/** + * @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 {$, browser} from 'protractor'; +import {runBenchmark} from '../../../e2e_util/perf_util'; + +describe('benchmarks', () => { + + it('should work for create', done => { + browser.rootEl = '#root'; + runBenchmark({ + id: 'create', + url: '', + ignoreBrowserSynchronization: true, + params: [], + prepare: () => $('#reset').click(), + work: () => $('#init').click() + }).then(done, done.fail); + }); + +}); diff --git a/modules/benchmarks/src/expanding_rows/benchmark_spec.ts b/modules/benchmarks/src/expanding_rows/benchmark_spec.ts deleted file mode 100644 index ed661f4edf..0000000000 --- a/modules/benchmarks/src/expanding_rows/benchmark_spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @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 {openTreeBenchmark, runTreeBenchmark} from './tree_perf_test_utils'; - -describe('benchmarks', () => { - - it('should work for createOnly', done => { - runTreeBenchmark({ - // This cannot be called "createOnly" because the actual destroy benchmark - // has the "createOnly" id already. See: https://github.com/angular/angular/pull/21503 - id: 'createOnlyForReal', - prepare: () => $('#destroyDom').click(), - work: () => $('#createDom').click() - }).then(done, done.fail); - }); - -}); diff --git a/modules/benchmarks/src/expanding_rows/index.html b/modules/benchmarks/src/expanding_rows/index.html index b4e258faa0..d514d50a2f 100644 --- a/modules/benchmarks/src/expanding_rows/index.html +++ b/modules/benchmarks/src/expanding_rows/index.html @@ -14,19 +14,24 @@ loading... diff --git a/protractor-perf.conf.js b/protractor-perf.conf.js index 2839079890..748ea12c2b 100644 --- a/protractor-perf.conf.js +++ b/protractor-perf.conf.js @@ -34,7 +34,7 @@ exports.config = { framework: 'jasmine2', jasmineNodeOpts: { showColors: true, - defaultTimeoutInterval: 60000, + defaultTimeoutInterval: 90000, print: function(msg) { console.log(msg); }, }, useAllAngular2AppRoots: true