73 lines
2.3 KiB
PHP
73 lines
2.3 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)->visit('/admin');
|
|
|
|
$this->openMobileNavigation($browser);
|
|
$browser->assertSee('Platform')
|
|
->assertSourceHas('Prices');
|
|
|
|
$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)->visit('/admin');
|
|
|
|
foreach ($paths as $path => $title) {
|
|
$this->openMobileNavigation($browser);
|
|
$this->clickSidebarHref($browser, $path);
|
|
$this->assertSingleProfessionalHeader($browser, $title);
|
|
}
|
|
});
|
|
}
|
|
|
|
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('.wms-mobile-header', 10)
|
|
->assertVisible('[data-wms-mobile-open]')
|
|
->resize(768, 1024)
|
|
->waitFor('.wms-mobile-header', 10)
|
|
->assertVisible('[data-wms-mobile-open]')
|
|
->resize(1440, 1000)
|
|
->waitFor('.wms-sidebar', 10)
|
|
->assertVisible('.wms-sidebar');
|
|
});
|
|
}
|
|
}
|