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/pages')
-rw-r--r--spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js48
-rw-r--r--spec/frontend/pages/admin/jobs/components/cancel_jobs_modal_spec.js66
-rw-r--r--spec/frontend/pages/admin/jobs/components/cancel_jobs_spec.js9
-rw-r--r--spec/frontend/pages/admin/jobs/components/jobs_skeleton_loader_spec.js28
-rw-r--r--spec/frontend/pages/admin/jobs/components/table/admin_job_table_app_spec.js105
-rw-r--r--spec/frontend/pages/admin/jobs/components/table/cells/project_cell_spec.js32
-rw-r--r--spec/frontend/pages/admin/jobs/components/table/cells/runner_cell_spec.js64
-rw-r--r--spec/frontend/pages/admin/jobs/components/table/graphql/cache_config_spec.js106
-rw-r--r--spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js6
-rw-r--r--spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js92
10 files changed, 87 insertions, 469 deletions
diff --git a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js b/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
deleted file mode 100644
index 6cf30e84288..00000000000
--- a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import $ from 'jquery';
-import htmlAbuseReportsList from 'test_fixtures/abuse_reports/abuse_reports_list.html';
-import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
-import AbuseReports from '~/pages/admin/abuse_reports/abuse_reports';
-
-describe('Abuse Reports', () => {
- const MAX_MESSAGE_LENGTH = 500;
-
- let $messages;
-
- const assertMaxLength = ($message) => {
- expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
- };
- const findMessage = (searchText) =>
- $messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first();
-
- beforeEach(() => {
- setHTMLFixture(htmlAbuseReportsList);
- new AbuseReports(); // eslint-disable-line no-new
- $messages = $('.abuse-reports .message');
- });
-
- afterEach(() => {
- resetHTMLFixture();
- });
-
- it('should truncate long messages', () => {
- const $longMessage = findMessage('LONG MESSAGE');
-
- expect($longMessage.data('originalMessage')).toEqual(expect.anything());
- assertMaxLength($longMessage);
- });
-
- it('should not truncate short messages', () => {
- const $shortMessage = findMessage('SHORT MESSAGE');
-
- expect($shortMessage.data('originalMessage')).not.toEqual(expect.anything());
- });
-
- it('should allow clicking a truncated message to expand and collapse the full message', () => {
- const $longMessage = findMessage('LONG MESSAGE');
- $longMessage.click();
-
- expect($longMessage.data('originalMessage').length).toEqual($longMessage.text().length);
- $longMessage.click();
- assertMaxLength($longMessage);
- });
-});
diff --git a/spec/frontend/pages/admin/jobs/components/cancel_jobs_modal_spec.js b/spec/frontend/pages/admin/jobs/components/cancel_jobs_modal_spec.js
deleted file mode 100644
index d90393d8ab3..00000000000
--- a/spec/frontend/pages/admin/jobs/components/cancel_jobs_modal_spec.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import { nextTick } from 'vue';
-import { mount } from '@vue/test-utils';
-import { GlModal } from '@gitlab/ui';
-import { TEST_HOST } from 'helpers/test_constants';
-import axios from '~/lib/utils/axios_utils';
-import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
-import CancelJobsModal from '~/pages/admin/jobs/components/cancel_jobs_modal.vue';
-import { setVueErrorHandler } from '../../../../__helpers__/set_vue_error_handler';
-
-jest.mock('~/lib/utils/url_utility', () => ({
- ...jest.requireActual('~/lib/utils/url_utility'),
- redirectTo: jest.fn(),
-}));
-
-describe('Cancel jobs modal', () => {
- const props = {
- url: `${TEST_HOST}/cancel_jobs_modal.vue/cancelAll`,
- modalId: 'cancel-jobs-modal',
- };
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount(CancelJobsModal, { propsData: props });
- });
-
- describe('on submit', () => {
- it('cancels jobs and redirects to overview page', async () => {
- const responseURL = `${TEST_HOST}/cancel_jobs_modal.vue/jobs`;
- // TODO: We can't use axios-mock-adapter because our current version
- // does not support responseURL
- //
- // see https://gitlab.com/gitlab-org/gitlab/-/issues/375308 for details
- jest.spyOn(axios, 'post').mockImplementation((url) => {
- expect(url).toBe(props.url);
- return Promise.resolve({
- request: {
- responseURL,
- },
- });
- });
-
- wrapper.findComponent(GlModal).vm.$emit('primary');
- await nextTick();
-
- expect(redirectTo).toHaveBeenCalledWith(responseURL); // eslint-disable-line import/no-deprecated
- });
-
- it('displays error if canceling jobs failed', async () => {
- const dummyError = new Error('canceling jobs failed');
- // TODO: We can't use axios-mock-adapter because our current version
- // does not support responseURL
- //
- // see https://gitlab.com/gitlab-org/gitlab/-/issues/375308 for details
- jest.spyOn(axios, 'post').mockImplementation((url) => {
- expect(url).toBe(props.url);
- return Promise.reject(dummyError);
- });
-
- setVueErrorHandler({ instance: wrapper.vm, handler: () => {} }); // silencing thrown error
- wrapper.findComponent(GlModal).vm.$emit('primary');
- await nextTick();
-
- expect(redirectTo).not.toHaveBeenCalled(); // eslint-disable-line import/no-deprecated
- });
- });
-});
diff --git a/spec/frontend/pages/admin/jobs/components/cancel_jobs_spec.js b/spec/frontend/pages/admin/jobs/components/cancel_jobs_spec.js
index d94de48f238..2884e4ed521 100644
--- a/spec/frontend/pages/admin/jobs/components/cancel_jobs_spec.js
+++ b/spec/frontend/pages/admin/jobs/components/cancel_jobs_spec.js
@@ -2,12 +2,9 @@ import { GlButton } from '@gitlab/ui';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { TEST_HOST } from 'helpers/test_constants';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
-import CancelJobs from '~/pages/admin/jobs/components/cancel_jobs.vue';
-import CancelJobsModal from '~/pages/admin/jobs/components/cancel_jobs_modal.vue';
-import {
- CANCEL_JOBS_MODAL_ID,
- CANCEL_BUTTON_TOOLTIP,
-} from '~/pages/admin/jobs/components/constants';
+import CancelJobs from '~/ci/admin/jobs_table/components/cancel_jobs.vue';
+import CancelJobsModal from '~/ci/admin/jobs_table/components/cancel_jobs_modal.vue';
+import { CANCEL_JOBS_MODAL_ID, CANCEL_BUTTON_TOOLTIP } from '~/ci/admin/jobs_table/constants';
describe('CancelJobs component', () => {
let wrapper;
diff --git a/spec/frontend/pages/admin/jobs/components/jobs_skeleton_loader_spec.js b/spec/frontend/pages/admin/jobs/components/jobs_skeleton_loader_spec.js
deleted file mode 100644
index 03e5cd75420..00000000000
--- a/spec/frontend/pages/admin/jobs/components/jobs_skeleton_loader_spec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { GlSkeletonLoader } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
-import JobsSkeletonLoader from '~/pages/admin/jobs/components/jobs_skeleton_loader.vue';
-
-describe('jobs_skeleton_loader.vue', () => {
- let wrapper;
-
- const findGlSkeletonLoader = () => wrapper.findComponent(GlSkeletonLoader);
-
- const WIDTH = '1248';
- const HEIGHT = '73';
-
- beforeEach(() => {
- wrapper = shallowMount(JobsSkeletonLoader);
- });
-
- it('renders a GlSkeletonLoader', () => {
- expect(findGlSkeletonLoader().exists()).toBe(true);
- });
-
- it('has correct width', () => {
- expect(findGlSkeletonLoader().attributes('width')).toBe(WIDTH);
- });
-
- it('has correct height', () => {
- expect(findGlSkeletonLoader().attributes('height')).toBe(HEIGHT);
- });
-});
diff --git a/spec/frontend/pages/admin/jobs/components/table/admin_job_table_app_spec.js b/spec/frontend/pages/admin/jobs/components/table/admin_job_table_app_spec.js
index 71ebf64f43c..d14b78d2f4d 100644
--- a/spec/frontend/pages/admin/jobs/components/table/admin_job_table_app_spec.js
+++ b/spec/frontend/pages/admin/jobs/components/table/admin_job_table_app_spec.js
@@ -4,17 +4,17 @@ import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
-import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue';
-import JobsSkeletonLoader from '~/pages/admin/jobs/components/jobs_skeleton_loader.vue';
-import getAllJobsQuery from '~/pages/admin/jobs/components/table/graphql/queries/get_all_jobs.query.graphql';
-import getAllJobsCount from '~/pages/admin/jobs/components/table/graphql/queries/get_all_jobs_count.query.graphql';
-import getCancelableJobsQuery from '~/pages/admin/jobs/components/table/graphql/queries/get_cancelable_jobs_count.query.graphql';
-import AdminJobsTableApp from '~/pages/admin/jobs/components/table/admin_jobs_table_app.vue';
-import CancelJobs from '~/pages/admin/jobs/components/cancel_jobs.vue';
-import JobsTable from '~/jobs/components/table/jobs_table.vue';
+import JobsTableTabs from '~/ci/jobs_page/components/jobs_table_tabs.vue';
+import JobsSkeletonLoader from '~/ci/admin/jobs_table/components/jobs_skeleton_loader.vue';
+import getAllJobsQuery from '~/ci/admin/jobs_table/graphql/queries/get_all_jobs.query.graphql';
+import getAllJobsCount from '~/ci/admin/jobs_table/graphql/queries/get_all_jobs_count.query.graphql';
+import getCancelableJobsQuery from '~/ci/admin/jobs_table/graphql/queries/get_cancelable_jobs_count.query.graphql';
+import AdminJobsTableApp from '~/ci/admin/jobs_table/admin_jobs_table_app.vue';
+import CancelJobs from '~/ci/admin/jobs_table/components/cancel_jobs.vue';
+import JobsTable from '~/ci/jobs_page/components/jobs_table.vue';
import { createAlert } from '~/alert';
import { TEST_HOST } from 'spec/test_constants';
-import JobsFilteredSearch from '~/jobs/components/filtered_search/jobs_filtered_search.vue';
+import JobsFilteredSearch from '~/ci/common/private/jobs_filtered_search/app.vue';
import * as urlUtils from '~/lib/utils/url_utility';
import {
JOBS_FETCH_ERROR_MSG,
@@ -22,7 +22,8 @@ import {
LOADING_ARIA_LABEL,
RAW_TEXT_WARNING_ADMIN,
JOBS_COUNT_ERROR_MESSAGE,
-} from '~/pages/admin/jobs/components/constants';
+} from '~/ci/admin/jobs_table/constants';
+import { TOKEN_TYPE_JOBS_RUNNER_TYPE } from '~/vue_shared/components/filtered_search_bar/constants';
import {
mockAllJobsResponsePaginated,
mockCancelableJobsCountResponse,
@@ -30,7 +31,7 @@ import {
statuses,
mockFailedSearchToken,
mockAllJobsCountResponse,
-} from '../../../../../jobs/mock_data';
+} from 'jest/ci/jobs_mock_data';
Vue.use(VueApollo);
@@ -54,6 +55,11 @@ describe('Job table app', () => {
const findCancelJobsButton = () => wrapper.findComponent(CancelJobs);
const findFilteredSearch = () => wrapper.findComponent(JobsFilteredSearch);
+ const mockSearchTokenRunnerType = {
+ type: TOKEN_TYPE_JOBS_RUNNER_TYPE,
+ value: { data: 'INSTANCE_TYPE', operator: '=' },
+ };
+
const triggerInfiniteScroll = () =>
wrapper.findComponent(GlIntersectionObserver).vm.$emit('appear');
@@ -73,6 +79,7 @@ describe('Job table app', () => {
countHandler = countSuccessHandler,
mountFn = shallowMount,
data = {},
+ provideOptions = {},
} = {}) => {
wrapper = mountFn(AdminJobsTableApp, {
data() {
@@ -82,6 +89,8 @@ describe('Job table app', () => {
},
provide: {
jobStatuses: statuses,
+ glFeatures: { adminJobsFilterRunnerType: true },
+ ...provideOptions,
},
apolloProvider: createMockApolloProvider(handler, cancelableHandler, countHandler),
});
@@ -304,24 +313,37 @@ describe('Job table app', () => {
},
);
- it('refetches jobs query when filtering', async () => {
- createComponent();
+ describe.each`
+ searchTokens | expectedQueryParams
+ ${[]} | ${{ runnerTypes: null, statuses: null }}
+ ${[mockFailedSearchToken]} | ${{ runnerTypes: null, statuses: 'FAILED' }}
+ ${[mockFailedSearchToken, mockSearchTokenRunnerType]} | ${{ runnerTypes: 'INSTANCE_TYPE', statuses: 'FAILED' }}
+ `('when filtering jobs by searchTokens', ({ searchTokens, expectedQueryParams }) => {
+ it(`refetches jobs query including filters ${JSON.stringify(
+ expectedQueryParams,
+ )}`, async () => {
+ createComponent();
- expect(successHandler).toHaveBeenCalledTimes(1);
+ expect(successHandler).toHaveBeenCalledTimes(1);
- await findFilteredSearch().vm.$emit('filterJobsBySearch', [mockFailedSearchToken]);
+ await findFilteredSearch().vm.$emit('filterJobsBySearch', searchTokens);
- expect(successHandler).toHaveBeenCalledTimes(2);
- });
+ expect(successHandler).toHaveBeenCalledTimes(2);
+ expect(successHandler).toHaveBeenNthCalledWith(2, { first: 50, ...expectedQueryParams });
+ });
- it('refetches jobs count query when filtering', async () => {
- createComponent();
+ it(`refetches jobs count query including filters ${JSON.stringify(
+ expectedQueryParams,
+ )}`, async () => {
+ createComponent();
- expect(countSuccessHandler).toHaveBeenCalledTimes(1);
+ expect(countSuccessHandler).toHaveBeenCalledTimes(1);
- await findFilteredSearch().vm.$emit('filterJobsBySearch', [mockFailedSearchToken]);
+ await findFilteredSearch().vm.$emit('filterJobsBySearch', searchTokens);
- expect(countSuccessHandler).toHaveBeenCalledTimes(2);
+ expect(countSuccessHandler).toHaveBeenCalledTimes(2);
+ expect(countSuccessHandler).toHaveBeenNthCalledWith(2, expectedQueryParams);
+ });
});
it('shows raw text warning when user inputs raw text', async () => {
@@ -364,6 +386,7 @@ describe('Job table app', () => {
expect(successHandler).toHaveBeenCalledWith({
first: 50,
statuses: 'FAILED',
+ runnerTypes: null,
});
expect(urlUtils.updateHistory).toHaveBeenCalledWith({
url: `${TEST_HOST}/?statuses=FAILED`,
@@ -378,6 +401,44 @@ describe('Job table app', () => {
expect(successHandler).toHaveBeenCalledWith({
first: 50,
statuses: null,
+ runnerTypes: null,
+ });
+ });
+
+ describe('when feature flag `adminJobsFilterRunnerType` is disabled', () => {
+ const provideOptions = { glFeatures: { adminJobsFilterRunnerType: false } };
+
+ describe.each`
+ searchTokens | expectedQueryParams
+ ${[]} | ${{ statuses: null }}
+ ${[mockFailedSearchToken]} | ${{ statuses: 'FAILED' }}
+ ${[mockFailedSearchToken, mockSearchTokenRunnerType]} | ${{ statuses: 'FAILED' }}
+ `('when filtering jobs by searchTokens', ({ searchTokens, expectedQueryParams }) => {
+ it(`refetches jobs query including filters ${JSON.stringify(
+ expectedQueryParams,
+ )}`, async () => {
+ createComponent({ provideOptions });
+
+ expect(successHandler).toHaveBeenCalledTimes(1);
+
+ await findFilteredSearch().vm.$emit('filterJobsBySearch', searchTokens);
+
+ expect(successHandler).toHaveBeenCalledTimes(2);
+ expect(successHandler).toHaveBeenNthCalledWith(2, { first: 50, ...expectedQueryParams });
+ });
+
+ it(`refetches jobs count query including filters ${JSON.stringify(
+ expectedQueryParams,
+ )}`, async () => {
+ createComponent({ provideOptions });
+
+ expect(countSuccessHandler).toHaveBeenCalledTimes(1);
+
+ await findFilteredSearch().vm.$emit('filterJobsBySearch', searchTokens);
+
+ expect(countSuccessHandler).toHaveBeenCalledTimes(2);
+ expect(countSuccessHandler).toHaveBeenNthCalledWith(2, expectedQueryParams);
+ });
});
});
});
diff --git a/spec/frontend/pages/admin/jobs/components/table/cells/project_cell_spec.js b/spec/frontend/pages/admin/jobs/components/table/cells/project_cell_spec.js
deleted file mode 100644
index 3366d60d9f3..00000000000
--- a/spec/frontend/pages/admin/jobs/components/table/cells/project_cell_spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import { GlLink } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
-import ProjectCell from '~/pages/admin/jobs/components/table/cell/project_cell.vue';
-import { mockAllJobsNodes } from '../../../../../../jobs/mock_data';
-
-const mockJob = mockAllJobsNodes[0];
-
-describe('Project cell', () => {
- let wrapper;
-
- const findProjectLink = () => wrapper.findComponent(GlLink);
-
- const createComponent = (props = {}) => {
- wrapper = shallowMount(ProjectCell, {
- propsData: {
- ...props,
- },
- });
- };
-
- describe('Project Link', () => {
- beforeEach(() => {
- createComponent({ job: mockJob });
- });
-
- it('shows and links to the project', () => {
- expect(findProjectLink().exists()).toBe(true);
- expect(findProjectLink().text()).toBe(mockJob.pipeline.project.fullPath);
- expect(findProjectLink().attributes('href')).toBe(mockJob.pipeline.project.webUrl);
- });
- });
-});
diff --git a/spec/frontend/pages/admin/jobs/components/table/cells/runner_cell_spec.js b/spec/frontend/pages/admin/jobs/components/table/cells/runner_cell_spec.js
deleted file mode 100644
index 2f76ad66dd5..00000000000
--- a/spec/frontend/pages/admin/jobs/components/table/cells/runner_cell_spec.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import { GlLink } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
-import RunnerCell from '~/pages/admin/jobs/components/table/cells/runner_cell.vue';
-import { RUNNER_EMPTY_TEXT } from '~/pages/admin/jobs/components/constants';
-import { allRunnersData } from '../../../../../../ci/runner/mock_data';
-
-const mockRunner = allRunnersData.data.runners.nodes[0];
-
-const mockJobWithRunner = {
- id: 'gid://gitlab/Ci::Build/2264',
- runner: mockRunner,
-};
-
-const mockJobWithoutRunner = {
- id: 'gid://gitlab/Ci::Build/2265',
-};
-
-describe('Runner Cell', () => {
- let wrapper;
-
- const findRunnerLink = () => wrapper.findComponent(GlLink);
- const findEmptyRunner = () => wrapper.find('[data-testid="empty-runner-text"]');
-
- const createComponent = (props = {}) => {
- wrapper = shallowMount(RunnerCell, {
- propsData: {
- ...props,
- },
- });
- };
-
- describe('Runner Link', () => {
- describe('Job with runner', () => {
- beforeEach(() => {
- createComponent({ job: mockJobWithRunner });
- });
-
- it('shows and links to the runner', () => {
- expect(findRunnerLink().exists()).toBe(true);
- expect(findRunnerLink().text()).toBe(mockRunner.description);
- expect(findRunnerLink().attributes('href')).toBe(mockRunner.adminUrl);
- });
-
- it('hides the empty runner text', () => {
- expect(findEmptyRunner().exists()).toBe(false);
- });
- });
-
- describe('Job without runner', () => {
- beforeEach(() => {
- createComponent({ job: mockJobWithoutRunner });
- });
-
- it('shows default `empty` text', () => {
- expect(findEmptyRunner().exists()).toBe(true);
- expect(findEmptyRunner().text()).toBe(RUNNER_EMPTY_TEXT);
- });
-
- it('hides the runner link', () => {
- expect(findRunnerLink().exists()).toBe(false);
- });
- });
- });
-});
diff --git a/spec/frontend/pages/admin/jobs/components/table/graphql/cache_config_spec.js b/spec/frontend/pages/admin/jobs/components/table/graphql/cache_config_spec.js
deleted file mode 100644
index 59e9eda6343..00000000000
--- a/spec/frontend/pages/admin/jobs/components/table/graphql/cache_config_spec.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import cacheConfig from '~/pages/admin/jobs/components/table/graphql/cache_config';
-import {
- CIJobConnectionExistingCache,
- CIJobConnectionIncomingCache,
- CIJobConnectionIncomingCacheRunningStatus,
-} from '../../../../../../jobs/mock_data';
-
-const firstLoadArgs = { first: 3, statuses: 'PENDING' };
-const runningArgs = { first: 3, statuses: 'RUNNING' };
-
-describe('jobs/components/table/graphql/cache_config', () => {
- describe('when fetching data with the same statuses', () => {
- it('should contain cache nodes and a status when merging caches on first load', () => {
- const res = cacheConfig.typePolicies.CiJobConnection.merge({}, CIJobConnectionIncomingCache, {
- args: firstLoadArgs,
- });
-
- expect(res.nodes).toHaveLength(CIJobConnectionIncomingCache.nodes.length);
- expect(res.statuses).toBe('PENDING');
- });
-
- it('should add to existing caches when merging caches after first load', () => {
- const res = cacheConfig.typePolicies.CiJobConnection.merge(
- CIJobConnectionExistingCache,
- CIJobConnectionIncomingCache,
- {
- args: firstLoadArgs,
- },
- );
-
- expect(res.nodes).toHaveLength(
- CIJobConnectionIncomingCache.nodes.length + CIJobConnectionExistingCache.nodes.length,
- );
- });
-
- it('should not add to existing cache if the incoming elements are the same', () => {
- // simulate that this is the last page
- const finalExistingCache = {
- ...CIJobConnectionExistingCache,
- pageInfo: {
- hasNextPage: false,
- },
- };
-
- const res = cacheConfig.typePolicies.CiJobConnection.merge(
- CIJobConnectionExistingCache,
- finalExistingCache,
- {
- args: firstLoadArgs,
- },
- );
-
- expect(res.nodes).toHaveLength(CIJobConnectionExistingCache.nodes.length);
- });
-
- it('should contain the pageInfo key as part of the result', () => {
- const res = cacheConfig.typePolicies.CiJobConnection.merge({}, CIJobConnectionIncomingCache, {
- args: firstLoadArgs,
- });
-
- expect(res.pageInfo).toEqual(
- expect.objectContaining({
- __typename: 'PageInfo',
- endCursor: 'eyJpZCI6IjIwNTEifQ',
- hasNextPage: true,
- hasPreviousPage: false,
- startCursor: 'eyJpZCI6IjIxNzMifQ',
- }),
- );
- });
- });
-
- describe('when fetching data with different statuses', () => {
- it('should reset cache when a cache already exists', () => {
- const res = cacheConfig.typePolicies.CiJobConnection.merge(
- CIJobConnectionExistingCache,
- CIJobConnectionIncomingCacheRunningStatus,
- {
- args: runningArgs,
- },
- );
-
- expect(res.nodes).not.toEqual(CIJobConnectionExistingCache.nodes);
- expect(res.nodes).toHaveLength(CIJobConnectionIncomingCacheRunningStatus.nodes.length);
- });
- });
-
- describe('when incoming data has no nodes', () => {
- it('should return existing cache', () => {
- const res = cacheConfig.typePolicies.CiJobConnection.merge(
- CIJobConnectionExistingCache,
- { __typename: 'CiJobConnection', count: 500 },
- {
- args: { statuses: 'SUCCESS' },
- },
- );
-
- const expectedResponse = {
- ...CIJobConnectionExistingCache,
- statuses: 'SUCCESS',
- };
-
- expect(res).toEqual(expectedResponse);
- });
- });
-});
diff --git a/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js b/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js
index 40d5dff9d06..50bc5bc590b 100644
--- a/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js
+++ b/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js
@@ -12,11 +12,7 @@ const BitbucketStatusTableStub = {
describe('BitbucketServerStatusTable', () => {
let wrapper;
- const findReconfigureButton = () =>
- wrapper
- .findAllComponents(GlButton)
- .filter((w) => w.props().variant === 'info')
- .at(0);
+ const findReconfigureButton = () => wrapper.findComponent(GlButton);
function createComponent(bitbucketStatusTableStub = true) {
wrapper = shallowMount(BitbucketServerStatusTable, {
diff --git a/spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js b/spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js
deleted file mode 100644
index e20c2fa47a7..00000000000
--- a/spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import { GlButton } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
-import { nextTick } from 'vue';
-import Cookies from '~/lib/utils/cookies';
-import PipelineSchedulesCallout from '~/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue';
-
-const cookieKey = 'pipeline_schedules_callout_dismissed';
-const docsUrl = 'help/ci/scheduled_pipelines';
-const illustrationUrl = 'pages/projects/pipeline_schedules/shared/icons/intro_illustration.svg';
-
-describe('Pipeline Schedule Callout', () => {
- let wrapper;
-
- const createComponent = () => {
- wrapper = shallowMount(PipelineSchedulesCallout, {
- provide: {
- docsUrl,
- illustrationUrl,
- },
- });
- };
-
- const findInnerContentOfCallout = () => wrapper.find('[data-testid="innerContent"]');
- const findDismissCalloutBtn = () => wrapper.findComponent(GlButton);
-
- describe(`when ${cookieKey} cookie is set`, () => {
- beforeEach(async () => {
- Cookies.set(cookieKey, true);
- createComponent();
-
- await nextTick();
- });
-
- it('does not render the callout', () => {
- expect(findInnerContentOfCallout().exists()).toBe(false);
- });
- });
-
- describe('when cookie is not set', () => {
- beforeEach(() => {
- Cookies.remove(cookieKey);
- createComponent();
- });
-
- it('renders the callout container', () => {
- expect(findInnerContentOfCallout().exists()).toBe(true);
- });
-
- it('renders the callout title', () => {
- expect(wrapper.find('h4').text()).toBe('Scheduling Pipelines');
- });
-
- it('renders the callout text', () => {
- expect(wrapper.find('p').text()).toContain('runs pipelines in the future');
- });
-
- it('renders the documentation url', () => {
- expect(wrapper.find('a').attributes('href')).toBe(docsUrl);
- });
-
- describe('methods', () => {
- it('#dismissCallout sets calloutDismissed to true', async () => {
- expect(wrapper.vm.calloutDismissed).toBe(false);
-
- findDismissCalloutBtn().vm.$emit('click');
-
- await nextTick();
-
- expect(findInnerContentOfCallout().exists()).toBe(false);
- });
-
- it('sets cookie on dismiss', () => {
- const setCookiesSpy = jest.spyOn(Cookies, 'set');
-
- findDismissCalloutBtn().vm.$emit('click');
-
- expect(setCookiesSpy).toHaveBeenCalledWith('pipeline_schedules_callout_dismissed', true, {
- expires: 365,
- secure: false,
- });
- });
- });
-
- it('is hidden when close button is clicked', async () => {
- findDismissCalloutBtn().vm.$emit('click');
-
- await nextTick();
-
- expect(findInnerContentOfCallout().exists()).toBe(false);
- });
- });
-});