Skip to content

Commit beca48b

Browse files
committed
fixup! test(button-harness): add performance tests for buttons using the protractor harness env
1 parent bde69b6 commit beca48b

File tree

2 files changed

+118
-118
lines changed

2 files changed

+118
-118
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import {MatButtonModule} from '@angular/material/button';
1313
/** component: mat-raised-button-harness-test */
1414

1515
@Component({
16-
selector: 'app-root',
16+
selector: 'app-root',
1717
template: `
1818
<button *ngFor="let val of vals" mat-button> {{ val }} </button>
19-
`,
20-
encapsulation: ViewEncapsulation.None,
19+
`,
20+
encapsulation: ViewEncapsulation.None,
2121
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
2222
})
2323
export class ButtonHarnessTest {
24-
vals = Array.from({ length: 25 }, (_, i) => i);
24+
vals = Array.from({ length: 25 }, (_, i) => i);
2525
}
2626

2727
@NgModule({

test/benchmarks/material/button-harness/protractor.perf-spec.ts

Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -13,132 +13,132 @@ import {ProtractorHarnessEnvironment} from '@angular/cdk/testing/protractor';
1313
import {$$, element, by} from 'protractor';
1414

1515
describe('performance baseline for the protractor harness', () => {
16-
it('should retrieve all of the buttons', async () => {
17-
await runBenchmark({
18-
id: 'get-all-buttons',
19-
url: '',
20-
ignoreBrowserSynchronization: true,
21-
params: [],
22-
work: async () => $$('.mat-button'),
23-
});
24-
});
16+
it('should retrieve all of the buttons', async () => {
17+
await runBenchmark({
18+
id: 'get-all-buttons',
19+
url: '',
20+
ignoreBrowserSynchronization: true,
21+
params: [],
22+
work: async () => $$('.mat-button'),
23+
});
24+
});
2525

26-
it('should click the first button', async () => {
27-
await runBenchmark({
28-
id: 'click-first-button',
29-
url: '',
30-
ignoreBrowserSynchronization: true,
31-
params: [],
32-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
33-
work: async () => await element(by.buttonText('0')).click(),
34-
});
35-
});
26+
it('should click the first button', async () => {
27+
await runBenchmark({
28+
id: 'click-first-button',
29+
url: '',
30+
ignoreBrowserSynchronization: true,
31+
params: [],
32+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
33+
work: async () => await element(by.buttonText('0')).click(),
34+
});
35+
});
3636

37-
it('should click the middle button', async () => {
38-
await runBenchmark({
39-
id: 'click-middle-button',
40-
url: '',
41-
ignoreBrowserSynchronization: true,
42-
params: [],
43-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
44-
work: async () => await element(by.buttonText('12')).click(),
45-
});
46-
});
37+
it('should click the middle button', async () => {
38+
await runBenchmark({
39+
id: 'click-middle-button',
40+
url: '',
41+
ignoreBrowserSynchronization: true,
42+
params: [],
43+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
44+
work: async () => await element(by.buttonText('12')).click(),
45+
});
46+
});
4747

48-
it('should click the last button', async () => {
49-
await runBenchmark({
50-
id: 'click-last-button',
51-
url: '',
52-
ignoreBrowserSynchronization: true,
53-
params: [],
54-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
55-
work: async () => await element(by.buttonText('24')).click(),
56-
});
57-
});
48+
it('should click the last button', async () => {
49+
await runBenchmark({
50+
id: 'click-last-button',
51+
url: '',
52+
ignoreBrowserSynchronization: true,
53+
params: [],
54+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
55+
work: async () => await element(by.buttonText('24')).click(),
56+
});
57+
});
5858

59-
it('should click all of the buttons', async () => {
60-
await runBenchmark({
61-
id: 'click-every-button',
62-
url: '',
63-
ignoreBrowserSynchronization: true,
64-
params: [],
65-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
66-
work: async () => {
67-
const buttons = $$('.mat-button');
68-
await buttons.each(async (button) => await button!.click());
69-
}
70-
});
71-
});
59+
it('should click all of the buttons', async () => {
60+
await runBenchmark({
61+
id: 'click-every-button',
62+
url: '',
63+
ignoreBrowserSynchronization: true,
64+
params: [],
65+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
66+
work: async () => {
67+
const buttons = $$('.mat-button');
68+
await buttons.each(async (button) => await button!.click());
69+
}
70+
});
71+
});
7272
});
7373

7474
let loader: HarnessLoader;
7575

7676
describe('performance overhead of the protractor harness', () => {
77-
it('should load the protractor harness environment', async () => {
78-
await runBenchmark({
79-
id: 'initial-harness-load',
80-
url: '',
81-
ignoreBrowserSynchronization: true,
82-
params: [],
83-
work: () => { loader = ProtractorHarnessEnvironment.loader(); },
84-
});
85-
});
77+
it('should load the protractor harness environment', async () => {
78+
await runBenchmark({
79+
id: 'initial-harness-load',
80+
url: '',
81+
ignoreBrowserSynchronization: true,
82+
params: [],
83+
work: () => { loader = ProtractorHarnessEnvironment.loader(); },
84+
});
85+
});
8686

87-
it('should retrieve all of the buttons', async () => {
88-
await runBenchmark({
89-
id: 'get-all-buttons',
90-
url: '',
91-
ignoreBrowserSynchronization: true,
92-
params: [],
93-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
94-
work: async () => await loader.getAllHarnesses(MatButtonHarness),
95-
});
96-
});
87+
it('should retrieve all of the buttons', async () => {
88+
await runBenchmark({
89+
id: 'get-all-buttons',
90+
url: '',
91+
ignoreBrowserSynchronization: true,
92+
params: [],
93+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
94+
work: async () => await loader.getAllHarnesses(MatButtonHarness),
95+
});
96+
});
9797

98-
it('should click the first button', async () => {
99-
await runBenchmark({
100-
id: 'click-first-button',
101-
url: '',
102-
ignoreBrowserSynchronization: true,
103-
params: [],
104-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
105-
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '0'}))).click(),
106-
});
107-
});
98+
it('should click the first button', async () => {
99+
await runBenchmark({
100+
id: 'click-first-button',
101+
url: '',
102+
ignoreBrowserSynchronization: true,
103+
params: [],
104+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
105+
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '0'}))).click(),
106+
});
107+
});
108108

109-
it('should click the middle button', async () => {
110-
await runBenchmark({
111-
id: 'click-middle-button',
112-
url: '',
113-
ignoreBrowserSynchronization: true,
114-
params: [],
115-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
116-
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '12'}))).click(),
117-
});
118-
});
109+
it('should click the middle button', async () => {
110+
await runBenchmark({
111+
id: 'click-middle-button',
112+
url: '',
113+
ignoreBrowserSynchronization: true,
114+
params: [],
115+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
116+
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '12'}))).click(),
117+
});
118+
});
119119

120-
it('should click the last button', async () => {
121-
await runBenchmark({
122-
id: 'click-last-button',
123-
url: '',
124-
ignoreBrowserSynchronization: true,
125-
params: [],
126-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
127-
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '24'}))).click(),
128-
});
129-
});
120+
it('should click the last button', async () => {
121+
await runBenchmark({
122+
id: 'click-last-button',
123+
url: '',
124+
ignoreBrowserSynchronization: true,
125+
params: [],
126+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
127+
work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '24'}))).click(),
128+
});
129+
});
130130

131-
it('should click all of the buttons', async () => {
132-
await runBenchmark({
133-
id: 'click-every-button',
134-
url: '',
135-
ignoreBrowserSynchronization: true,
136-
params: [],
137-
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
138-
work: async () => {
139-
const buttons = await loader.getAllHarnesses(MatButtonHarness);
140-
buttons.forEach(async (button) => await button.click());
141-
}
142-
});
143-
});
131+
it('should click all of the buttons', async () => {
132+
await runBenchmark({
133+
id: 'click-every-button',
134+
url: '',
135+
ignoreBrowserSynchronization: true,
136+
params: [],
137+
setup: () => { loader = ProtractorHarnessEnvironment.loader(); },
138+
work: async () => {
139+
const buttons = await loader.getAllHarnesses(MatButtonHarness);
140+
buttons.forEach(async (button) => await button.click());
141+
}
142+
});
143+
});
144144
});

0 commit comments

Comments
 (0)