Files
WMS/tests/Browser/WmsPricingCrudBrowserTest.php
T
2026-06-11 12:29:18 +01:00

50 lines
1.6 KiB
PHP

<?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');
});
}
}