Files
DatBrowser/app/Browser/Components/Hellcase/MainNav.php
Matthias Guillitte 61e55f960e
All checks were successful
Push image to registry / build-image (push) Successful in 4m41s
Fix Job
2025-02-18 18:48:48 +01:00

48 lines
1.0 KiB
PHP

<?php
namespace App\Browser\Components\Hellcase;
use Laravel\Dusk\Browser;
use Laravel\Dusk\Component as BaseComponent;
class MainNav extends BaseComponent
{
/**
* Get the root selector for the component.
*/
public function selector(): string
{
return 'header.header';
}
/**
* Assert that the browser page contains the component.
*/
public function assert(Browser $browser): void
{
$browser->assertVisible($this->selector());
}
/**
* Get the element shortcuts for the component.
*
* @return array<string, string>
*/
public function elements(): array
{
return [
'@logo' => 'a.header-logo',
'@daily-free-link' => 'a[href="/dailyfree"]',
];
}
public function goToHome(Browser $browser) {
try {
$browser->scrollIntoView('@logo');
$browser->click('@logo');
} catch (\Exception $e) {
$browser->visit('https://hellcase.com/');
}
}
}