Skip to content

Commit 0ea4cd7

Browse files
committed
test(button-harness): add performance tests for buttons using the protractor harness env
* The main thing we are looking at here is not the button's performance. Instead we are looking at the performance overhead of using the protractor and testbed harness env. * We are running tests with & without the ProtractorHarnessEnvironment and with & without the TestbedHarnessEnvironment. * We are benchmarking 5 operations with a varying number of buttons: 1. Get the first button 2. Click the first button 3. Click the middle button 4. Click the last button 5. Click every button
1 parent bf914ae commit 0ea4cd7

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

test/benchmarks/material/button-harness/BUILD.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark")
2+
<<<<<<< HEAD
23
load("//tools:defaults.bzl", "ng_test_library", "ng_web_test_suite", "ts_library")
34

45
package(default_visibility = ["//visibility:public"])
@@ -38,14 +39,29 @@ component_benchmark(
3839
driver_deps = [
3940
":constants",
4041
":protractor-benchmark-utilities",
42+
=======
43+
load("//tools:defaults.bzl", "ng_e2e_test_library", "ng_test_library", "ng_web_test_suite", "ts_library")
44+
45+
# TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with
46+
# stylesUrls inside the components once `component_benchmark` supports asset injection.
47+
48+
component_benchmark(
49+
name = "benchmark",
50+
driver = ":protractor.perf-spec.ts",
51+
driver_deps = [
52+
"@npm//@angular/dev-infra-private",
53+
>>>>>>> e2db57750 (test(button-harness): add performance tests for buttons using the protractor harness env)
4154
"@npm//protractor",
4255
"@npm//@types/jasmine",
4356
"//src/cdk/testing",
4457
"//src/material/button/testing",
4558
"//src/cdk/testing/protractor",
4659
],
4760
ng_deps = [
61+
<<<<<<< HEAD
4862
":constants",
63+
=======
64+
>>>>>>> e2db57750 (test(button-harness): add performance tests for buttons using the protractor harness env)
4965
"@npm//@angular/core",
5066
"@npm//@angular/platform-browser",
5167
"//src/material/button",
@@ -54,6 +70,7 @@ component_benchmark(
5470
prefix = "",
5571
styles = ["//src/material/prebuilt-themes:indigo-pink"],
5672
)
73+
<<<<<<< HEAD
5774

5875
# TestbedHarnessEnvironment
5976

@@ -75,3 +92,5 @@ ng_web_test_suite(
7592
name = "unit_benchmark_tests",
7693
deps = [":unit_tests_lib"],
7794
)
95+
=======
96+
>>>>>>> e2db57750 (test(button-harness): add performance tests for buttons using the protractor harness env)

test/benchmarks/material/button-harness/app.module.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {Component, NgModule, ViewEncapsulation} from '@angular/core';
1010
import {BrowserModule} from '@angular/platform-browser';
1111
import {MatButtonModule} from '@angular/material/button';
12+
<<<<<<< HEAD
1213
import {NUM_BUTTONS} from './constants';
1314

1415
/** component: mat-button-harness-test */
@@ -23,6 +24,21 @@ import {NUM_BUTTONS} from './constants';
2324
})
2425
export class ButtonHarnessTest {
2526
vals = Array.from({ length: NUM_BUTTONS }, (_, i) => i);
27+
=======
28+
29+
/** component: mat-raised-button-harness-test */
30+
31+
@Component({
32+
selector: 'app-root',
33+
template: `
34+
<button *ngFor="let val of vals" mat-button> {{ val }} </button>
35+
`,
36+
encapsulation: ViewEncapsulation.None,
37+
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
38+
})
39+
export class ButtonHarnessTest {
40+
vals = Array.from({ length: 100 }, (_, i) => i);
41+
>>>>>>> e2db57750 (test(button-harness): add performance tests for buttons using the protractor harness env)
2642
}
2743

2844
@NgModule({

0 commit comments

Comments
 (0)