diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-15 18:07:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-15 18:07:42 +0300 |
commit | fa7c331b76ed59230cc56fc51bfc9e467c8bb9b4 (patch) | |
tree | eb03d2b6e8dd45f67864635c8b0b0de8d671edf7 /spec/frontend/vue_merge_request_widget | |
parent | f26f31d2fd8e3c91677e2629293b9e0562c1437a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_merge_request_widget')
3 files changed, 105 insertions, 1 deletions
diff --git a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js index 441054493f7..6a899c00b98 100644 --- a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js @@ -111,6 +111,14 @@ describe('MRWidgetPipeline', () => { expect(findPipelineMiniGraph().props('stages')).toHaveLength(stagesCount); }); + it('should render the latest downstream pipelines only', () => { + // component receives two downstream pipelines. one of them is already outdated + // because we retried the trigger job, so the mini pipeline graph will only + // render the newly created downstream pipeline instead + expect(mockData.pipeline.triggered).toHaveLength(2); + expect(findPipelineMiniGraph().props('downstreamPipelines')).toHaveLength(1); + }); + describe('should render pipeline coverage information', () => { it('should render coverage percentage', () => { expect(findPipelineCoverage().text()).toMatch( diff --git a/spec/frontend/vue_merge_request_widget/components/report_widget_container_spec.js b/spec/frontend/vue_merge_request_widget/components/report_widget_container_spec.js index 2f6002f36e0..436f74d1be2 100644 --- a/spec/frontend/vue_merge_request_widget/components/report_widget_container_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/report_widget_container_spec.js @@ -19,7 +19,13 @@ describe('app/assets/javascripts/vue_merge_request_widget/components/report_widg expect(wrapper.isVisible()).toBe(false); }); - it('shows the container when children have no content', async () => { + it('hides the container when children has only empty spaces', async () => { + createComponent({ slot: `<span><b> <br/>\t\r\n</b></span> ` }); + await nextTick(); + expect(wrapper.isVisible()).toBe(false); + }); + + it('shows the container when a child has content', async () => { createComponent({ slot: `<span><b>test</b></span>` }); await nextTick(); expect(wrapper.isVisible()).toBe(true); diff --git a/spec/frontend/vue_merge_request_widget/mock_data.js b/spec/frontend/vue_merge_request_widget/mock_data.js index 20d00a116bb..46e1919b0ea 100644 --- a/spec/frontend/vue_merge_request_widget/mock_data.js +++ b/spec/frontend/vue_merge_request_widget/mock_data.js @@ -1,5 +1,94 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; +export const mockDownstreamPipelinesRest = ({ includeSourceJobRetried = true } = {}) => [ + { + id: 632, + user: { + id: 1, + username: 'root', + name: 'Administrator', + state: 'active', + avatar_url: + 'https://secure.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon', + web_url: 'https://gdk.test:3000/root', + show_status: false, + path: '/root', + }, + active: false, + coverage: null, + source: 'parent_pipeline', + source_job: { + name: 'bridge_job', + retried: includeSourceJobRetried ? false : null, + }, + path: '/kitchen-sink/bakery/-/pipelines/632', + details: { + status: { + icon: 'status_success', + text: 'passed', + label: 'passed', + group: 'success', + tooltip: 'passed', + has_details: true, + details_path: '/kitchen-sink/bakery/-/pipelines/632', + illustration: null, + favicon: + '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png', + }, + }, + project: { + id: 21, + name: 'bakery', + full_path: '/kitchen-sink/bakery', + full_name: 'kitchen-sink / bakery', + refs_url: '/kitchen-sink/bakery/refs', + }, + }, + { + id: 633, + user: { + id: 1, + username: 'root', + name: 'Administrator', + state: 'active', + avatar_url: + 'https://secure.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon', + web_url: 'https://gdk.test:3000/root', + show_status: false, + path: '/root', + }, + active: false, + coverage: null, + source: 'parent_pipeline', + source_job: { + name: 'bridge_job', + retried: includeSourceJobRetried ? true : null, + }, + path: '/kitchen-sink/bakery/-/pipelines/633', + details: { + status: { + icon: 'status_success', + text: 'passed', + label: 'passed', + group: 'success', + tooltip: 'passed', + has_details: true, + details_path: '/kitchen-sink/bakery/-/pipelines/633', + illustration: null, + favicon: + '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png', + }, + }, + project: { + id: 21, + name: 'bakery', + full_path: '/kitchen-sink/bakery', + full_name: 'kitchen-sink / bakery', + refs_url: '/kitchen-sink/bakery/refs', + }, + }, +]; + export const artifacts = [ { text: 'result.txt', @@ -207,6 +296,7 @@ export default { retry_path: '/root/acets-app/pipelines/172/retry', created_at: '2017-04-07T12:27:19.520Z', updated_at: '2017-04-07T15:28:44.800Z', + triggered: mockDownstreamPipelinesRest(), }, pipelineCoverageDelta: '15.25', buildsWithCoverage: [ |