Files
coolify/tests/v4/Browser/TrafficAnalyticsTest.php
T
Aditya Tripathi a5cfa7c238 feat(traffic): add global analytics page with status time series
Replace the server-scoped Analytics Livewire component with an
app-wide one that filters by server/application and supports live
refresh. Add a per-bucket status-class time series endpoint/data
class for a stacked-area chart, falling back to the donut when the
Sentinel build doesn't support it. Decorate top-path rows with their
owning domain, expand breakdown dimensions to agent/ip/useragent, and
raise path/breakdown result limits. Capture X-Forwarded-For,
User-Agent, and Referer headers in traefik access logs (now enabled
in dev too) so IP, browser, and referrer breakdowns work. Add
flag-image and referer-host helpers for geo/referrer rendering.
2026-08-12 08:50:58 +00:00

55 lines
2.0 KiB
PHP

<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
// seedBrowserResourceStack() creates a "localhost" server with traffic
// analytics disabled by default (is_traffic_analytics_enabled defaults
// to false), so these smoke tests exercise the deterministic, Sentinel-free
// "disabled" empty-state path across the three analytics surfaces.
$this->stack = seedBrowserResourceStack();
$this->application = createBrowserApplication($this->stack, [
'uuid' => 'app-traffic-analytics',
'name' => 'Traffic App',
]);
});
it('shows the disabled empty state on the application analytics tab', function () {
loginAndSkipBoarding();
$url = applicationConfigurationUrl(
$this->stack['project'],
$this->stack['environment'],
$this->application
);
$page = visit("{$url}/analytics");
$page->assertSee('Traffic App')
->assertSee('Traffic analytics is not enabled')
->assertSee('Enable Sentinel traffic analytics for this server to start collecting request analytics.')
->screenshot(filename: 'application-analytics-disabled-empty-state');
});
it('shows the disabled empty state on the global analytics page', function () {
loginAndSkipBoarding();
$page = visit('/analytics');
$page->assertSee('Analytics')
->assertSee('Traffic analytics is not enabled')
->assertSee('Enable Sentinel traffic analytics on a server to see request analytics here.')
->screenshot(filename: 'global-analytics-disabled-empty-state');
});
it('shows the disabled empty state on the dashboard traffic widget', function () {
$page = loginAndSkipBoarding();
$page->assertSee('Traffic analytics')
->assertSee('Traffic analytics is not enabled')
->assertSee('Enable Sentinel traffic analytics on a server to see a team-wide summary here.')
->screenshot(filename: 'dashboard-traffic-analytics-disabled-empty-state');
});