52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\CrossEnvironmentComparePage;
|
|
use App\Filament\Pages\EnvironmentDashboard;
|
|
use App\Filament\Pages\Findings\MyFindingsInbox;
|
|
use App\Filament\Pages\Settings\WorkspaceSettings;
|
|
use App\Filament\Resources\BaselineProfileResource;
|
|
use Tests\Browser\Support\Spec322WorkspaceEnvironmentBrowserHarness as Spec322Harness;
|
|
|
|
pest()->browser()->timeout(45_000);
|
|
|
|
it('Spec322 smokes workspace owned analysis and configuration surfaces stay workspace only', 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();
|
|
|
|
$surfaces = [
|
|
'baseline profiles' => [
|
|
'url' => BaselineProfileResource::getUrl('index', panel: 'admin'),
|
|
],
|
|
'my findings' => [
|
|
'url' => MyFindingsInbox::getUrl(panel: 'admin'),
|
|
],
|
|
'cross-environment compare' => [
|
|
'url' => CrossEnvironmentComparePage::getUrl(panel: 'admin'),
|
|
],
|
|
'workspace settings' => [
|
|
'url' => WorkspaceSettings::getUrl(panel: 'admin'),
|
|
],
|
|
];
|
|
|
|
foreach ($surfaces as $surface) {
|
|
$expectedPath = json_encode((string) parse_url($surface['url'], PHP_URL_PATH), JSON_THROW_ON_ERROR);
|
|
$page = visit($surface['url']);
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, null, $fixture['environmentA']->name);
|
|
$page->assertScript("window.location.pathname === {$expectedPath}", true);
|
|
|
|
$page->script('window.location.reload();');
|
|
|
|
Spec322Harness::assertWorkspaceOnly($page, null, $fixture['environmentA']->name);
|
|
$page->assertScript("window.location.pathname === {$expectedPath}", true);
|
|
}
|
|
});
|