2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'Pipeline', :js do
|
|
|
|
let(:project) { create(:project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:role) { :developer }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2018-10-15 14:42:47 +05:30
|
|
|
project.add_role(user, role)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
shared_context 'pipeline builds' do
|
|
|
|
let!(:build_passed) do
|
|
|
|
create(:ci_build, :success,
|
|
|
|
pipeline: pipeline, stage: 'build', name: 'build')
|
|
|
|
end
|
|
|
|
|
|
|
|
let!(:build_failed) do
|
|
|
|
create(:ci_build, :failed,
|
|
|
|
pipeline: pipeline, stage: 'test', name: 'test', commands: 'test')
|
|
|
|
end
|
|
|
|
|
|
|
|
let!(:build_running) do
|
|
|
|
create(:ci_build, :running,
|
|
|
|
pipeline: pipeline, stage: 'deploy', name: 'deploy')
|
|
|
|
end
|
|
|
|
|
|
|
|
let!(:build_manual) do
|
|
|
|
create(:ci_build, :manual,
|
|
|
|
pipeline: pipeline, stage: 'deploy', name: 'manual-build')
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
let!(:build_scheduled) do
|
|
|
|
create(:ci_build, :scheduled,
|
|
|
|
pipeline: pipeline, stage: 'deploy', name: 'delayed-job')
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:build_external) do
|
|
|
|
create(:generic_commit_status, status: 'success',
|
|
|
|
pipeline: pipeline,
|
|
|
|
name: 'jenkins',
|
|
|
|
stage: 'external',
|
|
|
|
target_url: 'http://gitlab.com/status')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project/pipelines/:id' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it 'shows the pipeline graph' do
|
|
|
|
expect(page).to have_selector('.pipeline-visualization')
|
|
|
|
expect(page).to have_content('Build')
|
|
|
|
expect(page).to have_content('Test')
|
|
|
|
expect(page).to have_content('Deploy')
|
|
|
|
expect(page).to have_content('Retry')
|
|
|
|
expect(page).to have_content('Cancel running')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows Pipeline tab pane as active' do
|
|
|
|
expect(page).to have_css('#js-tab-pipeline.active')
|
|
|
|
end
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
it 'shows link to the pipeline ref' do
|
|
|
|
expect(page).to have_link(pipeline.ref)
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
it_behaves_like 'showing user status' do
|
|
|
|
let(:user_with_status) { pipeline.user }
|
|
|
|
|
|
|
|
subject { visit project_pipeline_path(project, pipeline) }
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'pipeline graph' do
|
|
|
|
context 'when pipeline has running builds' do
|
|
|
|
it 'shows a running icon and a cancel action for the running build' do
|
|
|
|
page.within('#ci-badge-deploy') do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-running')
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_selector('.js-icon-cancel')
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('deploy')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
it 'cancels the running build and shows retry button' do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('#ci-badge-deploy .ci-action-icon-container').click
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
page.within('#ci-badge-deploy') do
|
|
|
|
expect(page).to have_css('.js-icon-retry')
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline has successful builds' do
|
|
|
|
it 'shows the success icon and a retry action for the successful build' do
|
|
|
|
page.within('#ci-badge-build') do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-success')
|
|
|
|
expect(page).to have_content('build')
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
page.within('#ci-badge-build .ci-action-icon-container.js-icon-retry') do
|
|
|
|
expect(page).to have_selector('svg')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be possible to retry the success job' do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('#ci-badge-build .ci-action-icon-container').click
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content('Retry job')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
context 'when pipeline has a delayed job' do
|
|
|
|
it 'shows the scheduled icon and an unschedule action for the delayed job' do
|
|
|
|
page.within('#ci-badge-delayed-job') do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-scheduled')
|
|
|
|
expect(page).to have_content('delayed-job')
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within('#ci-badge-delayed-job .ci-action-icon-container.js-icon-time-out') do
|
|
|
|
expect(page).to have_selector('svg')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'unschedules the delayed job and shows play button as a manual job' do
|
|
|
|
find('#ci-badge-delayed-job .ci-action-icon-container').click
|
|
|
|
|
|
|
|
page.within('#ci-badge-delayed-job') do
|
|
|
|
expect(page).to have_css('.js-icon-play')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'when pipeline has failed builds' do
|
|
|
|
it 'shows the failed icon and a retry action for the failed build' do
|
|
|
|
page.within('#ci-badge-test') do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-failed')
|
|
|
|
expect(page).to have_content('test')
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
page.within('#ci-badge-test .ci-action-icon-container.js-icon-retry') do
|
|
|
|
expect(page).to have_selector('svg')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be possible to retry the failed build' do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('#ci-badge-test .ci-action-icon-container').click
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content('Retry job')
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
it 'should include the failure reason' do
|
|
|
|
page.within('#ci-badge-test') do
|
|
|
|
build_link = page.find('.js-pipeline-graph-job-link')
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline has manual jobs' do
|
|
|
|
it 'shows the skipped icon and a play action for the manual build' do
|
|
|
|
page.within('#ci-badge-manual-build') do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-manual')
|
|
|
|
expect(page).to have_content('manual')
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
page.within('#ci-badge-manual-build .ci-action-icon-container.js-icon-play') do
|
|
|
|
expect(page).to have_selector('svg')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be possible to play the manual job' do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('#ci-badge-manual-build .ci-action-icon-container').click
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content('Play job')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline has external job' do
|
|
|
|
it 'shows the success icon and the generic comit status build' do
|
|
|
|
expect(page).to have_selector('.js-ci-status-icon-success')
|
|
|
|
expect(page).to have_content('jenkins')
|
|
|
|
expect(page).to have_link('jenkins', href: 'http://gitlab.com/status')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'page tabs' do
|
2018-10-15 14:42:47 +05:30
|
|
|
it 'shows Pipeline, Jobs and Failed Jobs tabs with link' do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_link('Pipeline')
|
|
|
|
expect(page).to have_link('Jobs')
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_link('Failed Jobs')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows counter in Jobs tab' do
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find('.js-builds-counter').text).to eq(pipeline.total_size.to_s)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows Pipeline tab as active' do
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(page).to have_css('.js-pipeline-tab-link .active')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
context 'without permission to access builds' do
|
|
|
|
let(:project) { create(:project, :public, :repository, public_builds: false) }
|
|
|
|
let(:role) { :guest }
|
|
|
|
|
|
|
|
it 'does not show failed jobs tab pane' do
|
|
|
|
expect(page).to have_link('Pipeline')
|
|
|
|
expect(page).not_to have_content('Failed Jobs')
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'retrying jobs' do
|
|
|
|
it { expect(page).not_to have_content('retried') }
|
|
|
|
|
|
|
|
context 'when retrying' do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('.js-retry-button').click
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { expect(page).not_to have_content('Retry') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'canceling jobs' do
|
|
|
|
it { expect(page).not_to have_selector('.ci-canceled') }
|
|
|
|
|
|
|
|
context 'when canceling' do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
|
|
|
click_on 'Cancel running'
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { expect(page).not_to have_content('Cancel running') }
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
context 'when pipeline ref does not exist in repository anymore' do
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_empty_pipeline, project: project,
|
|
|
|
ref: 'non-existent',
|
|
|
|
sha: project.commit.id,
|
|
|
|
user: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not render link to the pipeline ref' do
|
|
|
|
expect(page).not_to have_link(pipeline.ref)
|
|
|
|
expect(page).to have_content(pipeline.ref)
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when user does not have access to read jobs' do
|
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project/pipelines/:id' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the pipeline graph' do
|
|
|
|
expect(page).to have_selector('.pipeline-visualization')
|
|
|
|
expect(page).to have_content('Build')
|
|
|
|
expect(page).to have_content('Test')
|
|
|
|
expect(page).to have_content('Deploy')
|
|
|
|
expect(page).to have_content('Retry')
|
|
|
|
expect(page).to have_content('Cancel running')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not link to job' do
|
|
|
|
expect(page).not_to have_selector('.js-pipeline-graph-job-link')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'GET /:project/pipelines/:id/builds' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit builds_project_pipeline_path(project, pipeline)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a list of jobs' do
|
|
|
|
expect(page).to have_content('Test')
|
|
|
|
expect(page).to have_content(build_passed.id)
|
|
|
|
expect(page).to have_content('Deploy')
|
|
|
|
expect(page).to have_content(build_failed.id)
|
|
|
|
expect(page).to have_content(build_running.id)
|
|
|
|
expect(page).to have_content(build_external.id)
|
|
|
|
expect(page).to have_content('Retry')
|
|
|
|
expect(page).to have_content('Cancel running')
|
|
|
|
expect(page).to have_link('Play')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows jobs tab pane as active' do
|
|
|
|
expect(page).to have_css('#js-tab-builds.active')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'page tabs' do
|
|
|
|
it 'shows Pipeline and Jobs tabs with link' do
|
|
|
|
expect(page).to have_link('Pipeline')
|
|
|
|
expect(page).to have_link('Jobs')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows counter in Jobs tab' do
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find('.js-builds-counter').text).to eq(pipeline.total_size.to_s)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows Jobs tab as active' do
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(page).to have_css('li.js-builds-tab-link .active')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'retrying jobs' do
|
|
|
|
it { expect(page).not_to have_content('retried') }
|
|
|
|
|
|
|
|
context 'when retrying' do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
find('.js-retry-button').click
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { expect(page).not_to have_content('Retry') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'canceling jobs' do
|
|
|
|
it { expect(page).not_to have_selector('.ci-canceled') }
|
|
|
|
|
|
|
|
context 'when canceling' do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
|
|
|
click_on 'Cancel running'
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it { expect(page).not_to have_content('Cancel running') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'playing manual job' do
|
|
|
|
before do
|
|
|
|
within '.pipeline-holder' do
|
|
|
|
click_link('Play')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(build_manual.reload).to be_pending }
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
context 'when user unschedules a delayed job' do
|
|
|
|
before do
|
|
|
|
within '.pipeline-holder' do
|
|
|
|
click_link('Unschedule')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'unschedules the delayed job and shows play button as a manual job' do
|
|
|
|
expect(page).to have_content('Trigger this manual action')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
context 'failed jobs' do
|
|
|
|
it 'displays a tooltip with the failure reason' do
|
|
|
|
page.within('.ci-table') do
|
|
|
|
failed_job_link = page.find('.ci-failed')
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(failed_job_link[:title]).to eq('Failed - (unknown failure)')
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project/pipelines/:id/failures' do
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: '1234') }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:pipeline_failures_page) { failures_project_pipeline_path(project, pipeline) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline) }
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
subject { visit pipeline_failures_page }
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'with failed build' do
|
|
|
|
before do
|
|
|
|
failed_build.trace.set('4 examples, 1 failure')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows jobs tab pane as active' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Failed Jobs')
|
|
|
|
expect(page).to have_css('#js-tab-failures.active')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'lists failed builds' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content(failed_build.name)
|
|
|
|
expect(page).to have_content(failed_build.stage)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows build failure logs' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('4 examples, 1 failure')
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
it 'shows the failure reason' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(page).to have_content('There is an unknown failure, please try again')
|
|
|
|
end
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
context 'when user does not have permission to retry build' do
|
|
|
|
it 'shows retry button for failed build' do
|
|
|
|
subject
|
|
|
|
|
|
|
|
page.within(find('.build-failures', match: :first)) do
|
|
|
|
expect(page).not_to have_link('Retry')
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
context 'when user does have permission to retry build' do
|
|
|
|
before do
|
|
|
|
create(:protected_branch, :developers_can_merge,
|
|
|
|
name: pipeline.ref, project: project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows retry button for failed build' do
|
|
|
|
subject
|
|
|
|
|
|
|
|
page.within(find('.build-failures', match: :first)) do
|
|
|
|
expect(page).to have_link('Retry')
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
context 'when missing build logs' do
|
2018-10-15 14:42:47 +05:30
|
|
|
it 'shows jobs tab pane as active' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_content('Failed Jobs')
|
|
|
|
expect(page).to have_css('#js-tab-failures.active')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'lists failed builds' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_content(failed_build.name)
|
|
|
|
expect(page).to have_content(failed_build.stage)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show trace' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('No job trace')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
context 'without permission to access builds' do
|
|
|
|
let(:role) { :guest }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.update(public_builds: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when accessing failed jobs page' do
|
|
|
|
it 'fails to access the page' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(page).to have_title('Access Denied')
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'without failures' do
|
|
|
|
before do
|
|
|
|
failed_build.update!(status: :success)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays the pipeline graph' do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(current_path).to eq(pipeline_path(pipeline))
|
|
|
|
expect(page).not_to have_content('Failed Jobs')
|
|
|
|
expect(page).to have_selector('.pipeline-visualization')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-23 12:14:25 +05:30
|
|
|
|
|
|
|
context 'when user sees pipeline flags in a pipeline detail page' do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
context 'when pipeline is latest' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline,
|
|
|
|
project: project,
|
|
|
|
ref: 'master',
|
|
|
|
sha: project.commit.id,
|
|
|
|
user: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates it is the latest build' do
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_content 'latest'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline has configuration errors' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline,
|
|
|
|
:invalid,
|
|
|
|
project: project,
|
|
|
|
ref: 'master',
|
|
|
|
sha: project.commit.id,
|
|
|
|
user: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates errors' do
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_content 'yaml invalid'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge with tooltip which contains error' do
|
|
|
|
expect(pipeline).to have_yaml_errors
|
|
|
|
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_selector(
|
|
|
|
%Q{span[title="#{pipeline.yaml_errors}"]})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates failure reason' do
|
|
|
|
expect(page).to have_content 'error'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge with tooltip which contains failure reason' do
|
|
|
|
expect(pipeline.failure_reason?).to eq true
|
|
|
|
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_selector(
|
|
|
|
%Q{span[title="#{pipeline.present.failure_reason}"]})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline is stuck' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline,
|
|
|
|
project: project,
|
|
|
|
ref: 'master',
|
|
|
|
sha: project.commit.id,
|
|
|
|
user: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
create(:ci_build, :pending, pipeline: pipeline)
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates being stuck' do
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_content 'stuck'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline uses auto devops' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:project) { create(:project, :repository, auto_devops_attributes: { enabled: true }) }
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline,
|
|
|
|
:auto_devops_source,
|
|
|
|
project: project,
|
|
|
|
ref: 'master',
|
|
|
|
sha: project.commit.id,
|
|
|
|
user: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates using auto devops' do
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_content 'Auto DevOps'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipeline runs in a merge request context' do
|
|
|
|
include_context 'pipeline builds'
|
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline,
|
|
|
|
source: :merge_request,
|
|
|
|
project: merge_request.source_project,
|
|
|
|
ref: 'feature',
|
|
|
|
sha: merge_request.diff_head_sha,
|
|
|
|
user: user,
|
|
|
|
merge_request: merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:merge_request) do
|
|
|
|
create(:merge_request,
|
|
|
|
source_project: project,
|
|
|
|
source_branch: 'feature',
|
|
|
|
target_project: project,
|
|
|
|
target_branch: 'master')
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit project_pipeline_path(project, pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains badge that indicates merge request pipeline' do
|
|
|
|
page.within(all('.well-segment')[1]) do
|
|
|
|
expect(page).to have_content 'merge request'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|