Add feature spec
This commit is contained in:
parent
1da4ae719a
commit
9621bbb94c
|
@ -429,6 +429,31 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'Delayed job' do
|
||||||
|
let(:job) { create(:ci_build, :scheduled, pipeline: pipeline) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
project.add_developer(user)
|
||||||
|
visit project_job_path(project, job)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows delayed job' do
|
||||||
|
expect(page).to have_content(job.detailed_status(user).illustration[:title])
|
||||||
|
expect(page).to have_content('This is a scheduled to run in')
|
||||||
|
expect(page).to have_content("This job will automatically run after it's timer finishes.")
|
||||||
|
expect(page).to have_link('Unschedule job')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'unschedule delayed job and shows manual action', :js do
|
||||||
|
click_link 'Unschedule job'
|
||||||
|
|
||||||
|
wait_for_requests
|
||||||
|
expect(page).to have_content('This job requires a manual action')
|
||||||
|
expect(page).to have_content('This job depends on a user to trigger its process. Often they are used to deploy code to production environments')
|
||||||
|
expect(page).to have_link('Trigger this manual action')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'Non triggered job' do
|
context 'Non triggered job' do
|
||||||
let(:job) { create(:ci_build, :created, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :created, pipeline: pipeline) }
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,11 @@ describe 'Pipeline', :js do
|
||||||
pipeline: pipeline, stage: 'deploy', name: 'manual-build')
|
pipeline: pipeline, stage: 'deploy', name: 'manual-build')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let!(:build_scheduled) do
|
||||||
|
create(:ci_build, :scheduled,
|
||||||
|
pipeline: pipeline, stage: 'deploy', name: 'delayed-job')
|
||||||
|
end
|
||||||
|
|
||||||
let!(:build_external) do
|
let!(:build_external) do
|
||||||
create(:generic_commit_status, status: 'success',
|
create(:generic_commit_status, status: 'success',
|
||||||
pipeline: pipeline,
|
pipeline: pipeline,
|
||||||
|
@ -105,6 +110,25 @@ describe 'Pipeline', :js do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when pipeline has scheduled builds' do
|
||||||
|
it 'shows the scheduled icon and a unschedule action for the scheduled build' 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 'should be possible to unschedule the scheduled job' do
|
||||||
|
find('#ci-badge-delayed-job .ci-action-icon-container').click
|
||||||
|
|
||||||
|
expect(page).not_to have_content('Unschedule job')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when pipeline has failed builds' do
|
context 'when pipeline has failed builds' do
|
||||||
it 'shows the failed icon and a retry action for the failed build' do
|
it 'shows the failed icon and a retry action for the failed build' do
|
||||||
page.within('#ci-badge-test') do
|
page.within('#ci-badge-test') do
|
||||||
|
@ -315,6 +339,16 @@ describe 'Pipeline', :js do
|
||||||
it { expect(build_manual.reload).to be_pending }
|
it { expect(build_manual.reload).to be_pending }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'unscheduling scheduled job' do
|
||||||
|
before do
|
||||||
|
within '.pipeline-holder' do
|
||||||
|
click_link('Unschedule')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(build_scheduled.reload).to be_manual }
|
||||||
|
end
|
||||||
|
|
||||||
context 'failed jobs' do
|
context 'failed jobs' do
|
||||||
it 'displays a tooltip with the failure reason' do
|
it 'displays a tooltip with the failure reason' do
|
||||||
page.within('.ci-table') do
|
page.within('.ci-table') do
|
||||||
|
|
|
@ -232,6 +232,43 @@ describe 'Pipelines', :js do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with delayed job' do
|
||||||
|
let!(:delayed_job) do
|
||||||
|
create(:ci_build, :scheduled,
|
||||||
|
pipeline: pipeline,
|
||||||
|
name: 'delayed job',
|
||||||
|
stage: 'test',
|
||||||
|
commands: 'test')
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
visit_project_pipelines
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'has a dropdown with play button' do
|
||||||
|
expect(page).to have_selector('.dropdown-new.btn.btn-default .icon-play')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'has link to the scheduled action' do
|
||||||
|
find('.js-pipeline-dropdown-manual-actions').click
|
||||||
|
|
||||||
|
expect(page).to have_button('delayed job')
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when scheduled action was played' do
|
||||||
|
before do
|
||||||
|
accept_confirm do
|
||||||
|
find('.js-pipeline-dropdown-manual-actions').click
|
||||||
|
click_button('delayed job')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'enqueues scheduled action job' do
|
||||||
|
expect(page).to have_selector('.js-pipeline-dropdown-manual-actions:disabled')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'for generic statuses' do
|
context 'for generic statuses' do
|
||||||
context 'when running' do
|
context 'when running' do
|
||||||
let!(:running) do
|
let!(:running) do
|
||||||
|
|
Loading…
Reference in New Issue