Auto-created PR: committing all local changes and pushing branch `277-stored-reports-surface` to remote. Please review and adjust the title/description as needed. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #333
61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\StoredReportResource;
|
|
use App\Models\StoredReport;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
pest()->browser()->timeout(20_000);
|
|
|
|
it('smokes the tenant stored-reports register to detail handoff', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(
|
|
role: 'owner',
|
|
workspaceRole: 'manager',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
StoredReport::factory()
|
|
->permissionPosture([
|
|
'posture_score' => 91,
|
|
'required_count' => 8,
|
|
'granted_count' => 7,
|
|
'permissions' => [
|
|
['key' => 'DeviceManagementConfiguration.Read.All', 'status' => 'granted'],
|
|
['key' => 'DeviceManagementApps.ReadWrite.All', 'status' => 'missing'],
|
|
],
|
|
])
|
|
->create([
|
|
'tenant_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'fingerprint' => 'spec-277-browser-fingerprint',
|
|
]);
|
|
|
|
$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(StoredReportResource::getUrl('index', tenant: $tenant, panel: 'tenant'))
|
|
->waitForText('Stored reports')
|
|
->assertSee('Permission posture report')
|
|
->assertSee('Current')
|
|
->assertSee('Posture score: 91')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs()
|
|
->click('Permission posture report')
|
|
->waitForText('Permission posture summary')
|
|
->assertSee('Outcome summary')
|
|
->assertSee('Stored report')
|
|
->assertSee('Missing permissions')
|
|
->assertSee('DeviceManagementApps.ReadWrite.All')
|
|
->assertSee('Raw payload')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
});
|