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.

113 lines
3.4 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'
2023-03-04 22:38:38 +05:30
RSpec.describe 'User browses a job', :js, feature_category: :projects do
2022-07-23 23:45:48 +05:30
include Spec::Support::Helpers::ModalHelpers
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)
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)"
2022-07-23 23:45:48 +05:30
accept_gl_confirm(button_text: 'Erase job log') do
find('[data-testid="job-log-erase-link"]').click
end
wait_for_requests
2018-03-17 18:26:18 +05:30
expect(page).to have_no_css('.artifacts')
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
2022-08-13 15:12:31 +05:30
context 'job log search' do
before do
visit(project_job_path(project, build))
wait_for_all_requests
end
it 'searches for supplied substring' do
find('[data-testid="job-log-search-box"] input').set('GroupsHelper')
find('[data-testid="search-button"]').click
expect(page).to have_content('26 results found for GroupsHelper')
end
it 'shows no results for supplied substring' do
find('[data-testid="job-log-search-box"] input').set('YouWontFindMe')
find('[data-testid="search-button"]').click
expect(page).to have_content('No search results found')
end
end
2018-03-17 18:26:18 +05:30
end