Files
WMS/Modules/Company/Tests/Browser/CompanyAdministrationBrowserTest.php
T

37 lines
1.5 KiB
PHP

<?php
namespace Modules\Company\Tests\Browser;
use App\Models\User;
use Laravel\Dusk\Browser;
use Modules\Company\Models\Company;
use Modules\Countries\Models\Country;
use Tests\DuskTestCase;
class CompanyAdministrationBrowserTest extends DuskTestCase
{
public function test_platform_admin_can_see_company_address_divisions_and_director_sections(): void
{
$system = Company::query()->firstOrCreate(['slug' => 'mpba-limited'], ['name' => 'MPBA Limited', 'is_system_company' => true, 'status' => 'active']);
$tenant = Company::query()->firstOrCreate(['slug' => 'sentinel'], ['name' => 'Sentinel', 'status' => 'active']);
Country::query()->firstOrCreate(['alpha2' => 'GB'], ['alpha3' => 'GBR', 'numeric' => '826', 'name' => 'United Kingdom', 'is_active' => true]);
$admin = User::query()->firstOrCreate(['email' => 'company-admin-browser@example.test'], [
'company_id' => $system->id,
'name' => 'Company Browser Admin',
'password' => bcrypt('password'),
'is_platform_admin' => true,
'status' => 'active',
]);
$this->browse(function (Browser $browser) use ($admin, $tenant): void {
$browser->loginAs($admin)
->visitRoute('platform.companies.show', $tenant)
->assertSee('Company address')
->assertSee('Create division')
->assertSee('Director coverage')
->assertSee('Warehouse division and address alignment')
->assertSee('Divisions');
});
}
}