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
expect(page).to have_link('Unschedule job')
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'
wait_for_requests
......
......@@ -84,7 +84,7 @@ describe 'Pipeline', :js do
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
page.within('#ci-badge-deploy') do
......@@ -112,8 +112,8 @@ 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
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')
......@@ -124,10 +124,12 @@ describe 'Pipeline', :js do
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
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
......@@ -341,14 +343,16 @@ describe 'Pipeline', :js do
it { expect(build_manual.reload).to be_pending }
end
context 'unscheduling scheduled job' do
context 'when user unschedules a delayed job' do
before do
within '.pipeline-holder' do
click_link('Unschedule')
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
context 'failed jobs' do
......
......@@ -232,7 +232,7 @@ describe 'Pipelines', :js do
end
end
context 'with delayed job' do
context 'when there is a delayed job' do
let!(:delayed_job) do
create(:ci_build, :scheduled,
pipeline: pipeline,
......@@ -245,26 +245,25 @@ describe 'Pipelines', :js do
visit_project_pipelines
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')
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
expect(page).to have_button('delayed job')
end
context 'when scheduled action was played' do
context 'when user played a delayed job immediately' do
before do
accept_confirm do
find('.js-pipeline-dropdown-manual-actions').click
click_button('delayed job')
end
page.accept_confirm { click_button('delayed job') }
wait_for_requests
end
it 'enqueues scheduled action job' do
expect(page).to have_selector('.js-pipeline-dropdown-manual-actions:disabled')
it 'enqueues the delayed job', :js do
expect(delayed_job.reload).to be_pending
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