-
-
Save uno-de-piera/6703841a404b0f58899a04541fbef5e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Browser; | |
use App\User; | |
use Laravel\Dusk\Browser; | |
use Tests\DuskTestCase; | |
use Illuminate\Foundation\Testing\DatabaseMigrations; | |
class LoginTest extends DuskTestCase | |
{ | |
use DatabaseMigrations; | |
protected $user; | |
public function setUp(): void { | |
parent::setUp(); | |
$this->user = factory(User::class)->create([ | |
'email' => 'dusk@cursosdesarrolloweb.es' | |
]); | |
} | |
public function testIsLoginPage() { | |
$this->browse(function (Browser $browser) { | |
$browser->visit('/login') | |
->assertTitle('Laravel') | |
->assertSee('Forgot Your Password?') | |
->clickLink("Forgot Your Password?") | |
->assertPathIs('/password/reset') | |
->assertSee('Reset Password'); | |
}); | |
} | |
public function testLogin() { | |
$this->browse(function(Browser $browser) { | |
$browser->visit('/login') | |
->type('email', $this->user->email) | |
->type('password', 'password') | |
->press('Login') | |
->assertPathIs('/home'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment