title: what is the real difference between ng test and ng e2e
body: <p>I am afraid someone close my question but I couldn't find a satisfying question (maybe because I am very limited in Angular 2+ world and I understood something wrong).</p>
  
  <p>As far as I could understand after few Hello World done and few YouTube demo watched:</p>
  
  <p>ng test:</p>
  
  <ul>
  <li>you write your test using Jasmine language</li>
  <li>you test your test with many Browsers available using Karma</li>
  <li>you execute either unit or integrated testing</li>
  <li>all <code>xxx.compnent.spec.ts</code> run and a final report similar to JUnit is showed in browser</li>
  </ul>
  
  <p>ng e2e:</p>
  
  <ul>
  <li>you write your test using Jasmine language</li>
  <li>you test your test with many Browsers available using Karma</li>
  <li><p>you write your tests with nesting user event in mind </p>
  
  <pre><code>eg. page.navigateTo();
  page.getParagraphText()
    .then(msg =&gt; expect(msg).toEqual('Welcome to app!!'))
    .then(msg =&gt; expect(msg).toEqual('xxx'))
    .then(done, done.fail);
  </code></pre></li>
  <li><p>you execute End to End test using protractor mainly after deployed the application a kind of pre-production environment</p></li>
  <li>the tests under e2e folder are triggered and the result is printed in command line console</li>
  </ul>
  
  <p>Theoracly saying, the second is specific for end to end where the focus is to simulate a entire flow done by an end user.</p>
  
  <p>Hopefully, until here is correct, I am wondering what is happening behind the scene that really make them different. I don't want to compare which is better but certainly I am missing some point somehow because I created few tests using exact same idea done by end user and I triggered it by ng test.</p>
  
  <p>For instance:</p>
  
  <pre><code>...
  
  it('should display the modal when `create Paste` is clicked', () =&gt; {
  
      let createPasteButton = fixture.debugElement.query(By.css("button"));
      //create a spy on the createPaste  method
      spyOn(component,"createPaste").and.callThrough();
  
      //triggerEventHandler simulates a click event on the button object
      createPasteButton.triggerEventHandler('click',null);
  
      //spy checks whether the method was called
      expect(component.createPaste).toHaveBeenCalled();
      fixture.detectChanges();
      expect(component.showModal).toBeTruthy("showModal should now be true");
      expect(element.innerHTML).toContain("source-modal");
  });
  
  ...
  </code></pre>
  
  <p>I remenbered I read something like "protractor offer a waiting/sleeping behaviour during tests execution" but I can't see where this aggregate value when I see the tests done without protractor been able to simulate a final user as well. As long as you code your tests to do exact same flow done by an end user it will be same e2e test propose under e2e folder created by Angular Cli.</p>
  
  <p>If my study drove me to correctly understanding as posted above then, the only real difference is the way I, as developer, is organizing my tests. There is nothing really different happening behind the scene.</p>
  
  <p>Again, I would appreciate see this as clarifing question for didatic purpose: there is no intention to compare frameworks here at all.</p>