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>2019-10-31 15:06:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 15:06:26 +0300
commit0be510a49f6e4f8e27b19b707fd1dac61571f78f (patch)
tree97ca0053d4fad66e900d25fdba61b2adb611efb0 /spec/javascripts/pipelines
parent6026bddcd51eca573c530240c421392045172b89 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/pipelines')
-rw-r--r--spec/javascripts/pipelines/graph/action_component_spec.js81
-rw-r--r--spec/javascripts/pipelines/pipeline_triggerer_spec.js54
-rw-r--r--spec/javascripts/pipelines/pipelines_table_row_spec.js218
3 files changed, 0 insertions, 353 deletions
diff --git a/spec/javascripts/pipelines/graph/action_component_spec.js b/spec/javascripts/pipelines/graph/action_component_spec.js
deleted file mode 100644
index 321497b35b5..00000000000
--- a/spec/javascripts/pipelines/graph/action_component_spec.js
+++ /dev/null
@@ -1,81 +0,0 @@
-import Vue from 'vue';
-import MockAdapter from 'axios-mock-adapter';
-import axios from '~/lib/utils/axios_utils';
-import actionComponent from '~/pipelines/components/graph/action_component.vue';
-import mountComponent from '../../helpers/vue_mount_component_helper';
-
-describe('pipeline graph action component', () => {
- let component;
- let mock;
-
- beforeEach(done => {
- const ActionComponent = Vue.extend(actionComponent);
- mock = new MockAdapter(axios);
-
- mock.onPost('foo.json').reply(200);
-
- component = mountComponent(ActionComponent, {
- tooltipText: 'bar',
- link: 'foo',
- actionIcon: 'cancel',
- });
-
- Vue.nextTick(done);
- });
-
- afterEach(() => {
- mock.restore();
- component.$destroy();
- });
-
- it('should render the provided title as a bootstrap tooltip', () => {
- expect(component.$el.getAttribute('data-original-title')).toEqual('bar');
- });
-
- it('should update bootstrap tooltip when title changes', done => {
- component.tooltipText = 'changed';
-
- component
- .$nextTick()
- .then(() => {
- expect(component.$el.getAttribute('data-original-title')).toBe('changed');
- })
- .then(done)
- .catch(done.fail);
- });
-
- it('should render an svg', () => {
- expect(component.$el.querySelector('.ci-action-icon-wrapper')).toBeDefined();
- expect(component.$el.querySelector('svg')).toBeDefined();
- });
-
- describe('on click', () => {
- it('emits `pipelineActionRequestComplete` after a successful request', done => {
- spyOn(component, '$emit');
-
- component.$el.click();
-
- setTimeout(() => {
- component
- .$nextTick()
- .then(() => {
- expect(component.$emit).toHaveBeenCalledWith('pipelineActionRequestComplete');
- })
- .catch(done.fail);
-
- done();
- }, 0);
- });
-
- it('renders a loading icon while waiting for request', done => {
- component.$el.click();
-
- component.$nextTick(() => {
- expect(component.$el.querySelector('.js-action-icon-loading')).not.toBeNull();
- setTimeout(() => {
- done();
- });
- });
- });
- });
-});
diff --git a/spec/javascripts/pipelines/pipeline_triggerer_spec.js b/spec/javascripts/pipelines/pipeline_triggerer_spec.js
deleted file mode 100644
index 8cf290f2663..00000000000
--- a/spec/javascripts/pipelines/pipeline_triggerer_spec.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import { mount } from '@vue/test-utils';
-import pipelineTriggerer from '~/pipelines/components/pipeline_triggerer.vue';
-
-describe('Pipelines Triggerer', () => {
- let wrapper;
-
- const mockData = {
- pipeline: {
- user: {
- name: 'foo',
- avatar_url: '/avatar',
- path: '/path',
- },
- },
- };
-
- const createComponent = () => {
- wrapper = mount(pipelineTriggerer, {
- propsData: mockData,
- });
- };
-
- beforeEach(() => {
- createComponent();
- });
-
- afterEach(() => {
- wrapper.destroy();
- });
-
- it('should render a table cell', () => {
- expect(wrapper.contains('.table-section')).toBe(true);
- });
-
- it('should render triggerer information when triggerer is provided', () => {
- const link = wrapper.find('.js-pipeline-url-user');
-
- expect(link.attributes('href')).toEqual(mockData.pipeline.user.path);
- expect(link.find('.js-user-avatar-image-toolip').text()).toEqual(mockData.pipeline.user.name);
- expect(link.find('img.avatar').attributes('src')).toEqual(
- `${mockData.pipeline.user.avatar_url}?width=26`,
- );
- });
-
- it('should render "API" when no triggerer is provided', () => {
- wrapper.setProps({
- pipeline: {
- user: null,
- },
- });
-
- expect(wrapper.find('.js-pipeline-url-api').text()).toEqual('API');
- });
-});
diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js
deleted file mode 100644
index d47504d2f54..00000000000
--- a/spec/javascripts/pipelines/pipelines_table_row_spec.js
+++ /dev/null
@@ -1,218 +0,0 @@
-import Vue from 'vue';
-import tableRowComp from '~/pipelines/components/pipelines_table_row.vue';
-import eventHub from '~/pipelines/event_hub';
-
-describe('Pipelines Table Row', () => {
- const jsonFixtureName = 'pipelines/pipelines.json';
- const buildComponent = pipeline => {
- const PipelinesTableRowComponent = Vue.extend(tableRowComp);
- return new PipelinesTableRowComponent({
- el: document.querySelector('.test-dom-element'),
- propsData: {
- pipeline,
- autoDevopsHelpPath: 'foo',
- viewType: 'root',
- },
- }).$mount();
- };
-
- let component;
- let pipeline;
- let pipelineWithoutAuthor;
- let pipelineWithoutCommit;
-
- preloadFixtures(jsonFixtureName);
-
- beforeEach(() => {
- const { pipelines } = getJSONFixture(jsonFixtureName);
-
- pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
- pipelineWithoutAuthor = pipelines.find(p => p.user === null && p.commit !== null);
- pipelineWithoutCommit = pipelines.find(p => p.user === null && p.commit === null);
- });
-
- afterEach(() => {
- component.$destroy();
- });
-
- it('should render a table row', () => {
- component = buildComponent(pipeline);
-
- expect(component.$el.getAttribute('class')).toContain('gl-responsive-table-row');
- });
-
- describe('status column', () => {
- beforeEach(() => {
- component = buildComponent(pipeline);
- });
-
- it('should render a pipeline link', () => {
- expect(
- component.$el.querySelector('.table-section.commit-link a').getAttribute('href'),
- ).toEqual(pipeline.path);
- });
-
- it('should render status text', () => {
- expect(component.$el.querySelector('.table-section.commit-link a').textContent).toContain(
- pipeline.details.status.text,
- );
- });
- });
-
- describe('information column', () => {
- beforeEach(() => {
- component = buildComponent(pipeline);
- });
-
- it('should render a pipeline link', () => {
- expect(
- component.$el.querySelector('.table-section:nth-child(2) a').getAttribute('href'),
- ).toEqual(pipeline.path);
- });
-
- it('should render pipeline ID', () => {
- expect(
- component.$el.querySelector('.table-section:nth-child(2) a > span').textContent,
- ).toEqual(`#${pipeline.id}`);
- });
-
- describe('when a user is provided', () => {
- it('should render user information', () => {
- expect(
- component.$el
- .querySelector('.table-section:nth-child(3) .js-pipeline-url-user')
- .getAttribute('href'),
- ).toEqual(pipeline.user.path);
-
- expect(
- component.$el
- .querySelector('.table-section:nth-child(3) .js-user-avatar-image-toolip')
- .textContent.trim(),
- ).toEqual(pipeline.user.name);
- });
- });
- });
-
- describe('commit column', () => {
- it('should render link to commit', () => {
- component = buildComponent(pipeline);
-
- const commitLink = component.$el.querySelector('.branch-commit .commit-sha');
-
- expect(commitLink.getAttribute('href')).toEqual(pipeline.commit.commit_path);
- });
-
- const findElements = () => {
- const commitTitleElement = component.$el.querySelector('.branch-commit .commit-title');
- const commitAuthorElement = commitTitleElement.querySelector('a.avatar-image-container');
-
- if (!commitAuthorElement) {
- return { commitAuthorElement };
- }
-
- const commitAuthorLink = commitAuthorElement.getAttribute('href');
- const commitAuthorName = commitAuthorElement
- .querySelector('.js-user-avatar-image-toolip')
- .textContent.trim();
-
- return { commitAuthorElement, commitAuthorLink, commitAuthorName };
- };
-
- it('renders nothing without commit', () => {
- expect(pipelineWithoutCommit.commit).toBe(null);
- component = buildComponent(pipelineWithoutCommit);
-
- const { commitAuthorElement } = findElements();
-
- expect(commitAuthorElement).toBe(null);
- });
-
- it('renders commit author', () => {
- component = buildComponent(pipeline);
- const { commitAuthorLink, commitAuthorName } = findElements();
-
- expect(commitAuthorLink).toEqual(pipeline.commit.author.path);
- expect(commitAuthorName).toEqual(pipeline.commit.author.username);
- });
-
- it('renders commit with unregistered author', () => {
- expect(pipelineWithoutAuthor.commit.author).toBe(null);
- component = buildComponent(pipelineWithoutAuthor);
-
- const { commitAuthorLink, commitAuthorName } = findElements();
-
- expect(commitAuthorLink).toEqual(`mailto:${pipelineWithoutAuthor.commit.author_email}`);
- expect(commitAuthorName).toEqual(pipelineWithoutAuthor.commit.author_name);
- });
- });
-
- describe('stages column', () => {
- beforeEach(() => {
- component = buildComponent(pipeline);
- });
-
- it('should render an icon for each stage', () => {
- expect(
- component.$el.querySelectorAll('.table-section:nth-child(4) .js-builds-dropdown-button')
- .length,
- ).toEqual(pipeline.details.stages.length);
- });
- });
-
- describe('actions column', () => {
- const scheduledJobAction = {
- name: 'some scheduled job',
- };
-
- beforeEach(() => {
- const withActions = Object.assign({}, pipeline);
- withActions.details.scheduled_actions = [scheduledJobAction];
- withActions.flags.cancelable = true;
- withActions.flags.retryable = true;
- withActions.cancel_path = '/cancel';
- withActions.retry_path = '/retry';
-
- component = buildComponent(withActions);
- });
-
- it('should render the provided actions', () => {
- expect(component.$el.querySelector('.js-pipelines-retry-button')).not.toBeNull();
- expect(component.$el.querySelector('.js-pipelines-cancel-button')).not.toBeNull();
- const dropdownMenu = component.$el.querySelectorAll('.dropdown-menu');
-
- expect(dropdownMenu).toContainText(scheduledJobAction.name);
- });
-
- it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => {
- eventHub.$on('retryPipeline', endpoint => {
- expect(endpoint).toEqual('/retry');
- });
-
- component.$el.querySelector('.js-pipelines-retry-button').click();
-
- expect(component.isRetrying).toEqual(true);
- });
-
- it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => {
- eventHub.$once('openConfirmationModal', data => {
- const { id, ref, commit } = pipeline;
-
- expect(data.endpoint).toEqual('/cancel');
- expect(data.pipeline).toEqual(jasmine.objectContaining({ id, ref, commit }));
- });
-
- component.$el.querySelector('.js-pipelines-cancel-button').click();
- });
-
- it('renders a loading icon when `cancelingPipeline` matches pipeline id', done => {
- component.cancelingPipeline = pipeline.id;
- component
- .$nextTick()
- .then(() => {
- expect(component.isCancelling).toEqual(true);
- })
- .then(done)
- .catch(done.fail);
- });
- });
-});