2017-09-11 01:44:43 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User browses a job', :js do
|
|
|
|
let(:user) { create(:user) }
|
2018-04-04 14:28:53 -04:00
|
|
|
let(:user_access_level) { :developer }
|
2018-04-03 14:17:26 -04:00
|
|
|
let(:project) { create(:project, :repository, namespace: user.namespace) }
|
|
|
|
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') }
|
|
|
|
let!(:build) { create(:ci_build, :success, :trace_artifact, :coverage, pipeline: pipeline) }
|
2017-09-11 01:44:43 -04:00
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-09-11 01:44:43 -04:00
|
|
|
project.enable_ci
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_job_path(project, build))
|
|
|
|
end
|
|
|
|
|
2018-10-03 11:29:07 -04:00
|
|
|
it 'erases the job log', :js do
|
|
|
|
wait_for_requests
|
|
|
|
|
2017-09-11 01:44:43 -04:00
|
|
|
expect(page).to have_content("Job ##{build.id}")
|
2018-10-17 06:34:19 -04:00
|
|
|
expect(page).to have_css('.js-build-trace')
|
2017-09-11 01:44:43 -04:00
|
|
|
|
2018-04-04 14:28:53 -04:00
|
|
|
# scroll to the top of the page first
|
|
|
|
execute_script "window.scrollTo(0,0)"
|
|
|
|
accept_confirm { find('.js-erase-link').click }
|
2017-09-11 01:44:43 -04:00
|
|
|
|
2017-10-31 11:01:32 -04:00
|
|
|
expect(page).to have_no_css('.artifacts')
|
2017-09-11 01:44:43 -04:00
|
|
|
expect(build).not_to have_trace
|
|
|
|
expect(build.artifacts_file.exists?).to be_falsy
|
|
|
|
expect(build.artifacts_metadata.exists?).to be_falsy
|
|
|
|
|
2018-10-03 11:29:07 -04:00
|
|
|
expect(page).to have_content('Job has been erased')
|
2017-09-11 01:44:43 -04:00
|
|
|
end
|
2018-04-05 17:04:42 -04:00
|
|
|
|
|
|
|
context 'with a failed job' do
|
2018-04-06 10:47:50 -04:00
|
|
|
let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) }
|
2018-04-05 17:04:42 -04:00
|
|
|
|
|
|
|
it 'displays the failure reason' do
|
2018-10-03 10:13:20 -04:00
|
|
|
wait_for_all_requests
|
2018-04-05 17:04:42 -04:00
|
|
|
within('.builds-container') do
|
|
|
|
build_link = first('.build-job > a')
|
2018-10-03 10:13:20 -04:00
|
|
|
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)')
|
2018-04-05 17:04:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a failed job has been retried' do
|
2018-04-06 10:47:50 -04:00
|
|
|
let!(:build) { create(:ci_build, :failed, :retried, :trace_artifact, pipeline: pipeline) }
|
2018-04-05 17:04:42 -04:00
|
|
|
|
|
|
|
it 'displays the failure reason and retried label' do
|
2018-10-03 10:13:20 -04:00
|
|
|
wait_for_all_requests
|
2018-04-05 17:04:42 -04:00
|
|
|
within('.builds-container') do
|
|
|
|
build_link = first('.build-job > a')
|
2018-10-03 10:13:20 -04:00
|
|
|
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure) (retried)')
|
2018-04-05 17:04:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-09-11 01:44:43 -04:00
|
|
|
end
|