Files
ticketbeast/tests/Browser/PromoterLoginTest.php
2017-07-10 09:11:56 -04:00

50 lines
1.4 KiB
PHP

<?php
namespace Tests\Browser;
use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class PromoterLoginTest extends DuskTestCase
{
use DatabaseMigrations;
/** @test */
public function logging_in_successfully()
{
$user = factory(User::class)->create([
'email' => 'jane@example.com',
'password' => bcrypt('super-secret-password'),
]);
$this->browse(function (Browser $browser) {
$browser->visit('/login')
->type('email', 'jane@example.com')
->type('password', 'super-secret-password')
->press('Log in')
->assertPathIs('/backstage/concerts');
});
}
/** @test */
public function logging_in_with_invalid_credentials()
{
$user = factory(User::class)->create([
'email' => 'jane@example.com',
'password' => bcrypt('super-secret-password'),
]);
$this->browse(function (Browser $browser) {
$browser->visit('/login')
->type('email', 'jane@example.com')
->type('password', 'wrong-password')
->press('Log in')
->assertPathIs('/login')
->assertInputValue('email', 'jane@example.com')
->assertSee('credentials do not match');
});
}
}