coolify/tests/Feature/PreviewStatusSummaryTest.php
Andras Bacsai 262ad8981a feat(ui): unify status summaries, tooltips, and resource headings
Add shared status-summary and icon-tooltip components and wire them into
application, service, and database headings, breadcrumbs, and previews.
Badge production and PR domain links, prefer helper popups below the
trigger, keep full wire targets for button loading, and cover the UI
with feature tests.
2026-08-06 18:15:58 +02:00

76 lines
3.3 KiB
PHP

<?php
use Illuminate\Support\Facades\Blade;
it('aggregates preview container and health check status', function () {
$html = Blade::render('<x-status-summary status="running:unknown" title="Preview status" />');
expect($html)
->toContain('Preview status')
->toContain('Container')
->toContain('Running (no health check)')
->toContain('Health check')
->toContain('Not configured')
->toContain('aria-label="About unconfigured health checks"')
->toContain('Traffic can still be routed to the container')
->toContain('aria-haspopup="menu"');
});
it('uses the aggregated preview status in the previews list', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));
expect($view)
->toContain('<x-status-summary :status="data_get($preview, \'status\')" title="Preview status" />')
->not->toContain('<x-status.running :status="data_get($preview, \'status\')" />');
});
it('uses the aggregated application status beside the top breadcrumbs', function () {
$status = file_get_contents(resource_path('views/livewire/project/application/status.blade.php'));
expect($status)
->toContain('<x-status-summary :status="$application->status" />')
->not->toContain('$statusLabel');
});
it('uses the aggregated status badge for databases and services', function () {
$databaseStatus = file_get_contents(resource_path('views/livewire/project/database/status.blade.php'));
$serviceStatus = file_get_contents(resource_path('views/livewire/project/service/status.blade.php'));
expect($databaseStatus)
->toContain('<x-status-summary :status="$database->status" title="Database status" />')
->and($serviceStatus)
->toContain('<x-status-summary :status="$service->status" title="Service status" container-name="Containers" />');
});
it('groups preview deployment actions in a dropdown', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));
expect($view)
->toContain('title="Preview actions"')
->toContain('preview-stop-trigger-{{ data_get($preview, \'pull_request_id\') }}')
->toContain('preview-delete-trigger-{{ data_get($preview, \'pull_request_id\') }}')
->not->toContain('<x-slot:customButton>');
});
it('marks external preview links and groups logs in a dropdown', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));
expect($view)
->toContain('title="Open preview in a new tab"')
->toContain('title="Open pull request in a new tab"')
->toContain('<x-reicon name="external-link"')
->toContain('title="Preview logs"')
->toContain('Deployment logs')
->toContain('Runtime logs')
->not->toContain('Application logs');
});
it('places links and logs dropdowns beside preview actions', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));
$controls = str($view)->after('id="preview-header-controls')->before('<div class="hidden" aria-hidden="true">')->toString();
expect($controls)
->toContain('title="Preview links"')
->toContain('title="Preview logs"')
->toContain('title="Preview actions"');
});