withoutVite(); InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate( ['id' => 0], [ 'id' => 0, 'is_dns_validation_enabled' => false, ] )); $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]); $this->server = Server::factory()->create([ 'team_id' => $this->team->id, 'ip' => '203.0.113.10', ]); $this->server->settings()->update([ 'is_reachable' => true, 'is_usable' => true, ]); $this->destination = StandaloneDocker::withoutEvents(function () { return StandaloneDocker::firstOrCreate( [ 'server_id' => $this->server->id, 'network' => 'coolify', ], [ 'uuid' => (string) Str::uuid(), 'name' => 'test-docker', ] ); }); $this->project = Project::factory()->create([ 'team_id' => $this->team->id, ]); $this->environment = Environment::factory()->create([ 'project_id' => $this->project->id, ]); $this->service = Service::factory()->create([ 'server_id' => $this->server->id, 'destination_id' => $this->destination->id, 'destination_type' => $this->destination->getMorphClass(), 'environment_id' => $this->environment->id, 'docker_compose_raw' => "services:\n web:\n image: nginx:alpine\n api:\n image: node:alpine\n", ]); $this->webApp = ServiceApplication::create([ 'uuid' => (string) Str::uuid(), 'service_id' => $this->service->id, 'name' => 'web', 'human_name' => 'Web', 'image' => 'nginx:alpine', 'fqdn' => null, ]); $this->apiApp = ServiceApplication::create([ 'uuid' => (string) Str::uuid(), 'service_id' => $this->service->id, 'name' => 'api', 'human_name' => 'API', 'image' => 'node:alpine', 'fqdn' => 'https://api.example.com', ]); }); it('groups configured domains with their service redirect and excludes services without domains', function () { $this->apiApp->update([ 'fqdn' => 'https://api.example.com,https://admin.example.com', ]); $html = Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])]) ->assertSuccessful() ->assertSee('API') ->assertSee('https://api.example.com') ->assertSee('https://admin.example.com') ->html(); expect($html) ->toContain("service-domain-group-{$this->apiApp->id}") ->toContain("id=\"service-domain-redirect-{$this->apiApp->id}-trigger\"") ->toContain("serviceRedirects.{$this->apiApp->id}") ->toContain('class="listbox-trigger"') ->toContain('application-settings-section-body is-flush mt-1 w-full scroll-mt-28 overflow-visible') ->not->toContain("