title: Why do I need to explicitly clear sessionStorage when using Cypress?
body: <p>I am using Cypress to test an Angular application that pages through a list of doctors. The controller stores the current page in $sessionStorage.pagination. If I don't explicitly clear the session storage between tests, tests that follow my "should go to next page" test fail.  If I do explicitly clear the session storage between tests, everything works as expected.  This contradicts what I read here (<a href="https://github.com/cypress-io/cypress/issues/686" rel="nofollow noreferrer">https://github.com/cypress-io/cypress/issues/686</a>) which seems to say that the session storage is automatically cleared between tests.</p>
  
  <p>Is this a bug in Cypress? Or, am I misunderstanding what the Cypress developers mean by clearing session storage between tests?</p>
  
  <pre><code>describe('Simple Search Results Page Tests', function () {
  
      beforeEach(function(){
        cy.server();
  
      // routes omitted for brevity 
  
      // Changing pages breaks tests if I visit page under test like this
      cy.visit('http://localhost:9001/pageUnderTest'); 
  
      // tests work as expected if I visit page under test like this
      /*
      cy.visit('http://localhost:9001/pageUnderTest', 
                {onBeforeLoad: (win) =&gt; { win.sessionStorage.clear()}
      });
      /*
    }); 
  
    it('should search Best Match', function(){
      cy.get('[data-cy=first-name]').first().should('have.text', 'Michael')
        .get('[data-cy=last-name]').first().should('have.text', 'Emiley')
      });
  
    it('should go to the next page', function(){
      cy.get('[data-cy="page-number"]').click('right')
    }); 
  
    // this test is broken if session storage not explicitly re-set.
    it('should search Best Match (again)', function(){
      cy.get('[data-cy=first-name]').first().should('have.text', 'Michael')
        .get('[data-cy=last-name]').first().should('have.text', 'Emiley')
      });
  });
  </code></pre>