build: convert largeform benchmarks to bazel (#28645)
Switches the `largeform` benchmarks to Bazel. This is the last remaining e2e test within `modules/`. PR Close #28645
This commit is contained in:
parent
13685131bc
commit
0a4811c4ad
|
@ -2,6 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
exports_files([
|
exports_files([
|
||||||
"tsconfig-build.json",
|
"tsconfig-build.json",
|
||||||
|
"tsconfig-e2e.json",
|
||||||
"start-server.js",
|
"start-server.js",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -1,35 +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 {openBrowser, verifyNoBrowserErrors} from 'e2e_util/e2e_util';
|
|
||||||
import {$, By, element} from 'protractor';
|
|
||||||
|
|
||||||
describe('largeform benchmark spec', () => {
|
|
||||||
|
|
||||||
afterEach(verifyNoBrowserErrors);
|
|
||||||
|
|
||||||
it('should work for ng2', () => {
|
|
||||||
testLargeformBenchmark({
|
|
||||||
url: 'all/benchmarks/src/largeform/ng2/index.html',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function testLargeformBenchmark(
|
|
||||||
openConfig: {url: string, ignoreBrowserSynchronization?: boolean}) {
|
|
||||||
openBrowser({
|
|
||||||
url: openConfig.url,
|
|
||||||
params: [{name: 'copies', value: 1}],
|
|
||||||
ignoreBrowserSynchronization: openConfig.ignoreBrowserSynchronization,
|
|
||||||
});
|
|
||||||
$('#createDom').click();
|
|
||||||
expect(element.all(By.css('input[name=value0]')).get(0).getAttribute('value'))
|
|
||||||
.toBe('someValue0');
|
|
||||||
$('#destroyDom').click();
|
|
||||||
expect(element.all(By.css('input[name=value0]')).count()).toBe(0);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||||
|
|
||||||
|
load("//tools:defaults.bzl", "ts_library")
|
||||||
|
|
||||||
|
ts_library(
|
||||||
|
name = "tests_lib",
|
||||||
|
testonly = 1,
|
||||||
|
srcs = ["largeform_perf.spec.ts"],
|
||||||
|
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||||
|
deps = [
|
||||||
|
"//modules/e2e_util",
|
||||||
|
"@ngdeps//@types/jasminewd2",
|
||||||
|
"@ngdeps//protractor",
|
||||||
|
],
|
||||||
|
)
|
|
@ -6,8 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {runBenchmark, verifyNoBrowserErrors} from 'e2e_util/perf_util';
|
import {$, By, element} from 'protractor';
|
||||||
import {$} from 'protractor';
|
|
||||||
|
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||||
|
import {runBenchmark} from '../../../e2e_util/perf_util';
|
||||||
|
|
||||||
interface Worker {
|
interface Worker {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -15,7 +17,7 @@ interface Worker {
|
||||||
work(): void;
|
work(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateAndDestroyWorker: Worker = {
|
const CreateAndDestroyWorker = {
|
||||||
id: 'createDestroy',
|
id: 'createDestroy',
|
||||||
work: () => {
|
work: () => {
|
||||||
$('#createDom').click();
|
$('#createDom').click();
|
||||||
|
@ -23,18 +25,28 @@ const CreateAndDestroyWorker: Worker = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('largeform benchmark perf', () => {
|
describe('largeform benchmark spec', () => {
|
||||||
|
|
||||||
afterEach(verifyNoBrowserErrors);
|
afterEach(verifyNoBrowserErrors);
|
||||||
|
|
||||||
|
it('should work for ng2', () => {
|
||||||
|
openBrowser({
|
||||||
|
url: '/',
|
||||||
|
params: [{name: 'copies', value: 1}],
|
||||||
|
ignoreBrowserSynchronization: true,
|
||||||
|
});
|
||||||
|
$('#createDom').click();
|
||||||
|
expect(element.all(By.css('input[name=value0]')).get(0).getAttribute('value'))
|
||||||
|
.toBe('someValue0');
|
||||||
|
$('#destroyDom').click();
|
||||||
|
expect(element.all(By.css('input[name=value0]')).count()).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
[CreateAndDestroyWorker].forEach((worker) => {
|
[CreateAndDestroyWorker].forEach((worker) => {
|
||||||
describe(worker.id, () => {
|
describe(worker.id, () => {
|
||||||
it('should run for ng2', done => {
|
it('should run for ng2', done => {
|
||||||
runLargeFormBenchmark({
|
runLargeFormBenchmark({url: '/', id: `largeform.ng2.${worker.id}`, worker: worker})
|
||||||
id: `largeform.ng2.${worker.id}`,
|
.then(done, done.fail);
|
||||||
url: 'all/benchmarks/src/largeform/ng2/index.html',
|
|
||||||
worker: worker
|
|
||||||
}).then(done, done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -0,0 +1,45 @@
|
||||||
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||||
|
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||||
|
|
||||||
|
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||||
|
|
||||||
|
# Note that this benchmark has been designed for Angular with ViewEngine, but once ViewEngine is
|
||||||
|
# removed, we should keep this benchmark and run it with Ivy (potentially rename it to "render3")
|
||||||
|
ng_module(
|
||||||
|
name = "ng2",
|
||||||
|
srcs = glob(["*.ts"]),
|
||||||
|
# FIXME-IVY(FW-998): ExpressionTranslatorVisitor#visitWriteKeyExpr is not implemented.
|
||||||
|
tags = ["fixme-ivy-aot"],
|
||||||
|
tsconfig = "//modules/benchmarks:tsconfig-build.json",
|
||||||
|
# TODO: FW-1004 Type checking is currently not complete.
|
||||||
|
type_check = False,
|
||||||
|
deps = [
|
||||||
|
"//modules/benchmarks/src:util_lib",
|
||||||
|
"//packages/core",
|
||||||
|
"//packages/forms",
|
||||||
|
"//packages/platform-browser",
|
||||||
|
"//packages/platform-browser-dynamic",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
ts_devserver(
|
||||||
|
name = "devserver",
|
||||||
|
entry_module = "angular/modules/benchmarks/src/largeform/ng2/index",
|
||||||
|
index_html = "index.html",
|
||||||
|
port = 4200,
|
||||||
|
scripts = ["@ngdeps//node_modules/tslib:tslib.js"],
|
||||||
|
static_files = [
|
||||||
|
"@ngdeps//node_modules/zone.js:dist/zone.js",
|
||||||
|
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
|
||||||
|
],
|
||||||
|
tags = ["fixme-ivy-aot"],
|
||||||
|
deps = [":ng2"],
|
||||||
|
)
|
||||||
|
|
||||||
|
benchmark_test(
|
||||||
|
name = "perf",
|
||||||
|
server = ":devserver",
|
||||||
|
tags = ["fixme-ivy-aot"],
|
||||||
|
deps = ["//modules/benchmarks/src/largeform:tests_lib"],
|
||||||
|
)
|
|
@ -19,11 +19,5 @@
|
||||||
<div>
|
<div>
|
||||||
<app id="root">Loading...</app>
|
<app id="root">Loading...</app>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
|
||||||
|| '../../bootstrap_ng2.js';
|
|
||||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -12,7 +12,5 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
import {AppModule} from './app';
|
import {AppModule} from './app';
|
||||||
import {init} from './init';
|
import {init} from './init';
|
||||||
|
|
||||||
export function main() {
|
enableProdMode();
|
||||||
enableProdMode();
|
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||||
|
|
||||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||||
|
|
||||||
|
# Note that this benchmark has been designed for Angular with ViewEngine, but once
|
||||||
|
# ViewEngine is removed, we should should consider removing this one since there
|
||||||
|
# already is a "render3" benchmark.
|
||||||
ng_module(
|
ng_module(
|
||||||
name = "ng2",
|
name = "ng2",
|
||||||
srcs = glob(["*.ts"]),
|
srcs = glob(["*.ts"]),
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["es2015"],
|
||||||
|
"types": ["node", "jasminewd2"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,15 +24,10 @@
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"angular1_router",
|
"angular1_router",
|
||||||
"benchmarks/e2e_test/old",
|
|
||||||
"benchmarks/src/old",
|
|
||||||
"benchmarks/src/**/index_aot.ts",
|
|
||||||
"benchmarks_external",
|
"benchmarks_external",
|
||||||
"payload_tests",
|
"payload_tests",
|
||||||
// Tests which are already migrated to Bazel:
|
|
||||||
"playground/",
|
"playground/",
|
||||||
"benchmarks/src/largetable",
|
"benchmarks/"
|
||||||
"benchmarks/src/tree"
|
|
||||||
],
|
],
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true
|
"skipTemplateCodegen": true
|
||||||
|
|
Loading…
Reference in New Issue