UPDATED TESTS wirr dusk

This commit is contained in:
Mark Gregory
2026-06-11 14:51:28 +01:00
parent cad45a870d
commit a55b98cf38
13 changed files with 300 additions and 359 deletions
+23 -28
View File
@@ -19,12 +19,10 @@ class MobileNavigationBrowserTest extends DuskTestCase
$admin = $this->platformAdminUser();
$this->browse(function (Browser $browser) use ($admin): void {
$browser->loginAs($admin)
->visit('/admin');
$browser->loginAs($admin)->visit('/admin');
$this->openMobileNavigation($browser);
$browser->assertVisible('.wms-sidebar')
->assertSee('Platform')
$browser->assertSee('Platform')
->assertSee('Administration')
->assertSee('Prices');
@@ -32,29 +30,27 @@ class MobileNavigationBrowserTest extends DuskTestCase
});
}
public function test_mobile_drawer_navigates_to_every_major_menu_group(): void
public function test_mobile_drawer_navigates_to_major_menu_groups(): void
{
$admin = $this->platformAdminUser();
$this->seedPlatformDashboardData();
$this->browse(function (Browser $browser) use ($admin): void {
$browser->loginAs($admin)
->visit('/admin');
$paths = [
'/analytics' => 'Analytics',
'/inventory-management' => 'Inventory',
'/document-archive' => 'Documents',
'/warehouses' => 'Warehouses',
'/admin/prices' => 'Platform Prices',
];
foreach ([
'Analytics' => '/analytics',
'Inventory' => '/inventory-management',
'Documents' => '/document-archive',
'Warehouses' => '/warehouses',
'Prices' => '/admin/prices',
] as $label => $path) {
$this->browse(function (Browser $browser) use ($admin, $paths): void {
$browser->loginAs($admin)->visit('/admin');
foreach ($paths as $path => $title) {
$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")');
$browser->script("document.querySelector('.wms-sidebar a[href=\"{$path}\"]')?.click();");
$browser->waitForLocation($path, 10);
$this->assertSingleProfessionalHeader($browser, $title);
}
});
}
@@ -65,17 +61,16 @@ class MobileNavigationBrowserTest extends DuskTestCase
$this->browse(function (Browser $browser) use ($admin): void {
$browser->loginAs($admin)
->visit('/admin')
->resize(390, 844)
->waitFor('.wms-mobile-header', 5)
->visit('/admin')
->waitFor('.wms-mobile-header', 10)
->assertVisible('[data-wms-mobile-open]')
->resize(820, 1180)
->pause(250)
->resize(768, 1024)
->waitFor('.wms-mobile-header', 10)
->assertVisible('[data-wms-mobile-open]')
->resize(1440, 1000)
->pause(250)
->assertVisible('.wms-sidebar')
->assertPresent('[data-wms-sidebar-toggle]');
->waitFor('.wms-sidebar', 10)
->assertVisible('.wms-sidebar');
});
}
}