## Summary - standardize Filament table defaults across resources, relation managers, widgets, custom pages, and picker tables - add shared pagination profiles, calm default column visibility, explicit empty states, and session persistence on designated critical resource lists - complete Spec 125 artifacts, regression tests, and dashboard widget follow-up for lazy loading, sortable columns, and toggleable detail columns ## Verification - `docker exec tenantatlas-laravel.test-1 php artisan test --compact --filter=BaselineCompareNow` - `docker exec tenantatlas-laravel.test-1 php artisan test --compact --filter=TableStandardsBaseline` - `docker exec tenantatlas-laravel.test-1 php artisan test --compact --filter=TableDetailVisibility` - `docker exec tenantatlas-laravel.test-1 php artisan test --compact --filter=FilamentTableRiskExceptions` - full suite run completed: `2017 passed, 10 failed, 8 skipped` - manual browser QA completed on the tenant dashboard for lazy loading, sortable widget columns, toggleable hidden status columns, badges, and pagination ## Known Failures The full suite still has 10 pre-existing failures unrelated to this branch: - `Tests\\Unit\\OpsUx\\SummaryCountsNormalizerTest` - `Tests\\Feature\\BackupWithAssignmentsConsistencyTest` (2 tests) - `Tests\\Feature\\BaselineDriftEngine\\CaptureBaselineContentTest` - `Tests\\Feature\\BaselineDriftEngine\\CompareContentEvidenceTest` - `Tests\\Feature\\BaselineDriftEngine\\ResolverTest` - `Tests\\Feature\\Filament\\TenantDashboardDbOnlyTest` - `Tests\\Feature\\Operations\\ReconcileAdapterRunsJobTrackingTest` - `Tests\\Feature\\ReviewPack\\ReviewPackRbacTest` - `Tests\\Feature\\Verification\\VerificationReportRedactionTest` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #152
170 lines
4.7 KiB
PHP
170 lines
4.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\Monitoring\Operations;
|
|
use App\Filament\Resources\BackupScheduleResource\Pages\ListBackupSchedules;
|
|
use App\Filament\Resources\BackupSetResource\Pages\ListBackupSets;
|
|
use App\Filament\Resources\FindingResource\Pages\ListFindings;
|
|
use App\Filament\Resources\PolicyResource\Pages\ListPolicies;
|
|
use App\Filament\Resources\ProviderConnectionResource\Pages\ListProviderConnections;
|
|
use App\Filament\Resources\TenantResource\Pages\ListTenants;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
/**
|
|
* @param array<string, mixed> $parameters
|
|
*/
|
|
function spec125AssertPersistedTableState(
|
|
string $componentClass,
|
|
array $parameters,
|
|
string $search,
|
|
string $sortColumn,
|
|
string $sortDirection,
|
|
string $filterPath,
|
|
mixed $filterValue,
|
|
): void {
|
|
$component = Livewire::test($componentClass, $parameters)
|
|
->searchTable($search)
|
|
->call('sortTable', $sortColumn, $sortDirection)
|
|
->set($filterPath, $filterValue);
|
|
|
|
$instance = $component->instance();
|
|
|
|
expect(session()->get($instance->getTableSearchSessionKey()))->toBe($search);
|
|
expect(session()->get($instance->getTableSortSessionKey()))->toBe("{$sortColumn}:{$sortDirection}");
|
|
expect(data_get(session()->get($instance->getTableFiltersSessionKey()), str($filterPath)->after('tableFilters.')->value()))->toBe($filterValue);
|
|
|
|
Livewire::test($componentClass, $parameters)
|
|
->assertSet('tableSearch', $search)
|
|
->assertSet('tableSort', "{$sortColumn}:{$sortDirection}")
|
|
->assertSet($filterPath, $filterValue);
|
|
}
|
|
|
|
it('persists tenant list search, sort, and filter state across remounts', function (): void {
|
|
[$user] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
Filament::setTenant(null, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListTenants::class,
|
|
[],
|
|
'Tenant',
|
|
'name',
|
|
'desc',
|
|
'tableFilters.environment.value',
|
|
'prod',
|
|
);
|
|
});
|
|
|
|
it('persists policy list search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListPolicies::class,
|
|
[],
|
|
'Policy',
|
|
'display_name',
|
|
'desc',
|
|
'tableFilters.visibility.value',
|
|
'active',
|
|
);
|
|
});
|
|
|
|
it('persists backup-set list search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListBackupSets::class,
|
|
[],
|
|
'Backup',
|
|
'name',
|
|
'desc',
|
|
'tableFilters.trashed.value',
|
|
1,
|
|
);
|
|
});
|
|
|
|
it('persists backup-schedule list search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListBackupSchedules::class,
|
|
[],
|
|
'Schedule',
|
|
'name',
|
|
'desc',
|
|
'tableFilters.enabled_state.value',
|
|
'enabled',
|
|
);
|
|
});
|
|
|
|
it('persists provider-connections list search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListProviderConnections::class,
|
|
[],
|
|
'Contoso',
|
|
'display_name',
|
|
'desc',
|
|
'tableFilters.default_only.isActive',
|
|
true,
|
|
);
|
|
});
|
|
|
|
it('persists findings list search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'manager');
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
ListFindings::class,
|
|
[],
|
|
'drift',
|
|
'created_at',
|
|
'asc',
|
|
'tableFilters.status.value',
|
|
'new',
|
|
);
|
|
});
|
|
|
|
it('persists monitoring operations search, sort, and filter state across remounts', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user);
|
|
Filament::setTenant($tenant, true);
|
|
|
|
spec125AssertPersistedTableState(
|
|
Operations::class,
|
|
[],
|
|
'policy',
|
|
'type',
|
|
'desc',
|
|
'tableFilters.status.value',
|
|
'queued',
|
|
);
|
|
});
|