TenantAtlas/apps/platform/tests/Browser/PortfolioCompare/CrossEnvironmentPromotionExecutionSmokeTest.php
ahmido 292d555eac refactor: consolidate internal tenant model naming (#355)
## Summary
- consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources
- rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language
- align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture

## Validation
- not rerun as part of this commit/push/PR request

## Notes
- branch is 1 commit ahead of `platform-dev`
- main commit: `refactor: consolidate internal tenant model naming`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #355
2026-05-14 11:13:28 +00:00

58 lines
2.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Filament\Pages\CrossEnvironmentComparePage;
use App\Models\OperationRun;
use App\Support\OperationRunLinks;
use App\Support\Workspaces\WorkspaceContext;
use Tests\Feature\Concerns\BuildsPortfolioCompareFixtures;
uses(BuildsPortfolioCompareFixtures::class);
pest()->browser()->timeout(15_000);
it('smokes queued promotion execution and the canonical operation viewer', function (): void {
$fixture = $this->makeCrossEnvironmentCompareFixture();
$this->createPortfolioCompareSubject(
tenant: $fixture['sourceEnvironment'],
displayName: 'Browser Promotion Policy',
snapshot: ['settings' => [['key' => 'browser', 'value' => 1]]],
);
$this->actingAs($fixture['user'])->withSession([
WorkspaceContext::SESSION_KEY => (int) $fixture['workspace']->getKey(),
]);
session()->put(WorkspaceContext::SESSION_KEY, (int) $fixture['workspace']->getKey());
$page = visit(CrossEnvironmentComparePage::getUrl(parameters: [
'source_environment_id' => (int) $fixture['sourceEnvironment']->getKey(),
'target_environment_id' => (int) $fixture['targetEnvironment']->getKey(),
'policy_type' => ['deviceConfiguration'],
], panel: 'admin'));
$page
->assertNoJavaScriptErrors()
->waitForText('Cross-environment compare')
->assertSee('Compare preview')
->click('Generate promotion preflight')
->waitForText('Promotion preflight')
->assertSee('Execute promotion')
->click('Execute promotion')
->waitForText('Queue promotion')
->click('Queue promotion')
->waitForText('Promotion execution queued');
$run = OperationRun::query()->latest('id')->firstOrFail();
visit(OperationRunLinks::tenantlessView($run))
->waitForText(OperationRunLinks::identifier((int) $run->getKey()))
->assertRoute('admin.operations.view', [
'workspace' => (int) $run->workspace_id,
'run' => (int) $run->getKey(),
])
->assertNoJavaScriptErrors()
->assertSee(OperationRunLinks::identifier((int) $run->getKey()));
});