Files
coolify/tests/v4/Browser/TrafficAnalyticsTest.php
T
Andras BacsaiandClaude Opus 5.5 a79ee909c6 chore: remove unused components and markup-only tests
- Delete Blade components, component classes, Livewire components and
  views that nothing uses after the redesign.
- Delete tests that only compare Blade/CSS source text; keep the source
  checks for authorization gates, stable wire:key values and escaping.
- Update stale tests to the current UI and behaviour.
- Update DESIGN.md to the current navigation and layout.
- Add a lesson: test behaviour, not source markup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:18:16 +02:00

65 lines
2.2 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 on the application and global analytics pages.
$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 traffic analytics on a server to see request analytics here.')
->screenshot(filename: 'global-analytics-disabled-empty-state');
});
it('dismisses the global analytics enable prompt', function () {
loginAndSkipBoarding();
$page = visit('/analytics');
$page->assertVisible('[title="Dismiss"]')
->assertSee('Set up on localhost');
expect($page->attribute('Set up on localhost', 'href'))
->toContain('/server/'.$this->stack['server']->uuid.'/analytics');
$page->click('[title="Dismiss"]')
->assertMissing('[title="Dismiss"]')
->refresh()
->assertSee('Traffic analytics is not enabled')
->assertMissing('[title="Dismiss"]')
->screenshot(filename: 'global-analytics-prompt-dismissed');
});