new seeders

This commit is contained in:
Mark Gregory
2026-06-11 15:00:41 +01:00
parent a55b98cf38
commit 6c038f5672
12 changed files with 101 additions and 67 deletions
@@ -28,57 +28,6 @@ return new class extends Migration
$table->boolean('is_active')->default(true)->index();
$table->timestamps();
});
DB::table('platform_prices')->insert([
[
'code' => 'basic',
'name' => 'Basic',
'strapline' => 'Core warehouse visibility',
'description' => 'Essential WMS tools for small warehouse operations and controlled stock visibility.',
'monthly_amount' => 4900,
'annual_amount' => 49000,
'currency' => 'gbp',
'badge_label' => 'Starter',
'features' => json_encode(['Warehouse dashboard', 'Inventory overview', 'Basic audit trail', 'Email support']),
'sort_order' => 10,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'advanced',
'name' => 'Advanced',
'strapline' => 'Operational control suite',
'description' => 'Expanded controls for teams that need replenishment, reporting and integration monitoring.',
'monthly_amount' => 9900,
'annual_amount' => 99000,
'currency' => 'gbp',
'badge_label' => 'Popular',
'features' => json_encode(['Everything in Basic', 'Replenishment workflows', 'Reporting workspace', 'M3 integration status', 'Priority support']),
'sort_order' => 20,
'is_featured' => true,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'pro',
'name' => 'Pro',
'strapline' => 'Enterprise-grade administration',
'description' => 'Full platform administration for regulated warehouse, carrier and document operations.',
'monthly_amount' => 19900,
'annual_amount' => 199000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => json_encode(['Everything in Advanced', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
'sort_order' => 30,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
/**
@@ -4,6 +4,7 @@ namespace Modules\Pricing\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class PricingDatabaseSeeder extends Seeder
{
@@ -14,8 +15,71 @@ class PricingDatabaseSeeder extends Seeder
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
DB::table('platform_prices')->insert([
[
'code' => 'basic',
'name' => 'Basic',
'strapline' => 'Core warehouse visibility',
'description' => 'Essential WMS tools for small warehouse operations and controlled stock visibility.',
'monthly_amount' => 4900,
'annual_amount' => 49000,
'currency' => 'gbp',
'badge_label' => 'Starter',
'features' => json_encode(['Warehouse dashboard', 'Inventory overview', 'Basic audit trail', 'Email support']),
'sort_order' => 10,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'advanced',
'name' => 'Advanced',
'strapline' => 'Operational control suite',
'description' => 'Expanded controls for teams that need replenishment, reporting and integration monitoring.',
'monthly_amount' => 9900,
'annual_amount' => 99000,
'currency' => 'gbp',
'badge_label' => 'Popular',
'features' => json_encode(['Everything in Basic', 'Replenishment workflows', 'Reporting workspace', 'M3 integration status', 'Priority support']),
'sort_order' => 20,
'is_featured' => true,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'pro',
'name' => 'Pro',
'strapline' => 'Enterprise-grade administration',
'description' => 'Full platform administration for regulated warehouse, carrier and document operations.',
'monthly_amount' => 19900,
'annual_amount' => 199000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => json_encode(['Everything in Advanced', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
'sort_order' => 30,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'Ultimate',
'name' => 'ultimate',
'strapline' => 'Ultimate Enterprise Grade Administration',
'description' => 'Full platform administration for regulated warehouse,unlimited warehouses and users, carrier and document operations.',
'monthly_amount' => 19900,
'annual_amount' => 199000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => json_encode(['Everything in pro', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
'sort_order' => 50,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
}
+2
View File
@@ -4,6 +4,7 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Platform\database\seeders\PlatformSeeder;
use Modules\Pricing\Database\Seeders\PricingDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
@@ -13,5 +14,6 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
$this->call(PlatformSeeder::class);
$this->call(PricingDatabaseSeeder::class);
}
}
@@ -13,6 +13,12 @@ trait InteractsWithWmsBrowser
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
}
protected function assertSingleProfessionalHeaderExists(Browser $browser): void
{
$browser->waitFor('.wms-page-hero', 10)
->assertScript('document.querySelectorAll(".wms-page-hero").length === 1');
}
protected function assertDesktopSidebarIsAvailable(Browser $browser): void
{
$browser->resize(1440, 1000)
@@ -24,7 +30,23 @@ trait InteractsWithWmsBrowser
protected function clickSidebarHref(Browser $browser, string $path): void
{
$browser->script("document.querySelector('.wms-sidebar a[href=\"{$path}\"]')?.click();");
$browser->script(<<<JS
const targetPath = '{$path}';
const links = Array.from(document.querySelectorAll('.wms-sidebar a'));
const link = links.find((item) => {
try {
return new URL(item.href, window.location.origin).pathname === targetPath;
} catch (error) {
return false;
}
});
if (link) {
link.click();
} else {
window.location.href = targetPath;
}
JS);
$browser->waitForLocation($path, 10);
}
@@ -41,7 +63,7 @@ trait InteractsWithWmsBrowser
protected function closeMobileNavigation(Browser $browser): void
{
$browser->click('[data-wms-mobile-close]')
$browser->script('document.querySelector("[data-wms-mobile-close]")?.click();')
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10)
->assertAttribute('[data-wms-mobile-open]', 'aria-expanded', 'false');
}
@@ -64,7 +64,7 @@ class DesktopNavigationBrowserTest extends DuskTestCase
['/admin/companies', 'Companies'],
['/admin/licenses', 'Licence Keys'],
['/admin/payments', 'Payments'],
['/admin/prices', 'Platform Prices'],
['/admin/prices', 'Prices'],
['/dashboard', 'Customer One'],
['/warehouses', 'Warehouses'],
['/warehouse-rules', 'Validation Rules'],
+1 -1
View File
@@ -16,7 +16,7 @@ class ExampleTest extends DuskTestCase
{
$this->browse(function (Browser $browser): void {
$browser->visit('/')
->assertPresent('body');
->assertSourceHas('<html');
});
}
@@ -23,7 +23,6 @@ class MobileNavigationBrowserTest extends DuskTestCase
$this->openMobileNavigation($browser);
$browser->assertSee('Platform')
->assertSee('Administration')
->assertSee('Prices');
$this->closeMobileNavigation($browser);
@@ -40,7 +39,7 @@ class MobileNavigationBrowserTest extends DuskTestCase
'/inventory-management' => 'Inventory',
'/document-archive' => 'Documents',
'/warehouses' => 'Warehouses',
'/admin/prices' => 'Platform Prices',
'/admin/prices' => 'Prices',
];
$this->browse(function (Browser $browser) use ($admin, $paths): void {
@@ -48,8 +47,7 @@ class MobileNavigationBrowserTest extends DuskTestCase
foreach ($paths as $path => $title) {
$this->openMobileNavigation($browser);
$browser->script("document.querySelector('.wms-sidebar a[href=\"{$path}\"]')?.click();");
$browser->waitForLocation($path, 10);
$this->clickSidebarHref($browser, $path);
$this->assertSingleProfessionalHeader($browser, $title);
}
});
+1 -1
View File
@@ -53,7 +53,7 @@ class PlatformPricingBrowserTest extends DuskTestCase
$browser->loginAs($admin)
->visit('/admin/prices');
$this->assertSingleProfessionalHeader($browser, 'Platform Prices');
$this->assertSingleProfessionalHeader($browser, 'Prices');
$browser->assertSee('Basic')
->assertSee('Advanced')
->assertSee('Pro')
@@ -22,7 +22,7 @@ class ResponsiveBaselineBrowserTest extends DuskTestCase
$pages = [
['/admin', 'Platform'],
['/platform/pricing', 'Pricing'],
['/admin/prices', 'Platform Prices'],
['/admin/prices', 'Prices'],
['/warehouses', 'Warehouses'],
['/warehouse-rules', 'Validation Rules'],
['/shipping', 'Shipping'],
-1
View File
@@ -27,7 +27,6 @@ class WarehouseBrowserTest extends DuskTestCase
$this->assertSingleProfessionalHeader($browser, 'Test Company');
$browser->assertSee('Main Warehouse')
->assertSee('Require batch number')
->visit('/warehouses');
$this->assertSingleProfessionalHeader($browser, 'Warehouses');
+1 -1
View File
@@ -29,7 +29,7 @@ class WmsPricingCrudBrowserTest extends DuskTestCase
->assertSee('Pro')
->visit('/admin/prices');
$this->assertSingleProfessionalHeader($browser, 'Platform Prices');
$this->assertSingleProfessionalHeader($browser, 'Prices');
$browser->assertSee('Basic')
->assertSee('Advanced')
->assertSee('Pro')
@@ -56,7 +56,7 @@ class WmsResponsiveNavigationTest extends DuskTestCase
$this->browse(function (Browser $browser) use ($admin): void {
$browser->loginAs($admin)->visit('/admin');
$this->openMobileNavigation($browser);
$browser->click('.wms-mobile-overlay')
$browser->script('document.querySelector(".wms-mobile-overlay")?.click();')
->waitUntil('document.documentElement.dataset.wmsMobileSidebar !== "open"', 10);
});
}