47 lines
No EOL
945 B
PHP
47 lines
No EOL
945 B
PHP
<?php
|
|
|
|
namespace Tests\Browser\Pages;
|
|
|
|
use Laravel\Dusk\Browser;
|
|
use Tests\Browser\Components\LoginForm;
|
|
|
|
class LoginPage extends Page
|
|
{
|
|
/**
|
|
* Get the URL for the page.
|
|
*/
|
|
public function url(): string
|
|
{
|
|
return '/login';
|
|
}
|
|
|
|
/**
|
|
* Assert that the browser is on the page.
|
|
*/
|
|
public function assert(Browser $browser): void
|
|
{
|
|
$browser->assertPathIs($this->url())
|
|
->assertSee('Login')
|
|
->assertPresent((new LoginForm)->selector());
|
|
}
|
|
|
|
/**
|
|
* Get the element shortcuts for the page.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function elements(): array
|
|
{
|
|
return [
|
|
'@register-link' => 'a[href*="register"]',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Navigate to the registration page.
|
|
*/
|
|
public function goToRegistration(Browser $browser): void
|
|
{
|
|
$browser->click('@register-link');
|
|
}
|
|
} |