83 lines
2.9 KiB
PHP
83 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser;
|
|
|
|
use Laravel\Dusk\Browser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsBrowser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsData;
|
|
use Tests\DuskTestCase;
|
|
|
|
class MobileNavigationBrowserTest extends DuskTestCase
|
|
{
|
|
use InteractsWithWmsBrowser;
|
|
use InteractsWithWmsData;
|
|
|
|
public function test_mobile_hamburger_opens_and_closes_professional_drawer(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
|
|
$this->browse(function (Browser $browser) use ($admin): void {
|
|
$browser->loginAs($admin)
|
|
->resize(390, 844)
|
|
->visit('/admin')
|
|
->waitFor('body', 10)
|
|
->assertSee('Platform')
|
|
->assertScript('document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1');
|
|
|
|
$this->openMobileNavigation($browser);
|
|
$browser->assertSourceHas('Platform');
|
|
$this->closeMobileNavigation($browser);
|
|
});
|
|
}
|
|
|
|
public function test_mobile_drawer_navigates_to_major_menu_groups(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
$this->seedPlatformDashboardData();
|
|
|
|
$paths = [
|
|
'/analytics' => 'Analytics',
|
|
'/inventory-management' => 'Inventory',
|
|
'/document-archive' => '',
|
|
'/warehouses' => 'Warehouses',
|
|
'/admin/prices' => '',
|
|
];
|
|
|
|
$this->browse(function (Browser $browser) use ($admin, $paths): void {
|
|
$browser->loginAs($admin)
|
|
->resize(390, 844)
|
|
->visit('/admin')
|
|
->waitFor('body', 10);
|
|
|
|
foreach ($paths as $path => $title) {
|
|
$this->openMobileNavigation($browser);
|
|
$this->clickSidebarHref($browser, $path);
|
|
$this->assertSingleProfessionalHeader($browser, $title);
|
|
$browser->assertScript('document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1');
|
|
}
|
|
});
|
|
}
|
|
|
|
public function test_mobile_tablet_and_desktop_breakpoints_keep_navigation_accessible(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
|
|
$this->browse(function (Browser $browser) use ($admin): void {
|
|
$browser->loginAs($admin)
|
|
->resize(390, 844)
|
|
->visit('/admin')
|
|
->waitFor('body', 10)
|
|
->assertSee('Platform')
|
|
->assertScript('document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1')
|
|
->resize(768, 1024)
|
|
->pause(250)
|
|
->assertSee('Platform')
|
|
->assertScript('document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1')
|
|
->resize(1440, 1000)
|
|
->pause(250)
|
|
->assertPresent('.wms-sidebar')
|
|
->assertSee('Platform');
|
|
});
|
|
}
|
|
}
|