## Summary - enforce the canonical workspace/environment scope contract for workspace hubs and environment-owned surfaces - replace first-party Operations deep links that leaked Filament `tableFilters[...]` internals with stable product-level query behavior - add the sidebar scope indicator and split environment-page navigation into explicit `Workspace-wide` and `Workspace admin` groups - remove redundant tenantless `All environments` scope badges from workspace-wide pages while preserving explicit environment filter affordances - include the Spec 338 artifacts, guard tests, and browser smoke coverage for the new contract ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Navigation/Spec338EnvironmentSidebarSeparationTest.php tests/Feature/Navigation/Spec338OperationRunLinksQueryContractTest.php tests/Feature/Navigation/Spec338SidebarScopeIndicatorTest.php tests/Feature/Filament/PanelNavigationSegregationTest.php` - `cd apps/platform && ./vendor/bin/sail php vendor/bin/pest tests/Browser/Spec338ScopeContractSmokeTest.php --compact` ## Notes - Livewire v4 compliance unchanged - Filament provider registration remains in `bootstrap/providers.php` - no destructive action behavior changed - no migrations, env var changes, or new Filament asset registration Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #409
92 lines
3.4 KiB
PHP
92 lines
3.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\AlertDeliveryResource;
|
|
use App\Filament\Resources\AlertDestinationResource;
|
|
use App\Filament\Resources\AlertRuleResource;
|
|
use Tests\Browser\Support\Spec322WorkspaceEnvironmentBrowserHarness as Spec322Harness;
|
|
|
|
pest()->browser()->timeout(45_000);
|
|
|
|
it('Spec322 smokes alerts overview and alert deliveries no drift behavior', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
Spec322Harness::assertWorkspaceOnly(
|
|
visit(route('filament.admin.alerts'))->waitForText('Alerts'),
|
|
null,
|
|
$fixture['environmentA']->name,
|
|
);
|
|
|
|
$filteredAlerts = visit(route('filament.admin.alerts', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
]));
|
|
|
|
Spec322Harness::assertFilteredWorkspaceHub($filteredAlerts, $fixture['environmentA'], 'Sent');
|
|
|
|
$page = visit(AlertDeliveryResource::getUrl('index', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
], panel: 'admin'));
|
|
|
|
Spec322Harness::assertFilteredWorkspaceHub($page, $fixture['environmentA'], 'Sent');
|
|
|
|
Spec322Harness::clearWorkspaceHubEnvironmentFilter($page);
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, 'Sent', $fixture['environmentA']->name);
|
|
|
|
$page->script('window.location.reload();');
|
|
Spec322Harness::assertWorkspaceOnly($page, 'Sent', $fixture['environmentA']->name);
|
|
|
|
$page->script('window.history.back();');
|
|
Spec322Harness::assertFilteredWorkspaceHub($page, $fixture['environmentA'], 'Sent');
|
|
|
|
$page->script('window.history.forward();');
|
|
Spec322Harness::assertWorkspaceOnly($page, 'Sent', $fixture['environmentA']->name);
|
|
});
|
|
|
|
it('Spec322 smokes audit log filtered and clean entries without shell drift', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
Spec322Harness::assertFilteredWorkspaceHub(
|
|
visit(route('admin.monitoring.audit-log', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
])),
|
|
$fixture['environmentA'],
|
|
'Spec322 browser audit B',
|
|
);
|
|
|
|
$page = visit(route('admin.monitoring.audit-log'));
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, 'Spec322 browser audit B', $fixture['environmentA']->name);
|
|
|
|
$page->script('window.location.reload();');
|
|
Spec322Harness::assertWorkspaceOnly($page, 'Spec322 browser audit B', $fixture['environmentA']->name);
|
|
});
|
|
|
|
it('Spec322 smokes alert configuration surfaces ignore stray environment filters', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
$configurationUrls = [
|
|
AlertRuleResource::getUrl('index', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
], panel: 'admin'),
|
|
AlertDestinationResource::getUrl('index', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
], panel: 'admin'),
|
|
];
|
|
|
|
foreach ($configurationUrls as $url) {
|
|
visit($url)
|
|
->waitForText('Alerts')
|
|
->assertDontSee('Environment filter:')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
}
|
|
});
|