Commit 4741c07f authored by Shinya Maeda's avatar Shinya Maeda

Groomed specs

parent e4ed981f
...@@ -574,7 +574,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -574,7 +574,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
expect(page).to have_link('Unschedule job') expect(page).to have_link('Unschedule job')
end end
it 'unschedule delayed job and shows manual action', :js do it 'unschedules delayed job and shows manual action', :js do
click_link 'Unschedule job' click_link 'Unschedule job'
wait_for_requests wait_for_requests
......
...@@ -84,7 +84,7 @@ describe 'Pipeline', :js do ...@@ -84,7 +84,7 @@ describe 'Pipeline', :js do
end end
end end
it 'should be possible to cancel the running build' do it 'cancels the running build and shows retry button' do
find('#ci-badge-deploy .ci-action-icon-container').click find('#ci-badge-deploy .ci-action-icon-container').click
page.within('#ci-badge-deploy') do page.within('#ci-badge-deploy') do
...@@ -112,8 +112,8 @@ describe 'Pipeline', :js do ...@@ -112,8 +112,8 @@ describe 'Pipeline', :js do
end end
end end
context 'when pipeline has scheduled builds' do context 'when pipeline has a delayed job' do
it 'shows the scheduled icon and a unschedule action for the scheduled build' do it 'shows the scheduled icon and an unschedule action for the delayed job' do
page.within('#ci-badge-delayed-job') do page.within('#ci-badge-delayed-job') do
expect(page).to have_selector('.js-ci-status-icon-scheduled') expect(page).to have_selector('.js-ci-status-icon-scheduled')
expect(page).to have_content('delayed-job') expect(page).to have_content('delayed-job')
...@@ -124,10 +124,12 @@ describe 'Pipeline', :js do ...@@ -124,10 +124,12 @@ describe 'Pipeline', :js do
end end
end end
it 'should be possible to unschedule the scheduled job' do it 'unschedules the delayed job and shows play button as a manual job' do
find('#ci-badge-delayed-job .ci-action-icon-container').click find('#ci-badge-delayed-job .ci-action-icon-container').click
expect(page).not_to have_content('Unschedule job') page.within('#ci-badge-delayed-job') do
expect(page).to have_css('.js-icon-play')
end
end end
end end
...@@ -341,14 +343,16 @@ describe 'Pipeline', :js do ...@@ -341,14 +343,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 context 'when user unschedules a delayed job' do
before do before do
within '.pipeline-holder' do within '.pipeline-holder' do
click_link('Unschedule') click_link('Unschedule')
end end
end end
it { expect(build_scheduled.reload).to be_manual } 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 end
context 'failed jobs' do context 'failed jobs' do
......
...@@ -232,7 +232,7 @@ describe 'Pipelines', :js do ...@@ -232,7 +232,7 @@ describe 'Pipelines', :js do
end end
end end
context 'with delayed job' do context 'when there is a delayed job' do
let!(:delayed_job) do let!(:delayed_job) do
create(:ci_build, :scheduled, create(:ci_build, :scheduled,
pipeline: pipeline, pipeline: pipeline,
...@@ -245,26 +245,25 @@ describe 'Pipelines', :js do ...@@ -245,26 +245,25 @@ describe 'Pipelines', :js do
visit_project_pipelines visit_project_pipelines
end end
it 'has a dropdown with play button' do it 'has a dropdown for actionable jobs' do
expect(page).to have_selector('.dropdown-new.btn.btn-default .icon-play') expect(page).to have_selector('.dropdown-new.btn.btn-default .icon-play')
end end
it 'has link to the scheduled action' do it "has link to the delayed job's action" do
find('.js-pipeline-dropdown-manual-actions').click find('.js-pipeline-dropdown-manual-actions').click
expect(page).to have_button('delayed job') expect(page).to have_button('delayed job')
end end
context 'when scheduled action was played' do context 'when user played a delayed job immediately' do
before do before do
accept_confirm do
find('.js-pipeline-dropdown-manual-actions').click find('.js-pipeline-dropdown-manual-actions').click
click_button('delayed job') page.accept_confirm { click_button('delayed job') }
end wait_for_requests
end end
it 'enqueues scheduled action job' do it 'enqueues the delayed job', :js do
expect(page).to have_selector('.js-pipeline-dropdown-manual-actions:disabled') expect(delayed_job.reload).to be_pending
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment