<?phpclassLoginTestextendsDuskTestCase{publicfunctiontestLogin(){$this->browse(function(Browser$browser){$browser->visit('/admin')->type('email','hoge@exampl.org')->type('password','hogepass')->press('Login')->assertSee('Loading...');});}publicfunctiontestLoginFailure(){$this->browse(function(Browser$browser){// I have to add this to logout first, otherwise it's already logged in for this test!
$browser->visit('/admin/logout');$browser->visit('/admin')->type('email','fuga@exampl.org')->type('password','fugapass')->press('Login')->assertSee('These credentials do not match our records.');});}}
<?phpclassLoginTestextendsDuskTestCase{publicfunctiontestLogin(){$this->createBrowsersFor(function(Browser$browser){$browser->visit('/admin')->type('email','hoge@exampl.org')->type('password','hogepass')->press('Login')->assertSee('Loading...');});}publicfunctiontestLoginFailure(){$this->createBrowsersFor(function(Browser$browser){$browser->visit('/admin')->type('email','fuga@exampl.org')->type('password','fugapass')->press('Login')->assertSee('These credentials do not match our records.');});}}
<?phpclassLoginTestextendsDuskTestCase{/**
* Temporal solution for cleaning up session
*/protectedfunctionsetUp(){parent::setUp();foreach(static::$browsersas$browser){$browser->driver->manage()->deleteAllCookies();}}