actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); Livewire::test(ListPolicies::class) ->assertActionVisible('sync') ->assertActionDisabled('sync'); Queue::assertNothingPushed(); }); it('does not execute sync action for readonly members (silently blocked by Filament)', function () { [$user, $tenant] = createUserWithTenant(role: 'readonly'); $this->actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); // When a disabled action is called, Filament blocks it silently (200 response, no execution) Livewire::test(ListPolicies::class) ->mountAction('sync') ->callMountedAction() ->assertSuccessful(); // The action should NOT have executed Queue::assertNothingPushed(); }); }); describe('US1: Member with capability sees enabled action + can execute', function () { beforeEach(function () { Queue::fake(); }); it('shows sync action as enabled for owner members', function () { bindFailHardGraphClient(); [$user, $tenant] = createUserWithTenant(role: 'owner'); $this->actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); Livewire::test(ListPolicies::class) ->assertActionVisible('sync') ->assertActionEnabled('sync'); }); it('allows owner members to execute sync action successfully', function () { bindFailHardGraphClient(); [$user, $tenant] = createUserWithTenant(role: 'owner'); $this->actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); Livewire::test(ListPolicies::class) ->mountAction('sync') ->callMountedAction() ->assertHasNoActionErrors(); Queue::assertPushed(SyncPoliciesJob::class); }); });