124 lines
4.7 KiB
PHP
124 lines
4.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\EnvironmentDashboard;
|
|
use App\Filament\Pages\Governance\GovernanceInbox;
|
|
use App\Filament\Pages\Monitoring\FindingExceptionsQueue;
|
|
use App\Filament\Resources\ProviderConnectionResource;
|
|
use App\Support\OperationRunLinks;
|
|
use Tests\Browser\Support\Spec322WorkspaceEnvironmentBrowserHarness as Spec322Harness;
|
|
|
|
pest()->browser()->timeout(90_000);
|
|
|
|
it('Spec322 smokes clean workspace hub entry from environment origin without drift', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
visit(EnvironmentDashboard::getUrl(panel: 'admin', tenant: $fixture['environmentA']))
|
|
->assertSee($fixture['environmentA']->name)
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
$cleanHubs = [
|
|
'operations' => [
|
|
'url' => OperationRunLinks::index(workspace: $fixture['workspace']),
|
|
'wide_text' => 'Inventory sync',
|
|
],
|
|
'governance inbox' => [
|
|
'url' => GovernanceInbox::getUrl(panel: 'admin'),
|
|
'wide_text' => 'Spec322 Browser Governance B',
|
|
],
|
|
'provider connections' => [
|
|
'url' => ProviderConnectionResource::getUrl('index', panel: 'admin'),
|
|
'wide_text' => 'Spec322 Browser Provider B',
|
|
],
|
|
'evidence overview' => [
|
|
'url' => route('admin.evidence.overview'),
|
|
'wide_text' => $fixture['environmentB']->name,
|
|
],
|
|
];
|
|
|
|
foreach ($cleanHubs as $hub) {
|
|
$page = visit($hub['url']);
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, $hub['wide_text'], $fixture['environmentA']->name);
|
|
|
|
$page->script('window.location.reload();');
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, $hub['wide_text'], $fixture['environmentA']->name);
|
|
}
|
|
});
|
|
|
|
it('Spec322 smokes filtered workspace hub clear reload and history alignment', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
$filteredHubs = [
|
|
'provider connections' => [
|
|
'filtered_url' => ProviderConnectionResource::getUrl('index', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
], panel: 'admin'),
|
|
'wide_text' => 'Spec322 Browser Provider B',
|
|
'hidden_text' => 'Spec322 Browser Provider B',
|
|
],
|
|
'evidence overview' => [
|
|
'filtered_url' => route('admin.evidence.overview', [
|
|
'environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
]),
|
|
'wide_text' => $fixture['environmentB']->name,
|
|
'hidden_text' => $fixture['environmentB']->name,
|
|
],
|
|
];
|
|
|
|
foreach ($filteredHubs as $hub) {
|
|
$page = visit($hub['filtered_url']);
|
|
|
|
Spec322Harness::assertFilteredWorkspaceHub($page, $fixture['environmentA'], $hub['hidden_text']);
|
|
|
|
Spec322Harness::clearWorkspaceHubEnvironmentFilter($page);
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, $hub['wide_text'], $fixture['environmentA']->name);
|
|
|
|
$page->script('window.location.reload();');
|
|
Spec322Harness::assertWorkspaceOnly($page, $hub['wide_text'], $fixture['environmentA']->name);
|
|
|
|
$page->script('window.history.back();');
|
|
Spec322Harness::assertFilteredWorkspaceHub($page, $fixture['environmentA'], $hub['hidden_text']);
|
|
|
|
$page->script('window.history.forward();');
|
|
Spec322Harness::assertWorkspaceOnly($page, $hub['wide_text'], $fixture['environmentA']->name);
|
|
}
|
|
});
|
|
|
|
it('Spec322 smokes representative legacy aliases without creating filter state', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
$legacyUrls = [
|
|
ProviderConnectionResource::getUrl('index', [
|
|
'managed_environment_id' => (int) $fixture['environmentA']->getKey(),
|
|
], panel: 'admin'),
|
|
FindingExceptionsQueue::getUrl(panel: 'admin', parameters: [
|
|
'tenant' => (string) $fixture['environmentA']->getKey(),
|
|
]),
|
|
route('admin.monitoring.audit-log', [
|
|
'tableFilters' => [
|
|
'managed_environment_id' => ['value' => (string) $fixture['environmentA']->getKey()],
|
|
],
|
|
]),
|
|
];
|
|
|
|
foreach ($legacyUrls as $url) {
|
|
visit($url)
|
|
->waitForText($fixture['environmentB']->name)
|
|
->assertDontSee('Environment filter:')
|
|
->assertSee($fixture['environmentB']->name)
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
}
|
|
});
|