title: How to use predicate in angular2
body: <p>I have created a login page using <code>angular2</code>. It has two input field as <code>userName</code> and <code>password</code>. And there is a button in that login.
  When I'm going to write test case for that <code>loginComponent</code>, had to use <code>predicate</code> for recognize the <code>button</code>. Here is my test case.</p>
  
  <pre><code>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
  import { By } from '@angular/platform-browser';
  import { DebugElement } from '@angular/core';
  import { LoginComponent } from './login.component';
  
  
  export class LoginComponentTest {
    constructor(public loginComponent: LoginComponent){
      this.loginComponent.logIn('Chathura', '1234');
  
    }
  }
  
  describe('LoginComponent', () =&gt; {
    beforeEach(() =&gt; {
      TestBed.configureTestingModule({
        declarations: [
          LoginComponent
        ],
      })
    });
  
    const fixture = TestBed.createComponent(LoginComponent);
  
    const button = fixture.query(predicate: Predicate&lt;DebugElement&gt;, scope?: Function) : DebugElement
  
  });
  </code></pre>
  
  <p>I'm gonna test by providing input values then click the login button and look what happen next.</p>
  
  <p>I was unable to find correct tutorial to use predicate correctly.</p>