mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
- ServerSetting: default is_traffic_analytics_enabled to false on the model, so a new instance does not show null before a refresh. - Update navbar, mobile menu, and proxy button tests to the current redesigned UI (split action menus, settings rail, neutral icons). - Traffic nudge test: set server_role to mark a build server, the same as the product code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
|
|
use App\Enums\ServerRole;
|
|
use App\Livewire\Analytics;
|
|
use App\Livewire\Dashboard\TrafficAnalytics as DashboardTrafficAnalytics;
|
|
use App\Models\PrivateKey;
|
|
use App\Models\Server;
|
|
use App\Models\Team;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
Server::flushIdentityMap();
|
|
$this->team = Team::factory()->create();
|
|
$this->user = User::factory()->create();
|
|
$this->team->members()->attach($this->user->id, ['role' => 'owner']);
|
|
$this->actingAs($this->user);
|
|
session(['currentTeam' => $this->team]);
|
|
$this->privateKey = PrivateKey::factory()->create(['team_id' => $this->team->id]);
|
|
});
|
|
|
|
function disabledServer(): Server
|
|
{
|
|
$server = Server::factory()->create([
|
|
'team_id' => test()->team->id,
|
|
'private_key_id' => test()->privateKey->id,
|
|
]);
|
|
$server->settings->is_traffic_analytics_enabled = false;
|
|
$server->settings->save();
|
|
|
|
return $server;
|
|
}
|
|
|
|
it('does not show a traffic nudge on the dashboard', function () {
|
|
disabledServer();
|
|
|
|
loadLazy(Livewire::test(DashboardTrafficAnalytics::class))
|
|
->assertOk()
|
|
->assertDontSee('can start collecting traffic analytics');
|
|
});
|
|
|
|
it('shows the analytics-page nudge when an eligible server has analytics disabled', function () {
|
|
disabledServer();
|
|
|
|
loadLazy(Livewire::test(Analytics::class))
|
|
->assertOk()
|
|
->assertSee('can start collecting traffic analytics');
|
|
});
|
|
|
|
it('does not count swarm or build servers in the analytics-page nudge', function () {
|
|
$swarm = disabledServer();
|
|
$swarm->settings->is_swarm_manager = true;
|
|
$swarm->settings->save();
|
|
|
|
$build = disabledServer();
|
|
$build->settings->server_role = ServerRole::BUILD;
|
|
$build->settings->is_build_server = true;
|
|
$build->settings->save();
|
|
|
|
loadLazy(Livewire::test(Analytics::class))
|
|
->assertOk()
|
|
->assertDontSee('can start collecting traffic analytics');
|
|
});
|