title: How to wait for an xhr request in an angular test
body: <p>I have a component with a button. When the button is clicked, an HTTP request is made:</p>
  
  <pre><code>this.tokensService.create(this.userInCreation).subscribe(nextCb, errorCb);
  </code></pre>
  
  <p>How do I wait for this request to be completed? Using the <code>async</code> utility and <code>fixture.whenStable</code> does not help me.</p>
  
  <p>For example:</p>
  
  <pre><code>it('', async( async () =&gt; {
      fixture.detectChanges();
  
      appPage.loginButtonEl.click(); // XHR request is initiated here
      fixture.detectChanges();
  
      await fixture.whenStable();
  
      // HTTP request is still pending here
  }))
  </code></pre>