Commit 80a1bb1d authored by Mike Greiling's avatar Mike Greiling

Merge branch '52570-erased-block' into 'master'

Fix erased block not being rendered when job was erased

Closes #52570

See merge request gitlab-org/gitlab-ce!22294
parents e5ae0be4 dd0806d0
...@@ -87,8 +87,8 @@ ...@@ -87,8 +87,8 @@
/> />
<erased-block <erased-block
v-if="job.erased" v-if="job.erased_at"
class="js-job-erased" class="js-job-erased-block"
:user="job.erased_by" :user="job.erased_by"
:erased-at="job.erased_at" :erased-at="job.erased_at"
/> />
......
---
title: Fix erased block not being rendered when job was erased
merge_request: 22294
author:
type: fixed
...@@ -663,6 +663,19 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -663,6 +663,19 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
expect(page).to have_content('This job does not have a trace.') expect(page).to have_content('This job does not have a trace.')
end end
end end
context 'with erased job', :js do
let(:job) { create(:ci_build, :erased, pipeline: pipeline) }
it'renders erased job warning' do
visit project_job_path(project, job)
wait_for_requests
page.within('.js-job-erased-block') do
expect(page).to have_content('Job has been erased')
end
end
end
end end
describe "POST /:project/jobs/:id/cancel", :js do describe "POST /:project/jobs/:id/cancel", :js do
......
...@@ -223,7 +223,6 @@ describe('Job App ', () => { ...@@ -223,7 +223,6 @@ describe('Job App ', () => {
store.dispatch( store.dispatch(
'receiveJobSuccess', 'receiveJobSuccess',
Object.assign({}, job, { Object.assign({}, job, {
erased: true,
erased_by: { erased_by: {
username: 'root', username: 'root',
web_url: 'gitlab.com/root', web_url: 'gitlab.com/root',
...@@ -237,18 +236,18 @@ describe('Job App ', () => { ...@@ -237,18 +236,18 @@ describe('Job App ', () => {
store, store,
}); });
expect(vm.$el.querySelector('.js-job-erased')).not.toBeNull(); expect(vm.$el.querySelector('.js-job-erased-block')).not.toBeNull();
}); });
it('does not render erased block when `erased` is false', () => { it('does not render erased block when `erased` is false', () => {
store.dispatch('receiveJobSuccess', Object.assign({}, job, { erased: false })); store.dispatch('receiveJobSuccess', Object.assign({}, job, { erased_at: null }));
vm = mountComponentWithStore(Component, { vm = mountComponentWithStore(Component, {
props, props,
store, store,
}); });
expect(vm.$el.querySelector('.js-job-erased')).toBeNull(); expect(vm.$el.querySelector('.js-job-erased-block')).toBeNull();
}); });
}); });
......
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