mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-27 17:55:59 -04:00
Merge remote-tracking branch 'origin/next' into fix-ghe-app-install-url
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
it('uses native mobile menus for databases and services', function () {
|
||||
$applicationHeading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php'));
|
||||
$databaseHeading = file_get_contents(resource_path('views/livewire/project/database/heading.blade.php'));
|
||||
$serviceHeading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));
|
||||
|
||||
expect($applicationHeading)
|
||||
->toContain("'route' => 'project.application.command'")
|
||||
->toContain("'navigate' => false")
|
||||
->toContain("value.startsWith('location|')")
|
||||
->toContain('window.location.href = url');
|
||||
|
||||
expect($databaseHeading)
|
||||
->toContain('database-mobile-section')
|
||||
->toContain('<optgroup label="Database">')
|
||||
->toContain('<optgroup label="Configuration">')
|
||||
->toContain('<optgroup label="Actions">')
|
||||
->toContain("'route' => 'project.database.command'")
|
||||
->toContain("'navigate' => false")
|
||||
->toContain("value.startsWith('location|')")
|
||||
->toContain('window.location.href = url')
|
||||
->toContain('window.Livewire?.navigate ? window.Livewire.navigate(url) : window.location.href = url')
|
||||
->toContain("window.Livewire?.hook?.('morphed'")
|
||||
->toContain('x-model="selected"')
|
||||
->toContain('database-restart-trigger')
|
||||
->toContain('database-stop-trigger')
|
||||
->toContain('scrollbar hidden min-h-10')
|
||||
->not->toContain('<optgroup label="Links">')
|
||||
->not->toContain('@selected');
|
||||
|
||||
expect($serviceHeading)
|
||||
->toContain('service-mobile-section')
|
||||
->toContain('<optgroup label="Service">')
|
||||
->toContain('<optgroup label="Configuration">')
|
||||
->toContain('<optgroup label="Resource">')
|
||||
->toContain('<optgroup label="Links">')
|
||||
->toContain('<optgroup label="Actions">')
|
||||
->toContain("'route' => 'project.service.command'")
|
||||
->toContain("'navigate' => false")
|
||||
->toContain("value.startsWith('location|')")
|
||||
->toContain('window.location.href = url')
|
||||
->toContain('window.Livewire?.navigate ? window.Livewire.navigate(url) : window.location.href = url')
|
||||
->toContain("window.Livewire?.hook?.('morphed'")
|
||||
->toContain('x-model="selected"')
|
||||
->toContain('service-restart-trigger')
|
||||
->toContain('service-stop-trigger')
|
||||
->toContain('service-forceDeploy-trigger')
|
||||
->toContain('service-pullAndRestart-trigger')
|
||||
->toContain('scrollbar hidden min-h-10')
|
||||
->toContain('mb-4 w-full md:mb-0 md:hidden')
|
||||
->toContain('hidden flex-wrap items-center gap-2 md:flex')
|
||||
->not->toContain('order-first flex flex-wrap items-center gap-2 sm:order-last')
|
||||
->not->toContain('@selected');
|
||||
});
|
||||
|
||||
it('keeps configuration sidebars hidden until desktop breakpoint', function () {
|
||||
expect(file_get_contents(resource_path('views/livewire/project/database/configuration.blade.php')))
|
||||
->toContain('sub-menu-wrapper hidden md:flex');
|
||||
|
||||
expect(file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php')))
|
||||
->toContain('sub-menu-wrapper hidden md:flex');
|
||||
|
||||
expect(file_get_contents(resource_path('views/livewire/project/service/index.blade.php')))
|
||||
->toContain('sub-menu-wrapper hidden md:flex');
|
||||
|
||||
expect(file_get_contents(resource_path('views/components/service-database/sidebar.blade.php')))
|
||||
->toContain('sub-menu-wrapper hidden md:flex');
|
||||
});
|
||||
@@ -87,6 +87,35 @@ it('renders responsive checkbox classes on the application configuration page',
|
||||
|
||||
$response->assertSuccessful();
|
||||
$response->assertSee('Use a Build Server?');
|
||||
$response->assertSee('application-mobile-section');
|
||||
$response->assertSee('Application menu');
|
||||
$response->assertSee('<optgroup label="Application">', false);
|
||||
$response->assertSee('<optgroup label="Configuration">', false);
|
||||
$response->assertSee('<optgroup label="Links">', false);
|
||||
$response->assertSee('<optgroup label="Actions">', false);
|
||||
$response->assertSee('value="navigate|application|', false);
|
||||
$response->assertSee('value="navigate|configuration|', false);
|
||||
$response->assertSee('window.Livewire?.navigate ? window.Livewire.navigate(url) : window.location.href = url', false);
|
||||
$response->assertSee('value="action:force-deploy"', false);
|
||||
$response->assertSee('application-mobile-stop-trigger');
|
||||
$response->assertSee('application-mobile-deploy-trigger');
|
||||
$response->assertSee('application-mobile-restart-trigger');
|
||||
$response->assertSee('application-mobile-force-deploy-trigger');
|
||||
$response->assertSee('Confirm Application Deployment?');
|
||||
$response->assertSee('Confirm Application Restart?');
|
||||
$response->assertSee('Confirm Application Force Deployment?');
|
||||
$response->assertSee('sub-menu-wrapper hidden md:flex', false);
|
||||
$response->assertSee('scrollbar hidden min-h-10', false);
|
||||
$response->assertSee(route('project.application.deployment.index', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'environment_uuid' => $this->environment->uuid,
|
||||
'application_uuid' => $this->application->uuid,
|
||||
]));
|
||||
$response->assertSee(route('project.application.environment-variables', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'environment_uuid' => $this->environment->uuid,
|
||||
'application_uuid' => $this->application->uuid,
|
||||
]));
|
||||
$response->assertSee('form-control flex max-w-full flex-row items-center gap-4 py-1 pr-2', false);
|
||||
$response->assertSee('label flex w-full max-w-full min-w-0 items-center gap-4 px-0', false);
|
||||
$response->assertSee('flex min-w-0 grow gap-2 break-words', false);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
it('uses left aligned single color status badges in the server header', function () {
|
||||
$navbarView = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));
|
||||
$badgeView = file_get_contents(resource_path('views/components/status-badge.blade.php'));
|
||||
|
||||
expect($navbarView)
|
||||
->toContain('data-testid="server-status-summary"')
|
||||
->toContain('<x-status-badge')
|
||||
->toContain('label="Proxy"')
|
||||
->toContain('label="Sentinel"')
|
||||
->toContain('as="button"')
|
||||
->toContain("wire:click='checkProxyStatus'")
|
||||
->toContain('status="Refresh"')
|
||||
->toContain('border-transparent')
|
||||
->toContain('wire:loading.attr="disabled"')
|
||||
->not->toContain('status="Refreshing..."')
|
||||
->not->toContain('justify-between')
|
||||
->not->toContain('<x-status.stopped status="Proxy Exited" noLoading />')
|
||||
->not->toContain('<x-status.running status="Sentinel In Sync" noLoading />');
|
||||
|
||||
expect($badgeView)
|
||||
->not->toContain('text-neutral-500')
|
||||
->not->toContain('dark:text-neutral-400')
|
||||
->toContain('<button')
|
||||
->toContain("merge(['type' => 'button'])");
|
||||
});
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
it('renders application and database statuses as shared status badges', function (string $status, string $expectedText) {
|
||||
$resource = new class($status)
|
||||
{
|
||||
public function __construct(public string $status) {}
|
||||
};
|
||||
|
||||
$html = view('components.status.index', [
|
||||
'resource' => $resource,
|
||||
'showRefreshButton' => false,
|
||||
])->render();
|
||||
|
||||
expect($html)
|
||||
->toContain('inline-flex h-5 max-w-full items-center gap-1 rounded-sm border')
|
||||
->toContain($expectedText)
|
||||
->not->toContain('badge-success')
|
||||
->not->toContain('badge-warning')
|
||||
->not->toContain('badge-error');
|
||||
})->with([
|
||||
'running healthy' => ['running:healthy', 'Running (healthy)'],
|
||||
'starting unknown' => ['starting:unknown', 'Starting (unknown)'],
|
||||
'degraded unhealthy' => ['degraded:unhealthy', 'Degraded (unhealthy)'],
|
||||
'exited unhealthy' => ['exited:unhealthy', 'Exited'],
|
||||
]);
|
||||
|
||||
it('renders service container statuses as shared status badges', function () {
|
||||
$html = view('components.status.services', [
|
||||
'complexStatus' => 'running:healthy',
|
||||
'showRefreshButton' => false,
|
||||
])->render();
|
||||
|
||||
expect($html)
|
||||
->toContain('inline-flex h-5 max-w-full items-center gap-1 rounded-sm border')
|
||||
->toContain('Running (healthy)')
|
||||
->not->toContain('badge-success');
|
||||
});
|
||||
|
||||
it('uses a shared refresh badge for resource status refresh actions', function () {
|
||||
$statusIndex = file_get_contents(resource_path('views/components/status/index.blade.php'));
|
||||
$serviceStatus = file_get_contents(resource_path('views/components/status/services.blade.php'));
|
||||
|
||||
expect($statusIndex)
|
||||
->toContain('<x-status-badge as="button"')
|
||||
->toContain("wire:click='manualCheckStatus'")
|
||||
->toContain('wire:loading.attr="disabled"')
|
||||
->not->toContain('status="Refreshing..."')
|
||||
->toContain('wire:loading.attr="disabled"')
|
||||
->not->toContain('status="Refreshing..."')
|
||||
->not->toContain('<svg');
|
||||
|
||||
expect(file_get_contents(resource_path('views/livewire/project/service/resource-card.blade.php')))
|
||||
->toContain('<x-status-badge')
|
||||
->toContain('formatContainerStatus($resource->status)');
|
||||
|
||||
expect($serviceStatus)
|
||||
->toContain('<x-status-badge as="button"')
|
||||
->toContain("wire:click='manualCheckStatus'")
|
||||
->not->toContain('<svg');
|
||||
});
|
||||
|
||||
it('renders health warning helpers as badges instead of warning icons', function () {
|
||||
$html = view('components.status.running', [
|
||||
'status' => 'running:unknown',
|
||||
])->render();
|
||||
$runningStatus = file_get_contents(resource_path('views/components/status/running.blade.php'));
|
||||
|
||||
expect($html)
|
||||
->toContain('No health check')
|
||||
->toContain('inline-flex h-5 max-w-full items-center gap-1 rounded-sm border')
|
||||
->not->toContain('<svg');
|
||||
|
||||
expect($runningStatus)
|
||||
->toContain('<x-status-badge')
|
||||
->toContain('class="flex items-center gap-1"')
|
||||
->not->toContain('class="px-2"')
|
||||
->not->toContain('viewBox="0 0 256 256"');
|
||||
});
|
||||
|
||||
it('renders restart counts as warning badges', function () {
|
||||
$resource = new class
|
||||
{
|
||||
public string $status = 'running:unknown';
|
||||
|
||||
public int $restart_count = 9;
|
||||
|
||||
public ?int $max_restart_count = null;
|
||||
|
||||
public ?string $last_restart_type = null;
|
||||
|
||||
public $last_restart_at;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->last_restart_at = now();
|
||||
}
|
||||
};
|
||||
|
||||
$html = view('components.status.index', [
|
||||
'resource' => $resource,
|
||||
'showRefreshButton' => false,
|
||||
])->render();
|
||||
$statusIndex = file_get_contents(resource_path('views/components/status/index.blade.php'));
|
||||
|
||||
expect($html)
|
||||
->toContain('9x restarts')
|
||||
->toContain('border-yellow-300 bg-yellow-50')
|
||||
->not->toContain('(9x restarts)');
|
||||
|
||||
expect($statusIndex)
|
||||
->toContain('<x-status-badge')
|
||||
->toContain('restart_count')
|
||||
->not->toContain('class="text-xs dark:text-warning"');
|
||||
});
|
||||
Reference in New Issue
Block a user