feat(dev-infra): exposed new rule 'component_benchmark' via dev_infra (#36434)
* Move tools/brotli-cli, tools/browsers, tools/components, tools/ng_rollup_bundle, and modules/e2e_util to dev-infra/benchmarking * Fix imports and references to moved folders and files * Set up BUILD.bazel files for moved folders so they can be packaged with dev-infra's :npm_package PR Close #36434
This commit is contained in:
committed by
Andrew Kushnir
parent
e37f2663c2
commit
b7f2a033df
@@ -3,5 +3,4 @@ package(default_visibility = ["//visibility:public"])
|
||||
exports_files([
|
||||
"tsconfig-build.json",
|
||||
"tsconfig-e2e.json",
|
||||
"start-server.js",
|
||||
])
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
load("//tools:defaults.bzl", "protractor_web_test_suite")
|
||||
|
||||
"""
|
||||
Macro that can be used to define a benchmark test. This differentiates from
|
||||
a normal Protractor test suite because we specify a custom "perf" configuration
|
||||
that sets up "@angular/benchpress". Benchmark test targets will not run on CI
|
||||
unless explicitly requested.
|
||||
"""
|
||||
|
||||
def benchmark_test(name, server, tags = [], **kwargs):
|
||||
protractor_web_test_suite(
|
||||
name = name,
|
||||
configuration = "//:protractor-perf.conf.js",
|
||||
data = [
|
||||
"//packages/benchpress",
|
||||
],
|
||||
on_prepare = "//modules/benchmarks:start-server.js",
|
||||
server = server,
|
||||
# Benchmark targets should not run on CI by default.
|
||||
tags = tags + [
|
||||
"manual",
|
||||
"no-remote-exec",
|
||||
],
|
||||
test_suite_tags = [
|
||||
"manual",
|
||||
"no-remote-exec",
|
||||
],
|
||||
**kwargs
|
||||
)
|
||||
@@ -9,7 +9,7 @@ load("//tools:defaults.bzl", "protractor_web_test_suite")
|
||||
def e2e_test(name, server, **kwargs):
|
||||
protractor_web_test_suite(
|
||||
name = name,
|
||||
on_prepare = "//modules/benchmarks:start-server.js",
|
||||
on_prepare = "//dev-infra/benchmark/component_benchmark:start-server.js",
|
||||
server = server,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ ts_library(
|
||||
srcs = ["change_detection.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
@@ -26,7 +26,7 @@ ts_library(
|
||||
srcs = ["change_detection.e2e-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {$} from 'protractor';
|
||||
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('change detection benchmark', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$} from 'protractor';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
interface Worker {
|
||||
id: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$, browser} from 'protractor';
|
||||
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('class bindings perf', () => {
|
||||
it('should work for update', async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
|
||||
ng_module(
|
||||
name = "application_lib",
|
||||
@@ -26,7 +26,7 @@ ts_library(
|
||||
srcs = ["expanding_rows.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$, browser} from 'protractor';
|
||||
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('benchmarks', () => {
|
||||
it('should work for create', async () => {
|
||||
|
||||
@@ -8,7 +8,7 @@ ts_library(
|
||||
srcs = ["js-web-frameworks.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$} from 'protractor';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
interface Worker {
|
||||
id: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ ts_library(
|
||||
srcs = ["largeform.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
@@ -19,7 +19,7 @@ ts_library(
|
||||
srcs = ["largeform.e2e-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {$, By, element} from 'protractor';
|
||||
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('largeform benchmark', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
import {$} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
interface Worker {
|
||||
id: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -15,7 +15,7 @@ ts_library(
|
||||
srcs = ["largetable.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
@@ -26,7 +26,7 @@ ts_library(
|
||||
srcs = ["largetable.e2e-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {$} from 'protractor';
|
||||
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('largetable benchmark', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$} from 'protractor';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../e2e_util/perf_util';
|
||||
import {runBenchmark, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
interface Worker {
|
||||
id: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
ng_module(
|
||||
|
||||
@@ -8,7 +8,7 @@ ts_library(
|
||||
srcs = ["styling_perf.spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
*/
|
||||
|
||||
import {$, by, element} from 'protractor';
|
||||
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||
import {openBrowser, runBenchmark, verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
/** List of possible scenarios that should be tested. */
|
||||
const SCENARIOS = [
|
||||
|
||||
@@ -15,7 +15,7 @@ ts_library(
|
||||
srcs = ["test_utils.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
ng_module(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("//tools:defaults.bzl", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
|
||||
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {openBrowser} from '../../../e2e_util/e2e_util';
|
||||
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||
import {openBrowser, runBenchmark} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
export function runTreeBenchmark({id, prepare, setup, work}: {
|
||||
id: string; prepare ? () : void; setup ? () : void; work(): void;
|
||||
|
||||
@@ -1,18 +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
|
||||
*/
|
||||
|
||||
const protractorUtils = require('@bazel/protractor/protractor-utils');
|
||||
const protractor = require('protractor');
|
||||
|
||||
module.exports = async function(config) {
|
||||
const {port} = await protractorUtils.runServer(config.workspace, config.server, '-port', []);
|
||||
const processedConfig = await protractor.browser.getProcessedConfig();
|
||||
const serverUrl = `http://localhost:${port}`;
|
||||
|
||||
return processedConfig.baseUrl = protractor.browser.baseUrl = serverUrl;
|
||||
};
|
||||
@@ -14,7 +14,7 @@
|
||||
"rxjs/*": ["../../node_modules/rxjs/*"],
|
||||
"@angular/*": ["../../packages/*"],
|
||||
"zone.js/*": ["../../packages/zone.js/*"],
|
||||
"e2e_util/*": ["../e2e_util/*"]
|
||||
"dev_infra/*": ["../../dev-infra/*"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"inlineSourceMap": true,
|
||||
@@ -31,5 +31,6 @@
|
||||
"no-floating-promises": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true
|
||||
}
|
||||
},
|
||||
"include": ["../../dev-infra/benchmark/driver-utilities/"]
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "e2e_util",
|
||||
testonly = 1,
|
||||
srcs = glob(["*.ts"]),
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/benchpress",
|
||||
"@npm//@types/fs-extra",
|
||||
"@npm//@types/selenium-webdriver",
|
||||
"@npm//fs-extra",
|
||||
"@npm//node-uuid",
|
||||
"@npm//protractor",
|
||||
"@npm//selenium-webdriver",
|
||||
],
|
||||
)
|
||||
@@ -1,50 +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
|
||||
*/
|
||||
|
||||
/* tslint:disable:no-console */
|
||||
import {browser} from 'protractor';
|
||||
import * as webdriver from 'selenium-webdriver';
|
||||
|
||||
declare var expect: any;
|
||||
|
||||
export function openBrowser(config: {
|
||||
url: string,
|
||||
params?: {name: string, value: any}[],
|
||||
ignoreBrowserSynchronization?: boolean
|
||||
}) {
|
||||
if (config.ignoreBrowserSynchronization) {
|
||||
browser.ignoreSynchronization = true;
|
||||
}
|
||||
const urlParams: string[] = [];
|
||||
if (config.params) {
|
||||
config.params.forEach((param) => urlParams.push(param.name + '=' + param.value));
|
||||
}
|
||||
const url = encodeURI(config.url + '?' + urlParams.join('&'));
|
||||
browser.get(url);
|
||||
if (config.ignoreBrowserSynchronization) {
|
||||
browser.sleep(2000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental This API will be moved to Protractor.
|
||||
*/
|
||||
export function verifyNoBrowserErrors() {
|
||||
// TODO(tbosch): Bug in ChromeDriver: Need to execute at least one command
|
||||
// so that the browser logs can be read out!
|
||||
browser.executeScript('1+1');
|
||||
browser.manage().logs().get('browser').then(function(browserLog: any) {
|
||||
const filteredLog = browserLog.filter(function(logEntry: any) {
|
||||
if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
|
||||
console.log('>> ' + logEntry.message);
|
||||
}
|
||||
return logEntry.level.value > webdriver.logging.Level.WARNING.value;
|
||||
});
|
||||
expect(filteredLog).toEqual([]);
|
||||
});
|
||||
}
|
||||
@@ -1,75 +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
|
||||
*/
|
||||
export {verifyNoBrowserErrors} from './e2e_util';
|
||||
|
||||
const nodeUuid = require('node-uuid');
|
||||
import * as fs from 'fs-extra';
|
||||
|
||||
import {SeleniumWebDriverAdapter, Options, JsonFileReporter, Validator, RegressionSlopeValidator, ConsoleReporter, SizeValidator, MultiReporter, MultiMetric, Runner, StaticProvider} from '@angular/benchpress';
|
||||
import {openBrowser} from './e2e_util';
|
||||
|
||||
// Note: Keep the `modules/benchmarks/README.md` file in sync with the supported options.
|
||||
const globalOptions = {
|
||||
sampleSize: process.env.PERF_SAMPLE_SIZE || 20,
|
||||
forceGc: process.env.PERF_FORCE_GC === 'true',
|
||||
dryRun: process.env.PERF_DRYRUN === 'true',
|
||||
};
|
||||
|
||||
const runner = createBenchpressRunner();
|
||||
|
||||
export function runBenchmark(config: {
|
||||
id: string,
|
||||
url: string,
|
||||
params: {name: string, value: any}[],
|
||||
ignoreBrowserSynchronization?: boolean,
|
||||
microMetrics?: {[key: string]: string},
|
||||
work?: () => void,
|
||||
prepare?: () => void,
|
||||
setup?: () => void
|
||||
}): Promise<any> {
|
||||
openBrowser(config);
|
||||
if (config.setup) {
|
||||
config.setup();
|
||||
}
|
||||
const description: {[key: string]: any} = {};
|
||||
config.params.forEach((param) => description[param.name] = param.value);
|
||||
return runner.sample({
|
||||
id: config.id,
|
||||
execute: config.work,
|
||||
prepare: config.prepare,
|
||||
microMetrics: config.microMetrics,
|
||||
providers: [{provide: Options.SAMPLE_DESCRIPTION, useValue: {}}]
|
||||
});
|
||||
}
|
||||
|
||||
function createBenchpressRunner(): Runner {
|
||||
let runId = nodeUuid.v1();
|
||||
if (process.env.GIT_SHA) {
|
||||
runId = process.env.GIT_SHA + ' ' + runId;
|
||||
}
|
||||
const resultsFolder = './dist/benchmark_results';
|
||||
fs.ensureDirSync(resultsFolder);
|
||||
const providers: StaticProvider[] = [
|
||||
SeleniumWebDriverAdapter.PROTRACTOR_PROVIDERS,
|
||||
{provide: Options.FORCE_GC, useValue: globalOptions.forceGc},
|
||||
{provide: Options.DEFAULT_DESCRIPTION, useValue: {'runId': runId}}, JsonFileReporter.PROVIDERS,
|
||||
{provide: JsonFileReporter.PATH, useValue: resultsFolder}
|
||||
];
|
||||
if (!globalOptions.dryRun) {
|
||||
providers.push({provide: Validator, useExisting: RegressionSlopeValidator});
|
||||
providers.push(
|
||||
{provide: RegressionSlopeValidator.SAMPLE_SIZE, useValue: globalOptions.sampleSize});
|
||||
providers.push(MultiReporter.provideWith([ConsoleReporter, JsonFileReporter]));
|
||||
} else {
|
||||
providers.push({provide: Validator, useExisting: SizeValidator});
|
||||
providers.push({provide: SizeValidator.SAMPLE_SIZE, useValue: 1});
|
||||
providers.push(MultiReporter.provideWith([]));
|
||||
providers.push(MultiMetric.provideWith([]));
|
||||
}
|
||||
return new Runner(providers);
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
import {$, browser} from 'protractor';
|
||||
import {promise} from 'selenium-webdriver';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('async', () => {
|
||||
const URL = '/';
|
||||
|
||||
@@ -7,7 +7,7 @@ def example_test(name, srcs, server, data = [], **kwargs):
|
||||
srcs = srcs,
|
||||
tsconfig = "//modules/playground:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"//dev-infra/benchmark/driver-utilities",
|
||||
"//packages/private/testing",
|
||||
"@npm//@types/jasminewd2",
|
||||
"@npm//@types/selenium-webdriver",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('hello world', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('http', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('jsonp', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
const Key = protractor.Key;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('Model-Driven Forms', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('Order Management CRUD', function() {
|
||||
const URL = '/';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('Person Management CRUD', function() {
|
||||
const URL = '/';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {$, browser, by, element, ExpectedConditions} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
function waitForElement(selector: string) {
|
||||
// Waits for the element with id 'abc' to be present on the dom.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {$, browser, by, element, ExpectedConditions} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
function waitForElement(selector: string) {
|
||||
// Waits for the element with id 'abc' to be present on the dom.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('SVG', function() {
|
||||
const URL = '/';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('Template-Driven Forms', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('ngUpgrade', function() {
|
||||
const URL = '/';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
|
||||
// Disabled because with ViewEngine animations within webworkers is not supported.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, ExpectedConditions, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('WebWorkers Input', function() {
|
||||
afterEach(() => {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, ExpectedConditions, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('WebWorkers Kitchen Sink', function() {
|
||||
afterEach(() => {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, ExpectedConditions, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
const URL = '/';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('WebWorker Router', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element, protractor} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('WebWorkers Todo', function() {
|
||||
afterEach(() => {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
import {verifyNoBrowserErrors} from '../../../../dev-infra/benchmark/driver-utilities';
|
||||
|
||||
describe('Zippy Component', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"types": ["angular"]
|
||||
},
|
||||
"exclude": [
|
||||
"benchmarks_external",
|
||||
"payload_tests",
|
||||
"playground/",
|
||||
"benchmarks/"
|
||||
|
||||
Reference in New Issue
Block a user