## Summary - restore broad full-suite green-signal coverage across platform governance, operations, onboarding, dashboard/productization, and customer review flows - align related platform tests and supporting behavior with the current expected state for this restoration pass - update the spec-candidates queue as part of the same suite-restoration sweep ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php tests/Browser/Reviews/CustomerReviewWorkspaceSmokeTest.php tests/Browser/Spec194GovernanceFrictionSmokeTest.php tests/Browser/Spec265DecisionRegisterSmokeTest.php` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #351
57 lines
2.1 KiB
PHP
57 lines
2.1 KiB
PHP
<?php
|
|
|
|
use App\Filament\Resources\ProviderConnectionResource\Pages\ListProviderConnections;
|
|
use Filament\Actions\Action;
|
|
use Filament\Facades\Filament;
|
|
use Livewire\Livewire;
|
|
|
|
describe('Provider connections create action UI enforcement', function () {
|
|
it('shows create action as visible but disabled for readonly members', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly', fixtureProfile: 'provider-enabled');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
Livewire::test(ListProviderConnections::class)
|
|
->assertActionVisible('create')
|
|
->assertActionDisabled('create')
|
|
->assertActionExists('create', function (Action $action): bool {
|
|
return $action->getTooltip() === 'You do not have permission to create provider connections.';
|
|
});
|
|
});
|
|
|
|
it('shows create action as enabled for owner members', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner', fixtureProfile: 'provider-enabled');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
Livewire::test(ListProviderConnections::class)
|
|
->assertActionVisible('create')
|
|
->assertActionEnabled('create');
|
|
});
|
|
|
|
it('hides create action after membership is revoked mid-session', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner', fixtureProfile: 'provider-enabled');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$component = Livewire::test(ListProviderConnections::class)
|
|
->assertActionVisible('create')
|
|
->assertActionEnabled('create');
|
|
|
|
$user->tenants()->detach($tenant->getKey());
|
|
$user->workspaces()->detach((int) $tenant->workspace_id);
|
|
app(\App\Services\Auth\CapabilityResolver::class)->clearCache();
|
|
app(\App\Services\Auth\WorkspaceCapabilityResolver::class)->clearCache();
|
|
|
|
$component
|
|
->call('$refresh')
|
|
->assertActionHidden('create');
|
|
});
|
|
});
|