angular/modules/benchmarks/src/change_detection/change_detection.e2e-spec.ts
Joey Perrott 6f829180f7 build: update license headers to reference Google LLC (#37205)
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close #37205
2020-05-26 14:27:01 -04:00

38 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright Google LLC 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 {$} from 'protractor';
import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
describe('change detection benchmark', () => {
afterEach(verifyNoBrowserErrors);
it(`should render and update`, async () => {
openBrowser({
url: '',
ignoreBrowserSynchronization: true,
params: [{name: 'viewCount', value: 1}],
});
await $('#destroyDom').click();
expect(await $('#root').getText()).toEqual('');
await $('#createDom').click();
expect($('#root').getText()).toContain('1');
await $('#markInsertionComponentForCheck').click();
await $('#detectChanges').click();
// Ivy currently refreshes at *both* declaration and insertion while VE only refreshes at
// insertion. Simply assert that the view was updated at least once since the first update.
expect(Number(await $('#root').getText())).toBeGreaterThan(1);
// The button click causes change detection to trigger at the root
await $('#destroyDom').click();
expect(await $('#root').getText()).toEqual('');
});
});