CasperSecurity
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
use Laravel\Dusk\Page;
class LoginPage extends Page
{
/**
* Get the URL for the page.
*/
public function url(): string
{
return '/';
}
/**
* Assert that the browser is on the page.
*/
public function assert(Browser $browser): void
{
$browser->assertPathIs($this->url())
->assertSee('Oriental Security Services')
->type('email','admin@yobytech.in')
->press('Sign In')
->screenshot('login_error_01')
->pause('5000');
$browser->assertPathIs($this->url())
->assertSee('Oriental Security Services')
->type('email','admin01@yobytech.in')
->type('password','password')
->press('Sign In')
->assertPathIs('/')
->screenshot('login_error_02')
->pause('5000');
$browser->assertPathIs($this->url())
->assertSee('Oriental Security Services')
->assertSee('Email')
->type('email','admin@yobytech.in')
->assertSee('Password')
->type('password','Password@1')
->press('Sign In')
->pause('5000')
->assertPathIs('/dashboard')
->assertSee('Dashboard')
->screenshot('dashbord_screenshot');
}
/**
* Get the element shortcuts for the page.
*
* @return array<string, string>
*/
public function elements(): array
{
return [
'@element' => '#selector',
];
}
}