createPlatformAdmin(); $company = $this->createTenantCompany(['name' => 'Admin Browser Co', 'slug' => 'admin-browser-co']); $this->createWarehouseFor($admin, ['name' => 'System Warehouse', 'code' => 'SYS']); $this->createPaymentFor($company, ['description' => 'Browser payment']); $pages = [ ['route' => 'platform.dashboard', 'heading' => 'Platform administration', 'expected' => ['Companies', 'Warehouses', 'Licences']], ['route' => 'platform.companies.index', 'heading' => 'Companies', 'expected' => ['Admin Browser Co', 'Licences']], ['route' => 'platform.licenses.index', 'heading' => 'Licence keys', 'expected' => ['Browser Test Licence', 'enterprise']], ['route' => 'platform.payments.index', 'heading' => 'Payments and overrides', 'expected' => ['Browser payment', 'GBP']], ]; $this->browse(function (Browser $browser) use ($admin, $pages): void { $browser->loginAs($admin); foreach ($pages as $page) { $browser->visitRoute($page['route']); $this->eachBreakpoint($browser, function (Browser $browser, string $breakpoint) use ($page): void { $browser->assertSee($page['heading']); foreach ($page['expected'] as $text) { $browser->assertSee($text); } if ($this->isMobileNavigationBreakpoint($breakpoint)) { $browser->assertVisible('[data-wms-mobile-open]'); } else { $browser->assertVisible('[data-wms-sidebar]'); } }); } }); } public function test_platform_admin_can_create_company_licence_and_payment_from_ui(): void { $admin = $this->createPlatformAdmin(); $this->browse(function (Browser $browser) use ($admin): void { $browser ->loginAs($admin) ->visitRoute('platform.companies.index') ->type('name', 'UI Created Company') ->type('billing_email', 'accounts@ui-created.example') ->select('status', 'active') ->press('Create') ->waitForText('UI Created Company') ->assertSee('UI Created Company'); $companyId = (string) \Modules\Platform\app\Models\Company::query() ->where('name', 'UI Created Company') ->value('id'); $browser ->visitRoute('platform.licenses.index') ->select('company_id', $companyId) ->type('label', 'UI Enterprise Licence') ->select('plan', 'enterprise') ->type('max_users', '250') ->press('Issue') ->waitForText('New key:') ->assertSee('UI Enterprise Licence') ->assertSee('enterprise'); $browser ->visitRoute('platform.payments.index') ->select('company_id', $companyId) ->type('amount', '159900') ->type('currency', 'gbp') ->select('status', 'paid') ->type('description', 'UI manual payment') ->press('Add') ->waitForText('UI manual payment') ->assertSee('GBP 1,599.00') ->assertSee('paid'); }); } }