diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-24 21:17:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-24 21:17:30 +0300 |
commit | 0bf82aa5cb3b1ed826dd5c0d46331e17aa60d9e9 (patch) | |
tree | ee5a760877cce0189cc8e765a912a06942f3e4de /spec/frontend/jobs | |
parent | efbf661c4224d481c57d0346e26983a805e5ec93 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jobs')
-rw-r--r-- | spec/frontend/jobs/components/table/jobs_table_tabs_spec.js | 19 | ||||
-rw-r--r-- | spec/frontend/jobs/mock_data.js | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/frontend/jobs/components/table/jobs_table_tabs_spec.js b/spec/frontend/jobs/components/table/jobs_table_tabs_spec.js index 70bcac82a3f..d20a732508a 100644 --- a/spec/frontend/jobs/components/table/jobs_table_tabs_spec.js +++ b/spec/frontend/jobs/components/table/jobs_table_tabs_spec.js @@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils'; import { trimText } from 'helpers/text_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue'; +import CancelJobs from '~/pages/admin/jobs/components/cancel_jobs.vue'; describe('Jobs Table Tabs', () => { let wrapper; @@ -12,6 +13,11 @@ describe('Jobs Table Tabs', () => { loading: false, }; + const adminProps = { + ...defaultProps, + showCancelAllJobsButton: true, + }; + const statuses = { success: 'SUCCESS', failed: 'FAILED', @@ -20,6 +26,7 @@ describe('Jobs Table Tabs', () => { const findAllTab = () => wrapper.findByTestId('jobs-all-tab'); const findFinishedTab = () => wrapper.findByTestId('jobs-finished-tab'); + const findCancelJobsButton = () => wrapper.findAllComponents(CancelJobs); const triggerTabChange = (index) => wrapper.findAllComponents(GlTab).at(index).vm.$emit('click'); @@ -59,4 +66,16 @@ describe('Jobs Table Tabs', () => { expect(wrapper.emitted()).toEqual({ fetchJobsByStatus: [[expectedScope]] }); }); + + it('does not displays cancel all jobs button', () => { + expect(findCancelJobsButton().exists()).toBe(false); + }); + + describe('admin mode', () => { + it('displays cancel all jobs button', () => { + createComponent(adminProps); + + expect(findCancelJobsButton().exists()).toBe(true); + }); + }); }); diff --git a/spec/frontend/jobs/mock_data.js b/spec/frontend/jobs/mock_data.js index fb1ded7b4ef..ed89221d062 100644 --- a/spec/frontend/jobs/mock_data.js +++ b/spec/frontend/jobs/mock_data.js @@ -5,6 +5,7 @@ import mockAllJobsPaginated from 'test_fixtures/graphql/jobs/get_all_jobs.query. import mockJobs from 'test_fixtures/graphql/jobs/get_jobs.query.graphql.json'; import mockAllJobs from 'test_fixtures/graphql/jobs/get_all_jobs.query.graphql.json'; import mockJobsAsGuest from 'test_fixtures/graphql/jobs/get_jobs.query.graphql.as_guest.json'; +import mockCancelableJobsCount from 'test_fixtures/graphql/jobs/get_cancelable_jobs_count.query.graphql.json'; import { TEST_HOST } from 'spec/test_constants'; import { TOKEN_TYPE_STATUS } from '~/vue_shared/components/filtered_search_bar/constants'; @@ -19,6 +20,7 @@ export const mockJobsNodes = mockJobs.data.project.jobs.nodes; export const mockAllJobsNodes = mockAllJobs.data.jobs.nodes; export const mockJobsNodesAsGuest = mockJobsAsGuest.data.project.jobs.nodes; export const mockJobsCountResponse = mockJobsCount; +export const mockCancelableJobsCountResponse = mockCancelableJobsCount; export const stages = [ { |