diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-04 03:07:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-04 03:07:42 +0300 |
commit | 4ba8e68892892de8366ce8ad677fbfe6dbae64c9 (patch) | |
tree | 85c7a48d5e163c8fc7053cc4109d9dcb74ef4bcf /spec/frontend/pipelines | |
parent | 2eff77c2efe8ad71796561cae3bcd993b9065721 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines')
-rw-r--r-- | spec/frontend/pipelines/graph/graph_component_spec.js | 39 | ||||
-rw-r--r-- | spec/frontend/pipelines/graph/mock_data.js | 3 |
2 files changed, 30 insertions, 12 deletions
diff --git a/spec/frontend/pipelines/graph/graph_component_spec.js b/spec/frontend/pipelines/graph/graph_component_spec.js index d2f55ecefc0..95207fd59ff 100644 --- a/spec/frontend/pipelines/graph/graph_component_spec.js +++ b/spec/frontend/pipelines/graph/graph_component_spec.js @@ -1,4 +1,5 @@ -import { mount, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; import { LAYER_VIEW, STAGE_VIEW } from '~/pipelines/components/graph/constants'; import PipelineGraph from '~/pipelines/components/graph/graph_component.vue'; import JobItem from '~/pipelines/components/graph/job_item.vue'; @@ -15,10 +16,11 @@ import { describe('graph component', () => { let wrapper; + const findDownstreamColumn = () => wrapper.findByTestId('downstream-pipelines'); const findLinkedColumns = () => wrapper.findAllComponents(LinkedPipelinesColumn); const findLinksLayer = () => wrapper.findComponent(LinksLayer); const findStageColumns = () => wrapper.findAllComponents(StageColumnComponent); - const findStageNameInJob = () => wrapper.find('[data-testid="stage-name-in-job"]'); + const findStageNameInJob = () => wrapper.findByTestId('stage-name-in-job'); const defaultProps = { pipeline: generateResponse(mockPipelineResponse, 'root/fungi-xoxo'), @@ -64,14 +66,9 @@ describe('graph component', () => { }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - describe('with data', () => { beforeEach(() => { - createComponent({ mountFn: mount }); + createComponent({ mountFn: mountExtended }); }); it('renders the main columns in the graph', () => { @@ -109,7 +106,7 @@ describe('graph component', () => { describe('when links are present', () => { beforeEach(() => { createComponent({ - mountFn: mount, + mountFn: mountExtended, stubOverride: { 'job-item': false }, data: { hoveredJobName: 'test_a' }, }); @@ -126,7 +123,7 @@ describe('graph component', () => { describe('when linked pipelines are not present', () => { beforeEach(() => { - createComponent({ mountFn: mount }); + createComponent({ mountFn: mountExtended }); }); it('should not render a linked pipelines column', () => { @@ -137,7 +134,7 @@ describe('graph component', () => { describe('when linked pipelines are present', () => { beforeEach(() => { createComponent({ - mountFn: mount, + mountFn: mountExtended, props: { pipeline: pipelineWithUpstreamDownstream(mockPipelineResponse) }, }); }); @@ -150,7 +147,7 @@ describe('graph component', () => { describe('in layers mode', () => { beforeEach(() => { createComponent({ - mountFn: mount, + mountFn: mountExtended, stubOverride: { 'job-item': false, 'job-group-dropdown': false, @@ -166,4 +163,22 @@ describe('graph component', () => { expect(findStageNameInJob().exists()).toBe(true); }); }); + + describe('downstream pipelines', () => { + beforeEach(() => { + createComponent({ + mountFn: mountExtended, + props: { + pipeline: pipelineWithUpstreamDownstream(mockPipelineResponse), + }, + }); + }); + + it('filters pipelines spawned from the same trigger job', () => { + // The mock data has one downstream with `retried: true and one + // with retried false. We filter the `retried: true` out so we + // should only pass one downstream + expect(findDownstreamColumn().props().linkedPipelines).toHaveLength(1); + }); + }); }); diff --git a/spec/frontend/pipelines/graph/mock_data.js b/spec/frontend/pipelines/graph/mock_data.js index f949ca9564d..08624cc511d 100644 --- a/spec/frontend/pipelines/graph/mock_data.js +++ b/spec/frontend/pipelines/graph/mock_data.js @@ -730,6 +730,7 @@ export const downstream = { sourceJob: { name: 'test_c', id: '71', + retried: false, __typename: 'CiJob', }, project: { @@ -760,6 +761,7 @@ export const downstream = { sourceJob: { id: '73', name: 'test_d', + retried: true, __typename: 'CiJob', }, project: { @@ -845,6 +847,7 @@ export const wrappedPipelineReturn = { sourceJob: { name: 'test_c', id: '78', + retried: false, __typename: 'CiJob', }, project: { |