## Summary - add the Spec 322 artifact set for the browser no-drift regression guard - add Feature navigation guards for admin surface scope, environment CTA URLs, and legacy alias rejection - add Browser smoke coverage for workspace hubs, environment-owned surfaces, workspace-owned analysis surfaces, and alerts/audit flows - add the Spec 322 browser support harness used by the new smoke coverage ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Navigation/Spec322AdminSurfaceScopeContractTest.php tests/Feature/Navigation/Spec322LegacyQueryAliasGuardTest.php tests/Feature/Navigation/Spec322EnvironmentCtaUrlContractTest.php --compact` - `cd apps/platform && ./vendor/bin/sail artisan test tests/Browser/Spec322WorkspaceHubNoDriftSmokeTest.php tests/Browser/Spec322EnvironmentOwnedSurfaceSmokeTest.php tests/Browser/Spec322WorkspaceOwnedAnalysisSmokeTest.php tests/Browser/Spec322AlertsAuditNoDriftSmokeTest.php --compact` - `cd apps/platform && ./vendor/bin/sail pint --dirty` - `git diff --check` ## Notes - a broader filtered regression run still reports existing Baseline Compare feature-test failures outside this diff Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #379
106 lines
5.0 KiB
PHP
106 lines
5.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\BaselineCompareLanding;
|
|
use App\Filament\Pages\Governance\DecisionRegister;
|
|
use App\Filament\Pages\Governance\GovernanceInbox;
|
|
use App\Filament\Pages\Monitoring\FindingExceptionsQueue;
|
|
use App\Filament\Pages\Reviews\CustomerReviewWorkspace;
|
|
use App\Filament\Pages\Reviews\ReviewRegister;
|
|
use App\Filament\Pages\Settings\WorkspaceSettings;
|
|
use App\Filament\Resources\AlertDeliveryResource;
|
|
use App\Filament\Resources\AlertDestinationResource;
|
|
use App\Filament\Resources\AlertRuleResource;
|
|
use App\Filament\Resources\ProviderConnectionResource;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Support\ManagedEnvironmentLinks;
|
|
use App\Support\OperationRunLinks;
|
|
|
|
it('environment_cta_urls_use_the_correct_surface_contract', function (): void {
|
|
$environment = ManagedEnvironment::factory()->active()->create([
|
|
'name' => 'Spec322 CTA Environment',
|
|
]);
|
|
[$user, $environment] = createUserWithTenant(tenant: $environment, role: 'owner', workspaceRole: 'owner');
|
|
$workspace = $environment->workspace()->firstOrFail();
|
|
|
|
$this->actingAs($user);
|
|
setAdminPanelContext($environment);
|
|
|
|
$workspaceHubUrls = [
|
|
OperationRunLinks::index($environment),
|
|
ManagedEnvironmentLinks::operationsUrl($environment),
|
|
ManagedEnvironmentLinks::providerConnectionsUrl($environment),
|
|
ProviderConnectionResource::getUrl('index', ['environment_id' => (int) $environment->getKey()], panel: 'admin'),
|
|
CustomerReviewWorkspace::environmentFilterUrl($environment),
|
|
GovernanceInbox::getUrl(panel: 'admin', parameters: ['environment_id' => (int) $environment->getKey()]),
|
|
DecisionRegister::getUrl(panel: 'admin', parameters: ['environment_id' => (int) $environment->getKey()]),
|
|
FindingExceptionsQueue::getUrl(panel: 'admin', parameters: ['environment_id' => (int) $environment->getKey()]),
|
|
route('admin.evidence.overview', ['environment_id' => (int) $environment->getKey()]),
|
|
ReviewRegister::getUrl(panel: 'admin', parameters: ['environment_id' => (int) $environment->getKey()]),
|
|
route('admin.monitoring.audit-log', ['environment_id' => (int) $environment->getKey()]),
|
|
AlertDeliveryResource::getUrl('index', ['environment_id' => (int) $environment->getKey()], panel: 'admin'),
|
|
];
|
|
|
|
foreach ($workspaceHubUrls as $url) {
|
|
$query = spec322Query($url);
|
|
|
|
expect($query)->toHaveKey('environment_id', (string) $environment->getKey())
|
|
->and($query)->not->toHaveKey('tenant')
|
|
->and($query)->not->toHaveKey('tenant_id')
|
|
->and($query)->not->toHaveKey('managed_environment_id')
|
|
->and($query)->not->toHaveKey('environment')
|
|
->and($query)->not->toHaveKey('tenant_scope')
|
|
->and($query)->not->toHaveKey('tableFilters');
|
|
}
|
|
|
|
$environmentOwnedUrls = [
|
|
ManagedEnvironmentLinks::viewUrl($environment),
|
|
ManagedEnvironmentLinks::baselineCompareUrl($environment),
|
|
BaselineCompareLanding::getUrl(panel: 'admin', tenant: $environment),
|
|
ManagedEnvironmentLinks::requiredPermissionsUrl($environment),
|
|
ManagedEnvironmentLinks::diagnosticsUrl($environment),
|
|
route('filament.admin.workspaces.{workspace}.environments.{environment}.inventory', [
|
|
'workspace' => ManagedEnvironmentLinks::workspaceRouteKey($workspace),
|
|
'environment' => ManagedEnvironmentLinks::environmentRouteKey($environment),
|
|
]),
|
|
route('filament.admin.workspaces.{workspace}.environments.{environment}.inventory.pages.inventory-coverage', [
|
|
'workspace' => ManagedEnvironmentLinks::workspaceRouteKey($workspace),
|
|
'environment' => ManagedEnvironmentLinks::environmentRouteKey($environment),
|
|
]),
|
|
];
|
|
|
|
foreach ($environmentOwnedUrls as $url) {
|
|
expect((string) parse_url($url, PHP_URL_PATH))
|
|
->toContain('/admin/workspaces/'.ManagedEnvironmentLinks::workspaceRouteKey($workspace).'/environments/'.ManagedEnvironmentLinks::environmentRouteKey($environment))
|
|
->and(spec322Query($url))->not->toHaveKey('environment_id')
|
|
->and(spec322Query($url))->not->toHaveKey('managed_environment_id')
|
|
->and(spec322Query($url))->not->toHaveKey('tenant')
|
|
->and(spec322Query($url))->not->toHaveKey('tableFilters');
|
|
}
|
|
|
|
$workspaceConfigurationUrls = [
|
|
AlertRuleResource::getUrl('index', panel: 'admin'),
|
|
AlertDestinationResource::getUrl('index', panel: 'admin'),
|
|
WorkspaceSettings::getUrl(panel: 'admin'),
|
|
];
|
|
|
|
foreach ($workspaceConfigurationUrls as $url) {
|
|
expect(spec322Query($url))->not->toHaveKey('environment_id')
|
|
->and(spec322Query($url))->not->toHaveKey('managed_environment_id')
|
|
->and(spec322Query($url))->not->toHaveKey('tenant')
|
|
->and(spec322Query($url))->not->toHaveKey('tableFilters');
|
|
}
|
|
});
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
function spec322Query(string $url): array
|
|
{
|
|
$query = [];
|
|
parse_str((string) parse_url($url, PHP_URL_QUERY), $query);
|
|
|
|
return $query;
|
|
}
|