title: Angular 2 - How to inject service in a e2e test with protractor
body: <p>For my automation testing, I need to inject service to get the data and check if I am on the correct page or not. I dont want to use DOM for this, I want to check through my service.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import { CurrentEntityService } from "./../../app/services/current-entity.service";
          describe("App component", () =&gt; {
              it("check current entity name", inject([CurrentEntityService], (currentEntityService: CurrentEntityService) =&gt; {
                    browser.get("/tenants/");
                    expect(currentEntityService.entityName.value).toEqual("value");
                 }));
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run the test, the web driver runs  but it gives the following error</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> [17:15:38] I/testLogger - [firefox #01] PID: 28196
   [firefox #01] [17:15:34] I/direct - Using FirefoxDriver directly...
   [firefox #01] [17:15:37] I/runnerCli - undefined</code></pre>
  </div>
  </div>
  </p>
  
  <p>Do I need to do anything extra for using services in my e2e test? Why am I seeing this undefined error? Am I doing something wrong while injecting the service. Please point me out in the right direction for injecting a service in protractor test in angular 2. I am new to e2e testing. </p>