2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User browses a job', :js do
|
|
|
|
let(:user) { create(:user) }
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:user_access_level) { :developer }
|
|
|
|
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) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
project.enable_ci
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_job_path(project, build))
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'erases the job log', :js do
|
|
|
|
wait_for_requests
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content("Job ##{build.id}")
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(page).to have_css('.js-build-trace')
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
# scroll to the top of the page first
|
|
|
|
execute_script "window.scrollTo(0,0)"
|
|
|
|
accept_confirm { find('.js-erase-link').click }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(page).to have_no_css('.artifacts')
|
|
|
|
expect(build).not_to have_trace
|
|
|
|
expect(build.artifacts_file.exists?).to be_falsy
|
|
|
|
expect(build.artifacts_metadata.exists?).to be_falsy
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).to have_content('Job has been erased')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
context 'with a failed job' do
|
|
|
|
let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) }
|
|
|
|
|
|
|
|
it 'displays the failure reason' do
|
2018-12-05 23:21:45 +05:30
|
|
|
wait_for_all_requests
|
2018-05-09 12:01:36 +05:30
|
|
|
within('.builds-container') do
|
|
|
|
build_link = first('.build-job > a')
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a failed job has been retried' do
|
|
|
|
let!(:build) { create(:ci_build, :failed, :retried, :trace_artifact, pipeline: pipeline) }
|
|
|
|
|
|
|
|
it 'displays the failure reason and retried label' do
|
2018-12-05 23:21:45 +05:30
|
|
|
wait_for_all_requests
|
2018-05-09 12:01:36 +05:30
|
|
|
within('.builds-container') do
|
|
|
|
build_link = first('.build-job > a')
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure) (retried)')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|