summaryrefslogtreecommitdiff
path: root/spec/features/projects
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-03 16:11:08 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-03 16:11:08 +0900
commit9621bbb94cde3d33fce3c2c25fb98748f7a1824a (patch)
tree06d33f40872a646d2fce8141ef8a50770260e6d0 /spec/features/projects
parent1da4ae719a704125738f2be2544ba134ebfec385 (diff)
downloadgitlab-ce-9621bbb94cde3d33fce3c2c25fb98748f7a1824a.tar.gz
Add feature spec
Diffstat (limited to 'spec/features/projects')
-rw-r--r--spec/features/projects/jobs_spec.rb25
-rw-r--r--spec/features/projects/pipelines/pipeline_spec.rb34
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb37
3 files changed, 96 insertions, 0 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb
index d0bf4975b81..5b767c96910 100644
--- a/spec/features/projects/jobs_spec.rb
+++ b/spec/features/projects/jobs_spec.rb
@@ -429,6 +429,31 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
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
let(:job) { create(:ci_build, :created, pipeline: pipeline) }
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb
index 603503a531c..b728f4c00f2 100644
--- a/spec/features/projects/pipelines/pipeline_spec.rb
+++ b/spec/features/projects/pipelines/pipeline_spec.rb
@@ -31,6 +31,11 @@ describe 'Pipeline', :js do
pipeline: pipeline, stage: 'deploy', name: 'manual-build')
end
+ let!(:build_scheduled) do
+ create(:ci_build, :scheduled,
+ pipeline: pipeline, stage: 'deploy', name: 'delayed-job')
+ end
+
let!(:build_external) do
create(:generic_commit_status, status: 'success',
pipeline: pipeline,
@@ -105,6 +110,25 @@ describe 'Pipeline', :js do
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
it 'shows the failed icon and a retry action for the failed build' do
page.within('#ci-badge-test') do
@@ -315,6 +339,16 @@ describe 'Pipeline', :js do
it { expect(build_manual.reload).to be_pending }
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
it 'displays a tooltip with the failure reason' do
page.within('.ci-table') do
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index 41822babbc9..43f9608e8e3 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -232,6 +232,43 @@ describe 'Pipelines', :js do
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 'when running' do
let!(:running) do