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:
Diffstat (limited to 'spec/frontend/pipelines/pipelines_spec.js')
-rw-r--r--spec/frontend/pipelines/pipelines_spec.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js
index 84a25f42201..f9b59c5dc48 100644
--- a/spec/frontend/pipelines/pipelines_spec.js
+++ b/spec/frontend/pipelines/pipelines_spec.js
@@ -1,3 +1,4 @@
+import '~/commons';
import { GlButton, GlEmptyState, GlFilteredSearch, GlLoadingIcon, GlPagination } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
@@ -6,6 +7,7 @@ import { nextTick } from 'vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises';
import Api from '~/api';
+import { getExperimentVariant } from '~/experimentation/utils';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import axios from '~/lib/utils/axios_utils';
import NavigationControls from '~/pipelines/components/pipelines_list/nav_controls.vue';
@@ -19,6 +21,10 @@ import TablePagination from '~/vue_shared/components/pagination/table_pagination
import { stageReply, users, mockSearch, branches } from './mock_data';
jest.mock('~/flash');
+jest.mock('~/experimentation/utils', () => ({
+ ...jest.requireActual('~/experimentation/utils'),
+ getExperimentVariant: jest.fn().mockReturnValue('control'),
+}));
const mockProjectPath = 'twitter/flight';
const mockProjectId = '21';
@@ -41,6 +47,7 @@ describe('Pipelines', () => {
ciLintPath: '/ci/lint',
resetCachePath: `${mockProjectPath}/settings/ci_cd/reset_cache`,
newPipelinePath: `${mockProjectPath}/pipelines/new`,
+ codeQualityPagePath: `${mockProjectPath}/-/new/master?commit_message=Add+.gitlab-ci.yml+and+create+a+code+quality+job&file_name=.gitlab-ci.yml&template=Code-Quality`,
};
const noPermissions = {
@@ -87,7 +94,10 @@ describe('Pipelines', () => {
beforeAll(() => {
origWindowLocation = window.location;
delete window.location;
- window.location = { search: '' };
+ window.location = {
+ search: '',
+ protocol: 'https:',
+ };
});
afterAll(() => {
@@ -289,7 +299,7 @@ describe('Pipelines', () => {
page: '1',
scope: 'all',
username: 'root',
- ref: 'master',
+ ref: 'main',
status: 'pending',
};
@@ -321,7 +331,7 @@ describe('Pipelines', () => {
expect(window.history.pushState).toHaveBeenCalledWith(
expect.anything(),
expect.anything(),
- `${window.location.pathname}?page=1&scope=all&username=root&ref=master&status=pending`,
+ `${window.location.pathname}?page=1&scope=all&username=root&ref=main&status=pending`,
);
});
});
@@ -551,6 +561,19 @@ describe('Pipelines', () => {
);
});
+ describe('when the code_quality_walkthrough experiment is active', () => {
+ beforeAll(() => {
+ getExperimentVariant.mockReturnValue('candidate');
+ });
+
+ it('renders another CTA button', () => {
+ expect(findEmptyState().findComponent(GlButton).text()).toBe('Add a code quality job');
+ expect(findEmptyState().findComponent(GlButton).attributes('href')).toBe(
+ paths.codeQualityPagePath,
+ );
+ });
+ });
+
it('does not render filtered search', () => {
expect(findFilteredSearch().exists()).toBe(false);
});