## 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
63 lines
2.4 KiB
PHP
63 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\EnvironmentDashboard;
|
|
use App\Support\ManagedEnvironmentLinks;
|
|
use Tests\Browser\Support\Spec322WorkspaceEnvironmentBrowserHarness as Spec322Harness;
|
|
|
|
pest()->browser()->timeout(45_000);
|
|
|
|
it('Spec322 smokes environment owned route and shell contracts', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
$environmentRoutes = [
|
|
'environment dashboard' => [
|
|
'url' => EnvironmentDashboard::getUrl(panel: 'admin', tenant: $fixture['environmentA']),
|
|
'text' => $fixture['environmentA']->name,
|
|
],
|
|
'baseline compare' => [
|
|
'url' => ManagedEnvironmentLinks::baselineCompareUrl($fixture['environmentA']),
|
|
'text' => 'Baseline Compare',
|
|
],
|
|
'required permissions' => [
|
|
'url' => ManagedEnvironmentLinks::requiredPermissionsUrl($fixture['environmentA']),
|
|
'text' => 'Required permissions',
|
|
],
|
|
];
|
|
|
|
foreach ($environmentRoutes as $route) {
|
|
$page = visit($route['url'])
|
|
->waitForText($route['text'])
|
|
->assertSee($fixture['environmentA']->name)
|
|
->assertScript('window.location.pathname.includes("/workspaces/")', true)
|
|
->assertScript('window.location.pathname.includes("/environments/")', true)
|
|
->assertScript('! window.location.search.includes("environment_id=")', true)
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
$page->script('window.location.reload();');
|
|
|
|
$page
|
|
->waitForText($route['text'])
|
|
->assertSee($fixture['environmentA']->name)
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
}
|
|
});
|
|
|
|
it('Spec322 smokes baseline compare rejects old workspace style access', function (): void {
|
|
$fixture = Spec322Harness::fixture();
|
|
|
|
Spec322Harness::authenticate($this, $fixture['user'], $fixture['workspace'], $fixture['environmentA']);
|
|
|
|
visit('/admin/baseline-compare-landing?environment_id='.(int) $fixture['environmentA']->getKey())
|
|
->assertScript(
|
|
'document.body.innerText.includes("404") || document.body.innerText.includes("Not Found") || document.body.innerText.includes("No access")',
|
|
true,
|
|
)
|
|
->assertNoJavaScriptErrors();
|
|
});
|