so you mean all three cases can run on non-browser? To start, create a new Angular application by typing ng new angular-component-testing from your terminal. I typed this code here. AfterViewInit is a life-cycle method of components that gets called when the view of the component is completely rendered. . This is because the queryselector works only in the browser. 2016-2023 All Rights Reserved www.itsolutionstuff.com, Angular 11/10 Crop Image Before Upload with Preview Example, Angular 10 Custom Validator Tutorial Example, Angular 10 Reactive Forms Validation Example. If so, why does the artcile on my OP describe like those two test bases from my second questions throw error? In this first example, the first