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();
|
|
});
|