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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.8 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
2021-12-11 22:18:48 +05:30
stub_feature_flags(bootstrap_confirmation_modals: false)
2018-03-17 18:26:18 +05:30
sign_in(user)
end
2018-12-05 23:21:45 +05:30
it 'erases the job log', :js do
2022-05-07 20:08:51 +05:30
visit(project_job_path(project, build))
2018-12-05 23:21:45 +05:30
wait_for_requests
2021-11-11 11:23:49 +05:30
expect(page).to have_content("Job #{build.name}")
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
2021-12-11 22:18:48 +05:30
context 'with unarchived trace artifact' do
let!(:build) { create(:ci_build, :success, :unarchived_trace_artifact, :coverage, pipeline: pipeline) }
it 'shows no trace message', :js do
2022-05-07 20:08:51 +05:30
visit(project_job_path(project, build))
2021-12-11 22:18:48 +05:30
wait_for_requests
expect(page).to have_content('This job does not have a trace.')
end
end
context 'with a failed job and live trace' do
let!(:build) { create(:ci_build, :failed, :trace_live, pipeline: pipeline) }
2018-05-09 12:01:36 +05:30
it 'displays the failure reason' do
2022-05-07 20:08:51 +05:30
visit(project_job_path(project, build))
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
2021-12-11 22:18:48 +05:30
context 'with unarchived trace artifact' do
let!(:artifact) { create(:ci_job_artifact, :unarchived_trace_artifact, job: build) }
it 'displays the failure reason from the live trace' do
2022-05-07 20:08:51 +05:30
visit(project_job_path(project, build))
2021-12-11 22:18:48 +05:30
wait_for_all_requests
within('.builds-container') do
expect(page).to have_selector(
".build-job > a[title='test - failed - (unknown failure)']")
end
end
end
2018-05-09 12:01:36 +05:30
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
2022-05-07 20:08:51 +05:30
visit(project_job_path(project, build))
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