diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-06-13 15:21:44 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-06-13 15:23:39 +0300 |
commit | 12a777b2216f1887acd3dfc888e9bca775559222 (patch) | |
tree | 8b9210521d523bca0f0d8d1bc26c0c224886a04b /spec/javascripts/jobs | |
parent | cb0616fe01729cd0f2be02b16a87407a87144300 (diff) |
Adds specs and changelog - squash
Diffstat (limited to 'spec/javascripts/jobs')
-rw-r--r-- | spec/javascripts/jobs/components/job_log_spec.js | 37 | ||||
-rw-r--r-- | spec/javascripts/jobs/mock_data.js | 15 |
2 files changed, 52 insertions, 0 deletions
diff --git a/spec/javascripts/jobs/components/job_log_spec.js b/spec/javascripts/jobs/components/job_log_spec.js index dc0f77ceb80..4e94ae710c0 100644 --- a/spec/javascripts/jobs/components/job_log_spec.js +++ b/spec/javascripts/jobs/components/job_log_spec.js @@ -3,6 +3,7 @@ import component from '~/jobs/components/job_log.vue'; import createStore from '~/jobs/store'; import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { resetStore } from '../store/helpers'; +import { logWithCollapsibleSections } from '../mock_data'; describe('Job Log', () => { const Component = Vue.extend(component); @@ -62,4 +63,40 @@ describe('Job Log', () => { expect(vm.$el.querySelector('.js-log-animation')).toBeNull(); }); }); + + describe('Collapsible sections', () => { + beforeEach(() => { + vm = mountComponentWithStore(Component, { + props: { + trace: logWithCollapsibleSections.html, + isComplete: true, + }, + store, + }); + }); + + it('renders open arrow', () => { + expect(vm.$el.querySelector('.fa-caret-down')).not.toBeNull(); + }); + + it('toggles hidden class to the sibilings rows when arrow is clicked', done => { + vm.$nextTick() + .then(() => { + const { section } = vm.$el.querySelector('.js-section-start').dataset; + vm.$el.querySelector('.js-section-start').click(); + + vm.$el.querySelectorAll(`.js-s_${section}:not(.js-section-header)`).forEach(el => { + expect(el.classList.contains('hidden')).toEqual(true); + }); + + vm.$el.querySelector('.js-section-start').click(); + + vm.$el.querySelectorAll(`.js-s_${section}:not(.js-section-header)`).forEach(el => { + expect(el.classList.contains('hidden')).toEqual(false); + }); + }) + .then(done) + .catch(done.fail); + }); + }); }); diff --git a/spec/javascripts/jobs/mock_data.js b/spec/javascripts/jobs/mock_data.js index 88b0bb206ee..0a6d6006adf 100644 --- a/spec/javascripts/jobs/mock_data.js +++ b/spec/javascripts/jobs/mock_data.js @@ -1190,3 +1190,18 @@ export const jobsInStage = { path: '/gitlab-org/gitlab-shell/pipelines/27#build', dropdown_path: '/gitlab-org/gitlab-shell/pipelines/27/stage.json?stage=build', }; + +export const logWithCollapsibleSections = { + append: false, + complete: true, + html: + '<div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571405" data-section="after-script" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s_after-script">Running after script...</span><span class="section js-section-header js-s_after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script"></span><span class="term-fg-l-green term-bold section js-s_after-script">$ date</span><span class="section js-s_after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script">Mon Jun 3 14:16:46 UTC 2019<br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script"></span><div class="section-end" data-section="after-script"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer"data-timestamp="1559571408" data-section="archive-cache" role="button" ></div><span class="term-fg-l-green term-bold section js-section-header js-s_archive-cache">Not uploading cache debian-stretch-ruby-2.6.3-node-10.x-3 due to policy</span><span class="section js-section-header js-s_archive-cache"><br /></span><span class="section s_archive-cache line"></span><span class="section js-s_archive-cache"></span><div class="section-end" data-section="archive-cache"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571409" data-section="upload-artifacts-on-success" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s_upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-section-header js-s_upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">coverage/: found 5 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">knapsack/: found 4 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">rspec_flaky/: found 4 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">rspec_profiling/: found 1 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><span class="term-fg-yellow section js-s_upload-artifacts-on-success">WARNING: tmp/capybara/: no matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s_upload-artifacts-on-success"> id</span><span class="section js-s_upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s_upload-artifacts-on-success">=201 Created token</span><span class="section js-s_upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><span class="term-fg-l-green term-bold section js-s_upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-s_upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">junit_rspec.xml: found 1 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s_upload-artifacts-on-success"> id</span><span class="section js-s_upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s_upload-artifacts-on-success">=201 Created token</span><span class="section js-s_upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><div class="section-end" data-section="upload-artifacts-on-success"></div><span class="term-fg-l-green term-bold">Job succeeded<br /><span class="term-fg-l-green term-bold"></span></span>', + id: 1385, + offset: 0, + size: 78815, + state: + 'eyJvZmZzZXQiOjc4ODE1LCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowLCJzZWN0aW9ucyI6W10sImxpbmVub19pbl9zZWN0aW9uIjoxMX0=', + status: 'success', + total: 78815, + truncated: false, +}; |