diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 16:07:28 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 16:07:28 +0900 |
commit | e8f14ef8859c2b6f870090666331f538702c40b9 (patch) | |
tree | 5be00c558fb0aa6f28a85a876d91473d4b29ea56 | |
parent | aeaa0261c7376485bdaa6b58682d19729a0a8c8c (diff) | |
download | gitlab-ce-e8f14ef8859c2b6f870090666331f538702c40b9.tar.gz |
Add feature spec for remaining time
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/projects/pipelines/pipelines_spec.rb | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 4e440c1befa..67b4a520184 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -568,9 +568,12 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do end 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('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(Time.at(time_diff).utc.strftime("%H:%M:%S")) expect(page).to have_link('Unschedule job') end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index f6197a31ee1..16a1ef813e3 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -252,7 +252,25 @@ describe 'Pipelines', :js do it "has link to the delayed job's action" do 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_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 context 'when user played a delayed job immediately' do |