TenantAtlas/apps/platform/tests/Feature/Monitoring/OperationsDbOnlyTest.php
ahmido 6ac0913ff8 feat: implement operations UI operator actions regression gate (#436)
Implemented operations UI operator actions regression gate.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #436
2026-06-08 01:21:14 +00:00

70 lines
2.1 KiB
PHP

<?php
use App\Models\OperationRun;
use App\Support\Workspaces\WorkspaceContext;
use Filament\Facades\Filament;
use Illuminate\Support\Facades\Bus;
it('renders Monitoring → Operations index DB-only (no outbound HTTP, no background work)', function () {
[$user, $tenant] = createUserWithTenant(role: 'owner');
OperationRun::factory()->create([
'managed_environment_id' => $tenant->getKey(),
'type' => 'policy.sync',
'status' => 'queued',
'outcome' => 'pending',
'initiator_name' => 'System',
]);
$this->actingAs($user);
Bus::fake();
Filament::setTenant(null, true);
assertNoOutboundHttp(function () use ($tenant) {
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get(\App\Support\OperationRunLinks::index())
->assertOk()
->assertSee('Operations Hub')
->assertSee('Which operation needs attention now?')
->assertSee('Recent runs')
->assertSee('All')
->assertSee('Active')
->assertSee('Likely stale')
->assertSee('Terminal follow-up')
->assertSee('Succeeded')
->assertSee('Partial')
->assertSee('Failed');
});
Bus::assertNothingDispatched();
});
it('renders Monitoring → Operations detail DB-only (no outbound HTTP, no background work)', function () {
[$user, $tenant] = createUserWithTenant(role: 'owner');
$run = OperationRun::factory()->create([
'managed_environment_id' => $tenant->getKey(),
'type' => 'policy.sync',
'status' => 'queued',
'outcome' => 'pending',
'initiator_name' => 'System',
]);
$this->actingAs($user);
Bus::fake();
Filament::setTenant(null, true);
assertNoOutboundHttp(function () use ($tenant, $run) {
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get(\App\Support\OperationRunLinks::tenantlessView($run))
->assertOk()
->assertSee(\App\Support\OperationRunLinks::identifier($run));
});
Bus::assertNothingDispatched();
});