Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-23 00:09:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-23 00:09:40 +0300
commit014b832720635752908b8232f754456d75075536 (patch)
tree26d208e38056b34d81f98b0a301499b00b98b3ce /spec/frontend/pipelines
parentd81dc2a54e28f4e6d7515545dfe0dc19d9e57816 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines')
-rw-r--r--spec/frontend/pipelines/mock_data.js81
-rw-r--r--spec/frontend/pipelines/pipelines_table_spec.js56
2 files changed, 137 insertions, 0 deletions
diff --git a/spec/frontend/pipelines/mock_data.js b/spec/frontend/pipelines/mock_data.js
index 7e3c3727c9d..02ec529eb12 100644
--- a/spec/frontend/pipelines/mock_data.js
+++ b/spec/frontend/pipelines/mock_data.js
@@ -471,3 +471,84 @@ export const mockSearch = [
export const mockBranchesAfterMap = ['branch-1', 'branch-10', 'branch-11'];
export const mockTagsAfterMap = ['tag-3', 'tag-2', 'tag-1', 'main-tag'];
+
+export const triggered = [
+ {
+ id: 602,
+ user: {
+ id: 1,
+ name: 'Administrator',
+ username: 'root',
+ state: 'active',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://gdk.test:3000/root',
+ show_status: false,
+ path: '/root',
+ },
+ active: false,
+ coverage: null,
+ source: 'pipeline',
+ source_job: { name: 'trigger_job_on_mr' },
+ path: '/root/job-log-sections/-/pipelines/602',
+ details: {
+ status: {
+ icon: 'status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ tooltip: 'passed',
+ has_details: true,
+ details_path: '/root/job-log-sections/-/pipelines/602',
+ illustration: null,
+ favicon:
+ '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
+ },
+ },
+ project: {
+ id: 36,
+ name: 'job-log-sections',
+ full_path: '/root/job-log-sections',
+ full_name: 'Administrator / job-log-sections',
+ },
+ },
+];
+
+export const triggeredBy = {
+ id: 614,
+ user: {
+ id: 1,
+ name: 'Administrator',
+ username: 'root',
+ state: 'active',
+ avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://gdk.test:3000/root',
+ show_status: false,
+ path: '/root',
+ },
+ active: false,
+ coverage: null,
+ source: 'web',
+ source_job: { name: null },
+ path: '/root/trigger-downstream/-/pipelines/614',
+ details: {
+ status: {
+ icon: 'status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ tooltip: 'passed',
+ has_details: true,
+ details_path: '/root/trigger-downstream/-/pipelines/614',
+ illustration: null,
+ favicon:
+ '/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png',
+ },
+ },
+ project: {
+ id: 42,
+ name: 'trigger-downstream',
+ full_path: '/root/trigger-downstream',
+ full_name: 'Administrator / trigger-downstream',
+ },
+};
diff --git a/spec/frontend/pipelines/pipelines_table_spec.js b/spec/frontend/pipelines/pipelines_table_spec.js
index 68b0dfc018e..07d9b208776 100644
--- a/spec/frontend/pipelines/pipelines_table_spec.js
+++ b/spec/frontend/pipelines/pipelines_table_spec.js
@@ -12,6 +12,7 @@ import PipelinesTimeago from '~/pipelines/components/pipelines_list/time_ago.vue
import eventHub from '~/pipelines/event_hub';
import CiBadge from '~/vue_shared/components/ci_badge_link.vue';
import CommitComponent from '~/vue_shared/components/commit.vue';
+import { triggeredBy, triggered } from './mock_data';
jest.mock('~/pipelines/event_hub');
@@ -59,6 +60,8 @@ describe('Pipelines Table', () => {
const findStagesTh = () => wrapper.findByTestId('stages-th');
const findTimeAgoTh = () => wrapper.findByTestId('timeago-th');
const findActionsTh = () => wrapper.findByTestId('actions-th');
+ const findUpstream = () => wrapper.findByTestId('mini-graph-upstream');
+ const findDownstream = () => wrapper.findByTestId('mini-graph-downstream');
beforeEach(() => {
pipeline = createMockPipeline();
@@ -136,6 +139,8 @@ describe('Pipelines Table', () => {
describe('stages cell', () => {
it('should render a pipeline mini graph', () => {
expect(findPipelineMiniGraph().exists()).toBe(true);
+ expect(findUpstream().exists()).toBe(false);
+ expect(findDownstream().exists()).toBe(false);
});
it('should render the right number of stages', () => {
@@ -173,6 +178,57 @@ describe('Pipelines Table', () => {
expect(eventHub.$emit).toHaveBeenCalledWith('refreshPipelinesTable');
});
+
+ describe('upstream linked pipelines', () => {
+ beforeEach(() => {
+ pipeline = createMockPipeline();
+ pipeline.triggered_by = triggeredBy;
+
+ createComponent({ pipelines: [pipeline] });
+ });
+
+ it('should render only a upstream pipeline', () => {
+ expect(findUpstream().exists()).toBe(true);
+ expect(findDownstream().exists()).toBe(false);
+ });
+
+ it('should pass an array of the correct data to the linked pipeline component', () => {
+ const triggeredByProps = findUpstream().props('triggeredBy');
+
+ expect(triggeredByProps).toEqual(expect.any(Array));
+ expect(triggeredByProps).toHaveLength(1);
+ expect(triggeredByProps[0]).toBe(triggeredBy);
+ });
+ });
+
+ describe('downstream linked pipelines', () => {
+ beforeEach(() => {
+ pipeline = createMockPipeline();
+ pipeline.triggered = triggered;
+
+ createComponent({ pipelines: [pipeline] });
+ });
+
+ it('should render only a downstream pipeline', () => {
+ expect(findDownstream().exists()).toBe(true);
+ expect(findUpstream().exists()).toBe(false);
+ });
+ });
+
+ describe('upstream and downstream linked pipelines', () => {
+ beforeEach(() => {
+ pipeline = createMockPipeline();
+ pipeline.triggered = triggered;
+ pipeline.triggered_by = triggeredBy;
+
+ createComponent({ pipelines: [pipeline] });
+ });
+
+ it('should render both downstream and upstream pipelines', () => {
+ expect(findDownstream().exists()).toBe(true);
+ expect(findUpstream().exists()).toBe(true);
+ });
+ });
});
describe('duration cell', () => {