snipe_it/tests/Browser/LoginTest.php
2021-12-02 15:08:26 -08:00

53 lines
1.4 KiB
PHP

<?php
namespace Tests\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
class LoginTest extends DuskTestCase
{
/**
* Test login
*
* @return void
*/
public function testLoginPageLoadsAndUserCanLogin()
{
$this->browse(function (Browser $browser) {
$browser->visitRoute('login')
->assertSee(trans('auth/general.login_prompt'));
$browser->screenshot('filename');
$browser->storeSource('login');
});
$this->browse(function ($browser) {
$browser->visitRoute('login')
->type('username', 'snipe')
->type('password', 'password')
->press(trans('auth/general.login'))
->assertPathIs('/');
$browser->screenshot('dashboard');
});
}
/**
* Test dashboard loads
*
* @todo Flesh this out further to make sure the individual tables actually load with
* content inside them.
*
* @return void
*/
public function testDashboardLoadsWithSuperAdmin()
{
$this->browse(function ($browser) {
$browser->assertSee(trans('general.dashboard'));
$browser->assertSee(trans('general.loading'));
$browser->screenshot('dashboard-2');
});
}
}