47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser\Concerns;
|
|
|
|
use Laravel\Dusk\Browser;
|
|
|
|
trait InteractsWithWmsBrowser
|
|
{
|
|
protected function assertSingleProfessionalHeader(Browser $browser, string $title, ?string $description = null): void
|
|
{
|
|
$browser->assertSee($title)
|
|
->assertPresent('.wms-page-hero')
|
|
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
|
|
|
|
if ($description !== null) {
|
|
$browser->assertSee($description);
|
|
}
|
|
}
|
|
|
|
protected function assertDesktopSidebarIsAvailable(Browser $browser): void
|
|
{
|
|
$browser->resize(1440, 1000)
|
|
->waitFor('.wms-sidebar', 5)
|
|
->assertVisible('.wms-sidebar')
|
|
->assertPresent('[data-wms-sidebar-toggle]')
|
|
->assertVisible('.wms-content');
|
|
}
|
|
|
|
protected function openMobileNavigation(Browser $browser): void
|
|
{
|
|
$browser->resize(390, 844)
|
|
->waitFor('.wms-mobile-header', 5)
|
|
->assertVisible('.wms-mobile-header')
|
|
->assertVisible('[data-wms-mobile-open]')
|
|
->click('[data-wms-mobile-open]')
|
|
->pause(250)
|
|
->assertScript('document.querySelector("[data-wms-mobile-shell]").classList.contains("is-mobile-open")');
|
|
}
|
|
|
|
protected function closeMobileNavigation(Browser $browser): void
|
|
{
|
|
$browser->click('[data-wms-mobile-close]')
|
|
->pause(250)
|
|
->assertScript('! document.querySelector("[data-wms-mobile-shell]").classList.contains("is-mobile-open")');
|
|
}
|
|
}
|