Commit b9d868e3 authored by Marin Jankovski's avatar Marin Jankovski

Merge branch 'fix/gb/fix-pipeline-statuses-illustrations' into 'master'

Fix empty state for build that does not have a trace

Closes #45204

See merge request gitlab-org/gitlab-ce!18278
parents 85b873e9 11bfc4b2
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
- else - else
Job has been erased #{time_ago_with_tooltip(@build.erased_at)} Job has been erased #{time_ago_with_tooltip(@build.erased_at)}
- if @build.has_trace? - if @build.running? || @build.has_trace?
.build-trace-container.prepend-top-default .build-trace-container.prepend-top-default
.top-bar.js-top-bar .top-bar.js-top-bar
.js-truncated-info.truncated-info.hidden-xs.pull-left.hidden< .js-truncated-info.truncated-info.hidden-xs.pull-left.hidden<
......
...@@ -3,6 +3,14 @@ module Gitlab ...@@ -3,6 +3,14 @@ module Gitlab
module Status module Status
module Build module Build
module Common module Common
def illustration
{
image: 'illustrations/skipped-job_empty.svg',
size: 'svg-430',
title: _('This job does not have a trace.')
}
end
def has_details? def has_details?
can?(user, :read_build, subject) can?(user, :read_build, subject)
end end
......
...@@ -464,6 +464,17 @@ feature 'Jobs' do ...@@ -464,6 +464,17 @@ feature 'Jobs' do
expect(page).to have_content('This job has been skipped') expect(page).to have_content('This job has been skipped')
end end
end end
context 'when job is failed but has no trace' do
let(:job) { create(:ci_build, :failed, pipeline: pipeline) }
it 'renders empty state' do
visit project_job_path(project, job)
expect(job).not_to have_trace
expect(page).to have_content('This job does not have a trace.')
end
end
end end
describe "POST /:project/jobs/:id/cancel", :js do describe "POST /:project/jobs/:id/cancel", :js do
......
...@@ -38,4 +38,10 @@ describe Gitlab::Ci::Status::Build::Common do ...@@ -38,4 +38,10 @@ describe Gitlab::Ci::Status::Build::Common do
expect(subject.details_path).to include "jobs/#{build.id}" expect(subject.details_path).to include "jobs/#{build.id}"
end end
end end
describe '#illustration' do
it 'provides a fallback empty state illustration' do
expect(subject.illustration).not_to be_empty
end
end
end end
...@@ -75,7 +75,8 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -75,7 +75,8 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'matches correct extended statuses' do it 'matches correct extended statuses' do
expect(factory.extended_statuses) expect(factory.extended_statuses)
.to eq [Gitlab::Ci::Status::Build::Retryable, Gitlab::Ci::Status::Build::Failed] .to eq [Gitlab::Ci::Status::Build::Retryable,
Gitlab::Ci::Status::Build::Failed]
end end
it 'fabricates a failed build status' do it 'fabricates a failed build status' do
...@@ -94,7 +95,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -94,7 +95,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end end
context 'when build is allowed to fail' do context 'when build is allowed to fail' do
let(:build) { create(:ci_build, :failed, :allowed_to_fail) } let(:build) { create(:ci_build, :failed, :allowed_to_fail, :trace_artifact) }
it 'matches correct core status' do it 'matches correct core status' do
expect(factory.core_status).to be_a Gitlab::Ci::Status::Failed expect(factory.core_status).to be_a Gitlab::Ci::Status::Failed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment