diff --git a/resources/views/livewire/project/service/heading.blade.php b/resources/views/livewire/project/service/heading.blade.php
index f38ce076fd..2189fd9e42 100644
--- a/resources/views/livewire/project/service/heading.blade.php
+++ b/resources/views/livewire/project/service/heading.blade.php
@@ -32,7 +32,8 @@
{{ $service->name }}
-
+
@if ($isDeploymentProgress)
diff --git a/tests/Feature/ServiceHeadingStatusTest.php b/tests/Feature/ServiceHeadingStatusTest.php
new file mode 100644
index 0000000000..9cd0488e2d
--- /dev/null
+++ b/tests/Feature/ServiceHeadingStatusTest.php
@@ -0,0 +1,83 @@
+ InstanceSettings::updateOrCreate(['id' => 0], ['id' => 0]));
+
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->user->teams()->attach($this->team, ['role' => 'admin']);
+ $this->actingAs($this->user);
+ session(['currentTeam' => $this->team]);
+
+ $server = Server::factory()->create(['team_id' => $this->team->id]);
+ $destination = StandaloneDocker::where('server_id', $server->id)->firstOrFail();
+ $project = Project::create([
+ 'uuid' => (string) Str::uuid(),
+ 'name' => 'Status Project',
+ 'team_id' => $this->team->id,
+ ]);
+ $environment = $project->environments()->first();
+
+ $this->service = Service::create([
+ 'uuid' => (string) Str::uuid(),
+ 'name' => 'Status Service',
+ 'environment_id' => $environment->id,
+ 'server_id' => $server->id,
+ 'destination_id' => $destination->id,
+ 'destination_type' => $destination->getMorphClass(),
+ 'docker_compose_raw' => 'services: {}',
+ ]);
+
+ $this->runningApp = ServiceApplication::create(['name' => 'web', 'service_id' => $this->service->id]);
+ $this->runningApp->forceFill(['status' => 'running:healthy'])->save();
+ $this->exitedApp = ServiceApplication::create(['name' => 'worker', 'service_id' => $this->service->id]);
+ $this->exitedApp->forceFill(['status' => 'exited'])->save();
+
+ $this->parameters = [
+ 'project_uuid' => $project->uuid,
+ 'environment_uuid' => $environment->uuid,
+ 'service_uuid' => $this->service->uuid,
+ ];
+});
+
+test('the heading shows the status of the selected service resource', function () {
+ $service = $this->service->fresh();
+ expect($service->status)->not->toBe($this->exitedApp->status);
+
+ Livewire::test(ServiceHeading::class, [
+ 'service' => $service,
+ 'parameters' => $this->parameters + ['stack_service_uuid' => $this->exitedApp->uuid],
+ 'query' => [],
+ ])
+ ->assertSee('Resource status')
+ ->assertDontSee('Service status')
+ ->assertSeeInOrder(['Resource status', 'Container', 'Exited', 'Healthcheck'])
+ ->assertDontSee('Degraded');
+});
+
+test('the heading shows the service status when no resource is selected', function () {
+ Livewire::test(ServiceHeading::class, [
+ 'service' => $this->service->fresh(),
+ 'parameters' => $this->parameters,
+ 'query' => [],
+ ])
+ ->assertSee('Service status')
+ ->assertDontSee('Resource status')
+ ->assertSeeInOrder(['Service status', 'Containers', 'Healthcheck'])
+ ->assertSee('Degraded');
+});