debian-mirror-gitlab/spec/features/projects/jobs/user_browses_job_spec.rb

63 lines
1.9 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'User browses a job', :js do
2018-03-17 18:26:18 +05:30
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}")
2020-01-01 13:55:28 +05:30
expect(page).to have_css('.job-log')
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)"
2020-10-24 23:57:45 +05:30
accept_confirm { find('[data-testid="job-log-erase-link"]').click }
2018-03-17 18:26:18 +05:30
expect(page).to have_no_css('.artifacts')
expect(build).not_to have_trace
2019-09-04 21:01:54 +05:30
expect(build.artifacts_file.present?).to be_falsy
expect(build.artifacts_metadata.present?).to be_falsy
2018-03-17 18:26:18 +05:30
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
2019-12-21 20:55:43 +05:30
expect(page).to have_selector(
2021-01-03 14:25:43 +05:30
".build-job > a[title='test - failed - (unknown failure)']")
2018-05-09 12:01:36 +05:30
end
end
end
context 'when a failed job has been retried' do
2019-12-21 20:55:43 +05:30
let!(:build_retried) { create(:ci_build, :failed, :retried, :trace_artifact, pipeline: pipeline) }
2018-05-09 12:01:36 +05:30
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
2019-12-21 20:55:43 +05:30
expect(page).to have_selector(
2021-01-03 14:25:43 +05:30
".build-job > a[title='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