82 lines
2.8 KiB
PHP
82 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
use Laravel\Dusk\Browser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsBrowser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsData;
|
|
use Tests\DuskTestCase;
|
|
|
|
class MobileNavigationBrowserTest extends DuskTestCase
|
|
{
|
|
use DatabaseMigrations;
|
|
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->assertVisible('.wms-sidebar')
|
|
->assertSee('Platform')
|
|
->assertSee('Administration')
|
|
->assertSee('Prices');
|
|
|
|
$this->closeMobileNavigation($browser);
|
|
});
|
|
}
|
|
|
|
public function test_mobile_drawer_navigates_to_every_major_menu_group(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
$this->seedPlatformDashboardData();
|
|
|
|
$this->browse(function (Browser $browser) use ($admin): void {
|
|
$browser->loginAs($admin)
|
|
->visit('/admin');
|
|
|
|
foreach ([
|
|
'Analytics' => '/analytics',
|
|
'Inventory' => '/inventory-management',
|
|
'Documents' => '/document-archive',
|
|
'Warehouses' => '/warehouses',
|
|
'Prices' => '/admin/prices',
|
|
] as $label => $path) {
|
|
$this->openMobileNavigation($browser);
|
|
$browser->clickLink($label)
|
|
->waitForLocation($path)
|
|
->waitFor('.wms-page-hero', 5)
|
|
->assertPathIs($path)
|
|
->assertSee($label === 'Prices' ? 'Platform Prices' : $label)
|
|
->assertScript('! document.querySelector("[data-wms-mobile-shell]").classList.contains("is-mobile-open")');
|
|
}
|
|
});
|
|
}
|
|
|
|
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)
|
|
->visit('/admin')
|
|
->resize(390, 844)
|
|
->waitFor('.wms-mobile-header', 5)
|
|
->assertVisible('[data-wms-mobile-open]')
|
|
->resize(820, 1180)
|
|
->pause(250)
|
|
->assertVisible('[data-wms-mobile-open]')
|
|
->resize(1440, 1000)
|
|
->pause(250)
|
|
->assertVisible('.wms-sidebar')
|
|
->assertPresent('[data-wms-sidebar-toggle]');
|
|
});
|
|
}
|
|
}
|