Files
coolify/tests/Feature/DashboardViewModeTest.php
T
Andras Bacsai fa1895c99a feat(dashboard): add canvas view with active deployment overlay
Add a /dashboard/canvas page that renders every team server with its
resources and their running or queued deployments, backed by a new
ServerCanvasController::dashboard endpoint and a per-server usage
endpoint for zone headers. The dashboard remembers the list/canvas
choice and each section (projects, servers) its own table/grid view.

- Show Deploying/Queued pills on canvas cards and a foldable recent
  deployments panel; add shared CanvasControls component
- Allow backup downloads from the server host via the S3 download
  storage (PrepareFileDownloadJob accepts a null container)
- Extract backup toggle/run actions into ManagesDatabaseBackup and
  surface them in backup execution headers; merge S3 and retention
  sections into the general backup settings
- Move deployments indicator to the top bar and add a main nav
  resource menu with submenus; simplify breadcrumbs and settings
  layouts
- Add shared variables overview canvas and scheduled task modals
- Add feature tests for dashboard canvas, view modes, navbar
  submenus, backup S3 downloads and scheduled task modals
2026-10-14 23:55:28 +02:00

45 lines
1.5 KiB
PHP

<?php
use App\Livewire\Dashboard;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Queue;
use Livewire\Livewire;
uses(RefreshDatabase::class);
beforeEach(function () {
Queue::fake();
InstanceSettings::unguarded(fn () => InstanceSettings::query()->create(['id' => 0]));
$this->user = User::factory()->create();
$this->team = Team::factory()->create();
$this->user->teams()->attach($this->team, ['role' => 'owner']);
$this->actingAs($this->user);
session(['currentTeam' => $this->team]);
});
it('shows the projects and servers sections as tables by default', function () {
Livewire::test(Dashboard::class)
->assertSee("viewMode: 'table'", false)
->assertDontSee("viewMode: 'grid'", false);
});
it('remembers the view of each dashboard section on its own', function () {
Livewire::test(Dashboard::class)->call('saveListView', 'dashboard_projects', 'grid');
expect(Cookie::queued("coolify_{$this->user->id}_dashboard_projects_view")?->getValue())->toBe('grid')
->and(Cookie::queued("coolify_{$this->user->id}_dashboard_servers_view"))->toBeNull();
$this->withCookie("coolify_{$this->user->id}_dashboard_projects_view", 'grid')
->get(route('dashboard'))
->assertOk()
->assertSee("viewMode: 'grid'", false)
->assertSee("viewMode: 'table'", false);
});