fixed mobile

This commit is contained in:
Mark Gregory
2026-06-11 12:29:18 +01:00
parent 29004e46c2
commit b993881d52
14 changed files with 1388 additions and 8 deletions
@@ -0,0 +1,49 @@
<?php
namespace Tests\Browser;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Modules\Platform\app\Models\PlatformPrice;
use Tests\DuskTestCase;
class WmsPricingCrudBrowserTest extends DuskTestCase
{
use DatabaseMigrations;
/**
* Ensure pricing cards remain visible on the Platform page and CRUD remains under Administration.
*/
public function test_platform_pricing_cards_and_admin_price_crud_are_reachable(): void
{
$admin = User::factory()->mpbaPlatformAdmin()->create();
PlatformPrice::create([
'code' => 'basic',
'name' => 'Basic',
'strapline' => 'Starter plan',
'description' => 'Entry WMS access.',
'monthly_amount' => 4900,
'annual_amount' => 49000,
'currency' => 'gbp',
'badge_label' => 'Starter',
'features' => ['2 warehouses', '10 users'],
'sort_order' => 10,
'is_featured' => false,
'is_active' => true,
]);
$this->browse(function (Browser $browser) use ($admin): void {
$browser->loginAs($admin)
->resize(1440, 1000)
->visitRoute('platform.dashboard')
->assertSee('Pricing plans')
->assertSee('Basic')
->clickLink('Manage prices')
->assertRouteIs('platform.prices.index')
->assertSee('Pricing Administration')
->clickLink('Add price')
->assertRouteIs('platform.prices.create')
->assertSee('Create Price');
});
}
}
@@ -0,0 +1,76 @@
<?php
namespace Tests\Browser;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
class WmsResponsiveNavigationTest extends DuskTestCase
{
use DatabaseMigrations;
/**
* Ensure the desktop sidebar remains visible and usable on large screens.
*/
public function test_desktop_sidebar_navigation_remains_unchanged(): void
{
$user = User::factory()->mpbaPlatformAdmin()->create();
$this->browse(function (Browser $browser) use ($user): void {
$browser->loginAs($user)
->resize(1440, 1000)
->visitRoute('platform.dashboard')
->assertSee('Platform Dashboard')
->assertSee('Analytics')
->assertSee('Inventory')
->clickLink('Inventory')
->assertRouteIs('inventory-management.index')
->assertSee('Inventory Management');
});
}
/**
* Ensure the mobile menu hamburger opens the slide-out navigation.
*/
public function test_mobile_menu_opens_slide_out_navigation(): void
{
$user = User::factory()->mpbaPlatformAdmin()->create();
$this->browse(function (Browser $browser) use ($user): void {
$browser->loginAs($user)
->resize(390, 844)
->visitRoute('platform.dashboard')
->assertSee('Platform Dashboard')
->assertPresent('[data-wms-mobile-open]')
->click('[data-wms-mobile-open]')
->pause(150)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'true')
->assertPresent('[data-wms-sidebar]')
->assertSee('Platform')
->clickLink('Shipping')
->assertRouteIs('shipping.index')
->assertSee('Shipping');
});
}
/**
* Ensure the mobile overlay closes the menu without affecting desktop navigation.
*/
public function test_mobile_menu_overlay_closes_drawer(): void
{
$user = User::factory()->mpbaPlatformAdmin()->create();
$this->browse(function (Browser $browser) use ($user): void {
$browser->loginAs($user)
->resize(414, 896)
->visitRoute('platform.dashboard')
->click('[data-wms-mobile-open]')
->pause(150)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'true')
->click('[data-wms-mobile-close]')
->pause(150)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
});
}
}