## Summary Implements Spec 284 for provider-neutral artifact source taxonomy. - add shared artifact source descriptor, resolver, taxonomy, and provider-detail support - update findings, evidence snapshots, stored reports, inventory items, and tenant review surfaces to disclose descriptor-first artifact summaries - add bounded Pest unit, feature, guard, and browser coverage for the taxonomy slice - include the completed Spec 284 package artifacts under `specs/284-provider-neutral-artifact-source-taxonomy/` ## Notes - branch: `284-provider-neutral-artifact-source-taxonomy` - commit: `bf8d59e0` - this PR was created as part of the requested commit/push/PR flow against `platform-dev` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #343
85 lines
3.3 KiB
PHP
85 lines
3.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\EvidenceSnapshotResource;
|
|
use App\Filament\Resources\FindingResource;
|
|
use App\Filament\Resources\InventoryItemResource;
|
|
use App\Filament\Resources\StoredReportResource;
|
|
use App\Filament\Resources\TenantReviewResource;
|
|
use App\Models\Finding;
|
|
use App\Models\InventoryItem;
|
|
use App\Models\StoredReport;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
pest()->browser()->timeout(30_000);
|
|
|
|
it('smokes descriptor-first artifact source surfaces in the Filament shell', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(ensureDefaultMicrosoftProviderConnection: true);
|
|
|
|
$finding = Finding::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'subject_external_id' => 'spec-284-policy',
|
|
'evidence_jsonb' => ['policy_type' => 'deviceCompliancePolicy'],
|
|
]);
|
|
$inventory = InventoryItem::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'policy_type' => 'deviceCompliancePolicy',
|
|
'display_name' => 'Spec 284 Compliance Inventory',
|
|
]);
|
|
$report = StoredReport::factory()->permissionPosture()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
]);
|
|
$snapshot = seedTenantReviewEvidence($tenant, findingCount: 1, driftCount: 1);
|
|
$review = composeTenantReviewForTest($tenant, $user, $snapshot);
|
|
|
|
$this->actingAs($user)->withSession([
|
|
WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id,
|
|
WorkspaceContext::LAST_TENANT_IDS_SESSION_KEY => [
|
|
(string) $tenant->workspace_id => (int) $tenant->getKey(),
|
|
],
|
|
]);
|
|
|
|
visit(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant))
|
|
->waitForText('Artifact source')
|
|
->assertSee('Source family')
|
|
->assertSee('Provider finding type')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(InventoryItemResource::getUrl('view', ['record' => $inventory], tenant: $tenant))
|
|
->waitForText('Artifact source')
|
|
->assertSee('Canonical type')
|
|
->assertSee('Provider display type')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(StoredReportResource::getUrl('view', ['record' => $report], tenant: $tenant))
|
|
->waitForText('Artifact source')
|
|
->assertSee('Provider report type')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(EvidenceSnapshotResource::getUrl('view', ['record' => $snapshot], tenant: $tenant))
|
|
->waitForText('Evidence dimensions')
|
|
->assertSee('Source family')
|
|
->assertSee('Provider source detail')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(TenantReviewResource::getUrl('view', ['record' => $review], tenant: $tenant))
|
|
->waitForText('Sections')
|
|
->click('Details')
|
|
->waitForText('Artifact source')
|
|
->assertSee('Artifact source')
|
|
->assertSee('Source family')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
});
|