librenms/tests/Browser/LoginTest.php
Tony Murray 63de34e295
php artisan serve and dusk testing (#9422)
* php artisan serve and dusk testing

* Fix style

* move if into, in case we need to have different configs

* fix travis yml

* Add missing folders files

* Try to fixup Travis-ci

* revert variable, change check

* skip browser tests for phpunit runs
set up env correctly

* maybe bg is needed

* attempt to fix env

* install Chrome

* Update tests
fix migrations

* Move pylint to python2

* use testing .env

* Running chrome on port 9515 conflicts with the instance started by the tests.  It is probably not needed.

* suppress some artisan serve output

* remove the unused updater
2019-02-14 09:06:10 -06:00

41 lines
954 B
PHP

<?php
namespace LibreNMS\Tests\Browser;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use LibreNMS\Tests\Browser\Pages\LoginPage;
use LibreNMS\Tests\DuskTestCase;
/**
* Class LoginTest
* @package LibreNMS\Tests\Browser
* @group browser
*/
class LoginTest extends DuskTestCase
{
use DatabaseMigrations;
/**
* @throws \Throwable
*/
public function testUserCanLogin()
{
$this->browse(function (Browser $browser) {
$password = 'some_password';
$user = factory(User::class)->create([
'password' => password_hash($password, PASSWORD_DEFAULT)
]);
$browser->visit(new LoginPage())
->type('username', $user->username)
->type('password', $password)
->press('#login')
->assertPathIs('/');
$user->delete();
});
}
}