## Summary Implements feature branch `286-ui-copy-ia-localization-neutralization`. This change set: - aligns chooser, managed-environment landing, dashboard, shell, and workspace context copy to environment-first terminology - neutralizes the bounded policy and baseline helper copy called out by Spec 286 - adds focused feature, guard, and browser coverage plus the complete Spec 286 artifact set - records the discovered `Capture snapshot` modal issue as out-of-scope runtime debt in the Spec 286 close-out notes ## Validation - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Localization/EnvironmentContextTerminologyTest.php tests/Feature/Filament/EnvironmentContextSurfaceCopyTest.php tests/Feature/Filament/Localization/PolicyInventoryLocalizationTest.php tests/Feature/Guards/EnvironmentCopyNeutralizationGuardTest.php` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec286EnvironmentCopyNeutralizationSmokeTest.php` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Notes - Target branch: `platform-dev` - Filament remains on v5 with Livewire v4. - Provider registration remains unchanged in `apps/platform/bootstrap/providers.php`. - No new destructive actions, asset strategy changes, or global-search posture changes are introduced in this slice. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #345
95 lines
3.1 KiB
PHP
95 lines
3.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\PolicyResource;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\Policy;
|
|
use App\Models\PolicyVersion;
|
|
use App\Models\ProviderConnection;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Models\WorkspaceMembership;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
pest()->browser()->timeout(20_000);
|
|
|
|
it('smokes environment-first chooser and policy helper copy', function (): void {
|
|
$workspace = Workspace::factory()->create([
|
|
'name' => 'Spec 286 Workspace',
|
|
]);
|
|
|
|
$environment = ManagedEnvironment::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'name' => 'Spec 286 Production',
|
|
'slug' => 'spec-286-production',
|
|
]);
|
|
|
|
$secondaryEnvironment = ManagedEnvironment::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'name' => 'Spec 286 Secondary',
|
|
'slug' => 'spec-286-secondary',
|
|
]);
|
|
|
|
$user = User::factory()->create();
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'user_id' => (int) $user->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
|
|
foreach ([$environment, $secondaryEnvironment] as $memberEnvironment) {
|
|
$user->tenants()->syncWithoutDetaching([
|
|
(int) $memberEnvironment->getKey() => ['role' => 'owner'],
|
|
]);
|
|
}
|
|
|
|
ProviderConnection::factory()->platform()->consentGranted()->create([
|
|
'managed_environment_id' => (int) $environment->getKey(),
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'is_default' => true,
|
|
]);
|
|
|
|
$policy = Policy::factory()->create([
|
|
'managed_environment_id' => (int) $environment->getKey(),
|
|
'display_name' => 'Spec 286 Policy',
|
|
]);
|
|
|
|
PolicyVersion::factory()->create([
|
|
'managed_environment_id' => (int) $environment->getKey(),
|
|
'policy_id' => (int) $policy->getKey(),
|
|
'metadata' => [],
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
$landing = visit(route('admin.workspace.managed-tenants.index', ['workspace' => $workspace]))
|
|
->waitForText('Managed environments')
|
|
->assertSee('Choose environment')
|
|
->assertSee('Spec 286 Production')
|
|
->assertSee('Spec 286 Secondary')
|
|
->assertDontSee('Managed tenants')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
$landing
|
|
->click('[wire\:key="tenant-'.$environment->getKey().'"]')
|
|
->waitForText('Spec 286 Production')
|
|
->waitForText('Environment governance overview')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(PolicyResource::getUrl('view', ['record' => $policy], tenant: $environment))
|
|
->waitForText('Capture snapshot')
|
|
->assertSee('Restore to environment')
|
|
->assertDontSee('Restore to Microsoft Intune')
|
|
->click('Capture snapshot')
|
|
->waitForText('Capture snapshot now')
|
|
->assertSee('current environment')
|
|
->assertSee('Source: Microsoft Intune')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
}); |