it('displays user details on click', async(() => { ... // Locate the fetch button. let debugFetchButton = fixture.debugElement.query(By.css('button')); expect(debugFetchButton).not.toBe(null); // Trigger the click event through the DOM. debugFetchButton.nativeElement.click(); // Wait for the async getUsers to complete and Angular to become stable. fixture.whenStable().then(() => { // Trigger rendering component state to DOM. fixture.detectChanges(); // Check that the user list is displayed. ... }); }));