95 lines
3.5 KiB
PHP
95 lines
3.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser;
|
|
|
|
use Laravel\Dusk\Browser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsBrowser;
|
|
use Tests\Browser\Concerns\InteractsWithWmsData;
|
|
use Tests\DuskTestCase;
|
|
|
|
class DesktopNavigationBrowserTest extends DuskTestCase
|
|
{
|
|
use InteractsWithWmsBrowser;
|
|
use InteractsWithWmsData;
|
|
|
|
public function test_desktop_sidebar_lists_every_navigator_option(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
$this->seedPlatformDashboardData();
|
|
|
|
$this->browse(function (Browser $browser) use ($admin): void {
|
|
$browser->loginAs($admin)->visit('/admin');
|
|
$this->assertDesktopSidebarIsAvailable($browser);
|
|
|
|
foreach ([
|
|
'Platform', 'Analytics', 'Inventory', 'Replenishment', 'Shipping', 'Transportation', 'Carriers',
|
|
'M3 Integration', 'Sentinel', 'Documents', 'Reporting', 'Warehouses', 'Validation Rules',
|
|
'Pricing', 'Configuration', 'Security', 'Audit', 'Companies', 'Licences', 'Payments', 'Prices',
|
|
] as $label) {
|
|
$browser->assertSourceHas($label);
|
|
}
|
|
});
|
|
}
|
|
|
|
public function test_desktop_sidebar_collapse_and_brand_expand_preserve_navigation(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
|
|
$this->browse(function (Browser $browser) use ($admin): void {
|
|
$browser->loginAs($admin)
|
|
->resize(1440, 1000)
|
|
->visit('/admin')
|
|
->waitFor('.wms-sidebar', 10)
|
|
->click('[data-wms-sidebar-toggle]')
|
|
->waitUntil('document.documentElement.dataset.wmsSidebar === "collapsed"', 10)
|
|
->assertPresent('[data-wms-brand-toggle]')
|
|
->click('[data-wms-brand-toggle]')
|
|
->waitUntil('document.documentElement.dataset.wmsSidebar === "expanded"', 10);
|
|
|
|
$this->clickSidebarHref($browser, '/analytics');
|
|
$browser->assertSee('Analytics');
|
|
});
|
|
}
|
|
|
|
public function test_every_desktop_navigator_page_has_one_professional_header(): void
|
|
{
|
|
$admin = $this->platformAdminUser();
|
|
$this->seedPlatformDashboardData();
|
|
|
|
$routes = [
|
|
['/admin', 'Platform'],
|
|
['/platform/pricing', 'Pricing'],
|
|
['/admin/companies', 'Companies'],
|
|
['/admin/licenses', 'Licence Keys'],
|
|
['/admin/payments', 'Payments'],
|
|
['/admin/prices', 'Prices'],
|
|
['/dashboard', ''],
|
|
['/warehouses', 'Warehouses'],
|
|
['/warehouse-rules', 'Validation Rules'],
|
|
['/analytics', 'Analytics'],
|
|
['/inventory-management', 'Inventory'],
|
|
['/replenishment', 'Replenishment'],
|
|
['/shipping', 'Shipping'],
|
|
['/transportation', 'Transportation'],
|
|
['/carrier-management', 'Carriers'],
|
|
['/m3-integration', 'M3 Integration'],
|
|
['/sentinel-integration', 'Sentinel'],
|
|
['/document-archive', 'Documents'],
|
|
['/reporting', 'Reporting'],
|
|
['/configuration', 'Configuration'],
|
|
['/security', 'Security'],
|
|
['/audit', 'Audit'],
|
|
];
|
|
|
|
$this->browse(function (Browser $browser) use ($admin, $routes): void {
|
|
$browser->loginAs($admin)->resize(1440, 1000);
|
|
|
|
foreach ($routes as [$path, $title]) {
|
|
$browser->visit($path);
|
|
$this->assertSingleProfessionalHeader($browser, $title);
|
|
$browser->assertVisible('.wms-sidebar');
|
|
}
|
|
});
|
|
}
|
|
}
|