title: How can we use protractor beforeAll and afterAll hooks for opening and closing a browser in each describe block
body: <p>I have used the following but I get This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used. Can someone help with this.</p>
  
  <p><strong>Sample.js file which has the following code:</strong> </p>
  
  <pre><code>describe('angularjs homepage', function() {
      beforeAll(function(){
           browser.get('https://xxxx/');
           console.log('calling before all');
       });
  
       afterAll(function(done){
           console.log('calling after all');
           browser.quit();
           process.nextTick(done);
       });
  </code></pre>
  
  <p><strong>Another file which also has the same code:</strong> </p>
  
  <pre><code>describe('angularjs homepage', function() {
          beforeAll(function(){
               browser.get('https://xxxx/');
               console.log('calling before all');
           });
  
           afterAll(function(done){
               console.log('calling after all');
               browser.quit();
               process.nextTick(done);
           });
  </code></pre>
  
  <p>Now I want to use beforeAll and AfterAll functions through which browser should open and close in each js file execution. When I follow this approach I get the error as This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.</p>