title: Protractor and Angular: How to test two pages in an app, one after the other?
body: <p>I would like to run Protractor tests on two separate pages in my Angular app: <code>/dashboard</code> and <code>/articles</code>. </p>
  
  <p>The complication is that I have to log in to the app manually. </p>
  
  <p>Currently I have this setup: </p>
  
  <pre><code>var LoginPage = function() {
    ptor = protractor.getInstance();
    this.login = function(url) {
      ptor.get(url);
      ptor.findElement(protractor.By.model('email')).sendKeys(config.LOGIN_EMAIL);
      ptor.findElement(protractor.By.model('password')).sendKeys(config.LOGIN_PASS);
      ptor.findElement(protractor.By.tagName('button')).click();
    };
  };
  
  describe('The dashboard', function() {
    console.log('logging in');
    var loginPage = new LoginPage();
    loginPage.login(config.DASHBOARD_URL);
    console.log('logged in');
    it('has a heading', function() {
      console.log('testing dashboard 1');
      heading = ptor.findElement(protractor.By.tagName('h1'));
      expect(heading.getText()).toEqual(config.DASHBOARD_HEADING);
    });
  });
  
  describe('The article widget', function() {
    console.log('logging in');
    var loginPage = new LoginPage();
    loginPage.login(config.ARTICLE_URL);
    console.log('logged in');
    it('has a heading', function() {
      console.log('testing article 1');
      heading = ptor.findElement(protractor.By.tagName('h1'));
      expect(heading.getText()).toEqual(config.ARTICLES_HEADING);
    });
  });
  </code></pre>
  
  <p>This gives me the following output: </p>
  
  <pre><code>Selenium standalone server started at http://192.168.2.9:56791/wd/hub
  logging in
  LoginPage
  logged in
  logging in
  LoginPage
  logged in
  testing dashboard 1
  Ftesting article 1
  </code></pre>
  
  <p>It looks as though both the <code>describe</code> sections are kicking off in parallel. How can I force the following sequence of events, while still structuring the code in a sensible way?</p>
  
  <ol>
  <li>Load dashboard page </li>
  <li>Log in  </li>
  <li>Run dashboard tests </li>
  <li>Load article page (Assume we are already logged in) </li>
  <li>Run article tests</li>
  </ol>