Files
coolify/tests/Feature/BreadcrumbsVisibilityTest.php
Andras BacsaiandClaude Opus 5.5 649e90ab3b fix(ui): show resource menus in the sidebar and mobile drawer, not in the page
The main sidebar shows the resource menu from lg, where it appears, and the
mobile drawer shows it too, so the page grid menu is gone. The drawer opens
on the menu of the current page again after it closes. Below xl, the resource
actions are a compact button in line with the title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:58:42 +02:00

69 lines
2.7 KiB
PHP

<?php
use App\Models\Application;
use App\Models\Environment;
use App\Models\InstanceSettings;
use App\Models\Project;
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\Team;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->user = User::factory()->create();
$this->team = Team::factory()->create();
$this->team->members()->attach($this->user->id, ['role' => 'owner']);
InstanceSettings::unguarded(function () {
InstanceSettings::query()->create([
'id' => 0,
'is_registration_enabled' => true,
]);
});
$this->actingAs($this->user);
session(['currentTeam' => $this->team]);
$this->server = Server::factory()->create(['team_id' => $this->team->id]);
$this->destination = StandaloneDocker::query()->where('server_id', $this->server->id)->firstOrFail();
$this->project = Project::factory()->create(['team_id' => $this->team->id]);
$this->environment = Environment::factory()->create(['project_id' => $this->project->id]);
$this->application = Application::factory()->create([
'environment_id' => $this->environment->id,
'destination_id' => $this->destination->id,
'destination_type' => $this->destination->getMorphClass(),
'name' => 'Pure Dockerfile Example',
'status' => 'running',
]);
});
it('hides the breadcrumb trail on mobile while keeping the current status visible', function () {
$response = $this->get(route('project.application.configuration', [
'project_uuid' => $this->project->uuid,
'environment_uuid' => $this->environment->uuid,
'application_uuid' => $this->application->uuid,
]));
$response->assertSuccessful();
// The resource breadcrumb lives in the top bar (project / environment / resource switchers).
$response->assertSee('title="Switch project"', false);
$response->assertSee('title="Switch environment"', false);
$response->assertSee('title="Switch resource"', false);
// Desktop resource actions dock into the top bar; the slot is hidden below xl.
$response->assertSee('<div id="resource-action-hud-slot" x-ref="resourceActions" class="hidden shrink-0 items-center xl:flex"></div>', false);
// Below xl, the heading keeps the resource name, current status, and a split action in one row.
expect(preg_match(
'/<div class="mb-3 flex w-full min-w-0 items-start gap-3 xl:hidden">.*?<h1[^>]*>\s*Pure Dockerfile Example\s*<\/h1>.*?Application status.*?id="application-mobile-actions"/s',
$response->getContent()
))->toBe(1);
$response->assertSee('Running');
expect($response->getContent())->not->toContain('hidden pt-2 pb-10 md:flex');
});