title: Laravel Dusk, how to destroy session data between tests
body: <p>I am getting started using Laravel Dusk for browser testing, and have created a couple of tests to test my login form. I have the following code:</p>
  
  <pre><code>class LoginTest extends DuskTestCase
  {
  
  public function testLogin()
  {
      $this-&gt;browse(function (Browser $browser) {
          $browser-&gt;visit('/admin')
              -&gt;type('email', 'inigo@mydomain.co.uk')
              -&gt;type('password', 'MyPass')
              -&gt;press('Login')
              -&gt;assertSee('Loading...');
      });
  }
  
  public function testLoginFailure(){
      $this-&gt;browse(function (Browser $browser){
  
          $browser-&gt;visit('/admin/logout'); // I have to add this to logout first, otherwise it's already logged in for this test!
  
          $browser-&gt;visit('/admin')
              -&gt;type('email', 'someemail@afakedomain.com')
              -&gt;type('password', 'somefakepasswordthatdoesntwork')
              -&gt;press('Login')
              -&gt;assertSee('These credentials do not match our records.');
      });
  }
  </code></pre>
  
  <p>See the comment. The first function runs fine, but when it comes to the second function, I have to logout first, since the user is already logged in as a result of running the first function. This came as a surprise to me as I thought unit tests were completely independent, with session data being destroyed automatically.</p>
  
  <p>Is there a better way of doing this- some Dusk method that I'm missing perhaps- than having to call <code>$browser-&gt;visit('/admin/logout');</code> ?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong> Thanks for the 2 answers so far, which both seem valid solutions. I've updated the second function to the following:</p>
  
  <pre><code>public function testLoginFailure(){
      $this-&gt;createBrowsersFor(function(Browser $browser){
          $browser-&gt;visit('/admin')
              -&gt;type('email', 'someshit@afakedomain.com')
              -&gt;type('password', 'somefakepasswordthatdoesntwork')
              -&gt;press('Login')
              -&gt;assertSee('These credentials do not match our records.');
      });
  }
  </code></pre>
  
  <p>Which does the job. So</p>
  
  <ol>
  <li>I can safely assume that this second browser only exists for the duration of this single function, correct?</li>
  <li>What are the obvious advantages/disadvantages of creating a second browser instance rather than using the teardown method?</li>
  </ol>