Commit e8f14ef8 authored by Shinya Maeda's avatar Shinya Maeda

Add feature spec for remaining time

parent aeaa0261
...@@ -568,9 +568,12 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -568,9 +568,12 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end end
it 'shows delayed job', :js do it 'shows delayed job', :js do
time_diff = [0, job.scheduled_at - Time.now].max
expect(page).to have_content(job.detailed_status(user).illustration[:title]) 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 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_content("This job will automatically run after it's timer finishes.")
expect(page).to have_content(Time.at(time_diff).utc.strftime("%H:%M:%S"))
expect(page).to have_link('Unschedule job') expect(page).to have_link('Unschedule job')
end end
......
...@@ -252,7 +252,25 @@ describe 'Pipelines', :js do ...@@ -252,7 +252,25 @@ describe 'Pipelines', :js do
it "has link to the delayed job's 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
time_diff = [0, delayed_job.scheduled_at - Time.now].max
expect(page).to have_button('delayed job') expect(page).to have_button('delayed job')
expect(page).to have_content(Time.at(time_diff).utc.strftime("%H:%M:%S"))
end
context 'when delayed job is expired already' do
let!(:delayed_job) do
create(:ci_build, :expired_scheduled,
pipeline: pipeline,
name: 'delayed job',
stage: 'test',
commands: 'test')
end
it "shows 00:00:00 as the remaining time" do
find('.js-pipeline-dropdown-manual-actions').click
expect(page).to have_content(Time.at(time_diff).utc.strftime("00:00:00"))
end
end end
context 'when user played a delayed job immediately' do context 'when user played a delayed job immediately' do
......
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