title: Protractor Test Scripts are executing faster than the page load
body: <p>I am automating an angular js website which has a login functionality. All I want to Click on sign in link and enter username and password. But Somehow my script are executing really fast than the page load. Please advice me on how I can handle this: 
  My Login Page object is:</p>
  
  <pre><code>'use strict'
  // Normal Login 
  require('../page-objects/loginPage.js');
  var customerPortalHome = function () {
  
      this.clickSignIn = function () {
          browser.sleep(5000);
          element(by.linkText('Sign In')).click();
          browser.waitForAngular();
          browser.sleep(2000);
          return require('./loginPage.js');
  
      }
  
  }
  
  
  module.exports = new customerPortalHome();
  </code></pre>
  
  <p>My Test Spec is; </p>
  
  <pre><code>var co = require('co');
  var UI = require('./ui.js');
  var ui = new UI();
  var CustomerPage = require('../page-objects/customerPortalHome.js')
  
  describe(" Smoke Test Login to the application", function () {
  
          it("test", co.wrap(function* () {
              var EC = protractor.ExpectedConditions;
               browser.get(ui.createStartLink());
              expect(browser.getTitle()).toContain("Portal");
              // Verify if user is able to Login into the application
              var loginPage =  CustomerPage.clickSignIn();
              loginPage.switchToFrame('account-sdk');
              var reportPage = loginPage.clickLogin('$$$$$@gmail.com', '$$$$$');
              expect(browser.getCurrentUrl()).toContain('reports');
              reportPage.clickSignOut();
              expect(browser.getCurrentUrl()).toContain("?signout");
              browser.sleep(800);
          }));
  
      }); 
  </code></pre>
  
  <p>Whenever I execute the test The browser opens for a sec and then closes. </p>
  
  <p>My Onprepare method looks like this:</p>
  
  <pre><code>beforeLaunch: function () {
          return new Promise(function (resolve) {
              reporter.beforeLaunch(resolve);
          });
      },
      onPrepare: function () {
          browser.manage().timeouts().implicitlyWait(5000);
  
          afterEach(co.wrap(function* () {
              var remote = require('protractor/node_modules/selenium-webdriver/remote');
              browser.driver.setFileDetector(new remote.FileDetector());
  
  
  
          }));
  </code></pre>