|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google LLC All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.io/license |
| 7 | + */ |
| 8 | + |
| 9 | +import {HarnessLoader} from '@angular/cdk/testing'; |
| 10 | +import {MatButtonHarness} from '@angular/material/button/testing/button-harness'; |
| 11 | +import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities'; |
| 12 | +import {ProtractorHarnessEnvironment} from '@angular/cdk/testing/protractor'; |
| 13 | + |
| 14 | +let loader: HarnessLoader; |
| 15 | + |
| 16 | +describe('perf test for basic protractor harness', () => { |
| 17 | + it('should load the protractor harness environment', async () => { |
| 18 | + await runBenchmark({ |
| 19 | + id: 'initial-harness-load', |
| 20 | + url: '', |
| 21 | + ignoreBrowserSynchronization: true, |
| 22 | + params: [], |
| 23 | + work: () => { loader = ProtractorHarnessEnvironment.loader(); }, |
| 24 | + }); |
| 25 | + }); |
| 26 | + |
| 27 | + it('should retrieve all of the buttons', async () => { |
| 28 | + await runBenchmark({ |
| 29 | + id: 'get-first-button', |
| 30 | + url: '', |
| 31 | + ignoreBrowserSynchronization: true, |
| 32 | + params: [], |
| 33 | + setup: () => { loader = ProtractorHarnessEnvironment.loader(); }, |
| 34 | + work: async () => await loader.getAllHarnesses(MatButtonHarness), |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + it('should retrieve the first button', async () => { |
| 39 | + await runBenchmark({ |
| 40 | + id: 'get-first-button', |
| 41 | + url: '', |
| 42 | + ignoreBrowserSynchronization: true, |
| 43 | + params: [], |
| 44 | + setup: () => { loader = ProtractorHarnessEnvironment.loader(); }, |
| 45 | + work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '0'}))).click(), |
| 46 | + }); |
| 47 | + }); |
| 48 | + |
| 49 | + it('should retrieve the middle button', async () => { |
| 50 | + await runBenchmark({ |
| 51 | + id: 'get-middle-button', |
| 52 | + url: '', |
| 53 | + ignoreBrowserSynchronization: true, |
| 54 | + params: [], |
| 55 | + setup: () => { loader = ProtractorHarnessEnvironment.loader(); }, |
| 56 | + work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '49'}))).click(), |
| 57 | + }); |
| 58 | + }); |
| 59 | + |
| 60 | + it('should retrieve the last button', async () => { |
| 61 | + await runBenchmark({ |
| 62 | + id: 'get-last-button', |
| 63 | + url: '', |
| 64 | + ignoreBrowserSynchronization: true, |
| 65 | + params: [], |
| 66 | + setup: () => { loader = ProtractorHarnessEnvironment.loader(); }, |
| 67 | + work: async () => await (await loader.getHarness(MatButtonHarness.with({text: '99'}))).click(), |
| 68 | + }); |
| 69 | + }); |
| 70 | +}); |
0 commit comments