mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Extract login/authentication in Login.php
This commit is contained in:
parent
2bd903b71a
commit
4cf049b9fa
51
tests/Browser/Pages/ClientPortal/Login.php
Normal file
51
tests/Browser/Pages/ClientPortal/Login.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Pages\ClientPortal;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Laravel\Dusk\Page;
|
||||
|
||||
class Login extends Page
|
||||
{
|
||||
/**
|
||||
* Get the URL for the page.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return '/client/login';
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the browser is on the page.
|
||||
*
|
||||
* @param Browser $browser
|
||||
* @return void
|
||||
*/
|
||||
public function assert(Browser $browser)
|
||||
{
|
||||
$browser->assertPathIs($this->url());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element shortcuts for the page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function elements()
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
|
||||
public function auth(Browser $browser)
|
||||
{
|
||||
$browser
|
||||
->visitRoute('client.login')
|
||||
->type('email', 'user@example.com')
|
||||
->type('password', 'password')
|
||||
->press('Login');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user