diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-10-26 12:04:25 +0300 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2018-11-07 12:00:25 +0300 |
commit | 53a28e80e343be5d380e152453c32610624b914c (patch) | |
tree | f9e89f099d7f22a5bfa803307eeb20c19f59070e /spec/javascripts/pipelines | |
parent | ff72bba12cf00c6f929546cfc48293b31c1210bb (diff) |
Add dynamic timer for delayed jobs in pipeline graph
Diffstat (limited to 'spec/javascripts/pipelines')
-rw-r--r-- | spec/javascripts/pipelines/graph/job_item_spec.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/graph/job_item_spec.js b/spec/javascripts/pipelines/graph/job_item_spec.js index 7cbcdc791e7..41b614cc95e 100644 --- a/spec/javascripts/pipelines/graph/job_item_spec.js +++ b/spec/javascripts/pipelines/graph/job_item_spec.js @@ -6,6 +6,7 @@ describe('pipeline graph job item', () => { const JobComponent = Vue.extend(JobItem); let component; + const delayedJobFixture = getJSONFixture('jobs/delayed.json'); const mockJob = { id: 4256, name: 'test', @@ -167,4 +168,30 @@ describe('pipeline graph job item', () => { expect(component.$el.querySelector(tooltipBoundary)).toBeNull(); }); }); + + describe('for delayed job', () => { + beforeEach(() => { + const fifteenMinutesInMilliseconds = 900000; + spyOn(Date, 'now').and.callFake( + () => new Date(delayedJobFixture.scheduled_at).getTime() - fifteenMinutesInMilliseconds, + ); + }); + + it('displays remaining time in tooltip', done => { + component = mountComponent(JobComponent, { + job: delayedJobFixture, + }); + + Vue.nextTick() + .then(() => { + expect( + component.$el + .querySelector('.js-pipeline-graph-job-link') + .getAttribute('data-original-title'), + ).toEqual('delayed job - delayed manual action (00:15:00)'); + }) + .then(done) + .catch(done.fail); + }); + }); }); |