diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-22 18:09:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-22 18:09:14 +0300 |
commit | 3a8d221b7e3dc909876fe60ac267e63d1ffffdd7 (patch) | |
tree | 413b11d1687aa52f8929dda7fbca655ff9938a0b /spec/frontend/ci | |
parent | a27c21b5af4f60ff11706f85289065272c616a0c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci')
3 files changed, 65 insertions, 156 deletions
diff --git a/spec/frontend/ci/runner/components/registration/registration_dropdown_spec.js b/spec/frontend/ci/runner/components/registration/registration_dropdown_spec.js index e564cf49ca0..864b29782d4 100644 --- a/spec/frontend/ci/runner/components/registration/registration_dropdown_spec.js +++ b/spec/frontend/ci/runner/components/registration/registration_dropdown_spec.js @@ -41,7 +41,9 @@ describe('RegistrationDropdown', () => { const findTokenDropdownItem = () => wrapper.findComponent(GlDropdownForm); const findRegistrationToken = () => wrapper.findComponent(RegistrationToken); const findRegistrationTokenInput = () => - wrapper.findByLabelText(RegistrationToken.i18n.registrationToken); + wrapper.findByLabelText( + `${RegistrationToken.i18n.registrationToken} ${RegistrationDropdown.i18n.supportForRegistrationTokensDeprecated}`, + ); const findTokenResetDropdownItem = () => wrapper.findComponent(RegistrationTokenResetDropdownItem); const findModal = () => wrapper.findComponent(GlModal); @@ -107,12 +109,12 @@ describe('RegistrationDropdown', () => { createComponent(); expect(findDropdown().props()).toMatchObject({ - category: 'primary', - variant: 'confirm', + category: 'tertiary', + variant: 'default', }); expect(findDropdown().attributes()).toMatchObject({ - toggleclass: '', + toggleclass: 'gl-px-3!', }); }); @@ -217,14 +219,9 @@ describe('RegistrationDropdown', () => { }); }); - describe.each([ - { createRunnerWorkflowForAdmin: true }, - { createRunnerWorkflowForNamespace: true }, - ])('When showing a "deprecated" warning', (glFeatures) => { + describe('When showing a "deprecated" warning', () => { it('passes deprecated variant props and attributes to dropdown', () => { - createComponent({ - provide: { glFeatures }, - }); + createComponent(); expect(findDropdown().props()).toMatchObject({ category: 'tertiary', @@ -249,12 +246,7 @@ describe('RegistrationDropdown', () => { }); it('shows warning text', () => { - createComponent( - { - provide: { glFeatures }, - }, - mountExtended, - ); + createComponent({}, mountExtended); const text = wrapper.findByText(s__('Runners|Support for registration tokens is deprecated')); @@ -262,12 +254,7 @@ describe('RegistrationDropdown', () => { }); it('button shows ellipsis icon', () => { - createComponent( - { - provide: { glFeatures }, - }, - mountExtended, - ); + createComponent({}, mountExtended); expect(findDropdownBtn().findComponent(GlIcon).props('name')).toBe('ellipsis_v'); expect(findDropdownBtn().findAllComponents(GlIcon)).toHaveLength(1); diff --git a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js index 22797433b58..511ed88f5ab 100644 --- a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js +++ b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js @@ -10,7 +10,6 @@ import { I18N_CREATE_RUNNER_LINK, I18N_STILL_USING_REGISTRATION_TOKENS, I18N_CONTACT_ADMIN_TO_REGISTER, - I18N_FOLLOW_REGISTRATION_INSTRUCTIONS, I18N_NO_RESULTS, I18N_EDIT_YOUR_SEARCH, } from '~/ci/runner/constants'; @@ -59,136 +58,84 @@ describe('RunnerListEmptyState', () => { }); describe('when search is not filtered', () => { - describe.each([ - { createRunnerWorkflowForAdmin: true }, - { createRunnerWorkflowForNamespace: true }, - ])('when createRunnerWorkflow is enabled by %o', (currentGlFeatures) => { - beforeEach(() => { - glFeatures = currentGlFeatures; - }); - - describe.each` - newRunnerPath | registrationToken | expectedMessages - ${mockNewRunnerPath} | ${mockRegistrationToken} | ${[I18N_CREATE_RUNNER_LINK, I18N_STILL_USING_REGISTRATION_TOKENS]} - ${mockNewRunnerPath} | ${null} | ${[I18N_CREATE_RUNNER_LINK]} - ${null} | ${mockRegistrationToken} | ${[I18N_STILL_USING_REGISTRATION_TOKENS]} - ${null} | ${null} | ${[I18N_CONTACT_ADMIN_TO_REGISTER]} - `( - 'when newRunnerPath is $newRunnerPath and registrationToken is $registrationToken', - ({ newRunnerPath, registrationToken, expectedMessages }) => { - beforeEach(() => { - createComponent({ - props: { - newRunnerPath, - registrationToken, - }, - }); - }); - - it('shows title', () => { - expectTitleToBe(I18N_GET_STARTED); - }); - - it('renders an illustration', () => { - expect(findEmptyState().props('svgPath')).toBe(EMPTY_STATE_SVG_URL); - }); - - it(`shows description: "${expectedMessages.join(' ')}"`, () => { - expectDescriptionToBe([I18N_RUNNERS_ARE_AGENTS, ...expectedMessages]); - }); - }, - ); - - describe('with newRunnerPath and registration token', () => { + describe.each` + newRunnerPath | registrationToken | expectedMessages + ${mockNewRunnerPath} | ${mockRegistrationToken} | ${[I18N_CREATE_RUNNER_LINK, I18N_STILL_USING_REGISTRATION_TOKENS]} + ${mockNewRunnerPath} | ${null} | ${[I18N_CREATE_RUNNER_LINK]} + ${null} | ${mockRegistrationToken} | ${[I18N_STILL_USING_REGISTRATION_TOKENS]} + ${null} | ${null} | ${[I18N_CONTACT_ADMIN_TO_REGISTER]} + `( + 'when newRunnerPath is $newRunnerPath and registrationToken is $registrationToken', + ({ newRunnerPath, registrationToken, expectedMessages }) => { beforeEach(() => { createComponent({ props: { - registrationToken: mockRegistrationToken, - newRunnerPath: mockNewRunnerPath, + newRunnerPath, + registrationToken, }, }); }); - it('shows links to the new runner page and registration instructions', () => { - expect(findLinks().at(0).attributes('href')).toBe(mockNewRunnerPath); + it('shows title', () => { + expectTitleToBe(I18N_GET_STARTED); + }); - const { value } = getBinding(findLinks().at(1).element, 'gl-modal'); - expect(findRunnerInstructionsModal().props('modalId')).toEqual(value); + it('renders an illustration', () => { + expect(findEmptyState().props('svgPath')).toBe(EMPTY_STATE_SVG_URL); }); - }); - describe('with newRunnerPath and no registration token', () => { - beforeEach(() => { - createComponent({ - props: { - registrationToken: mockRegistrationToken, - newRunnerPath: null, - }, - }); + it(`shows description: "${expectedMessages.join(' ')}"`, () => { + expectDescriptionToBe([I18N_RUNNERS_ARE_AGENTS, ...expectedMessages]); }); + }, + ); - it('opens a runner registration instructions modal with a link', () => { - const { value } = getBinding(findLink().element, 'gl-modal'); - expect(findRunnerInstructionsModal().props('modalId')).toEqual(value); + describe('with newRunnerPath and registration token', () => { + beforeEach(() => { + createComponent({ + props: { + registrationToken: mockRegistrationToken, + newRunnerPath: mockNewRunnerPath, + }, }); }); - describe('with no newRunnerPath nor registration token', () => { - beforeEach(() => { - createComponent({ - props: { - registrationToken: null, - newRunnerPath: null, - }, - }); - }); + it('shows links to the new runner page and registration instructions', () => { + expect(findLinks().at(0).attributes('href')).toBe(mockNewRunnerPath); - it('has no link', () => { - expect(findLink().exists()).toBe(false); - }); + const { value } = getBinding(findLinks().at(1).element, 'gl-modal'); + expect(findRunnerInstructionsModal().props('modalId')).toEqual(value); }); }); - describe('when createRunnerWorkflow is disabled', () => { - describe('when there is a registration token', () => { - beforeEach(() => { - createComponent({ - props: { - registrationToken: mockRegistrationToken, - }, - }); - }); - - it('renders an illustration', () => { - expect(findEmptyState().props('svgPath')).toBe(EMPTY_STATE_SVG_URL); - }); - - it('opens a runner registration instructions modal with a link', () => { - const { value } = getBinding(findLink().element, 'gl-modal'); - expect(findRunnerInstructionsModal().props('modalId')).toEqual(value); - }); - - it('displays text with registration instructions', () => { - expectTitleToBe(I18N_GET_STARTED); - - expectDescriptionToBe([I18N_RUNNERS_ARE_AGENTS, I18N_FOLLOW_REGISTRATION_INSTRUCTIONS]); + describe('with newRunnerPath and no registration token', () => { + beforeEach(() => { + createComponent({ + props: { + registrationToken: mockRegistrationToken, + newRunnerPath: null, + }, }); }); - describe('when there is no registration token', () => { - beforeEach(() => { - createComponent({ props: { registrationToken: null } }); - }); - - it('displays "contact admin" text', () => { - expectTitleToBe(I18N_GET_STARTED); + it('opens a runner registration instructions modal with a link', () => { + const { value } = getBinding(findLink().element, 'gl-modal'); + expect(findRunnerInstructionsModal().props('modalId')).toEqual(value); + }); + }); - expectDescriptionToBe([I18N_RUNNERS_ARE_AGENTS, I18N_CONTACT_ADMIN_TO_REGISTER]); + describe('with no newRunnerPath nor registration token', () => { + beforeEach(() => { + createComponent({ + props: { + registrationToken: null, + newRunnerPath: null, + }, }); + }); - it('has no registration instructions link', () => { - expect(findLink().exists()).toBe(false); - }); + it('has no link', () => { + expect(findLink().exists()).toBe(false); }); }); }); diff --git a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js index 74eeb864cd8..f3d7ae85e0d 100644 --- a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js +++ b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js @@ -483,35 +483,15 @@ describe('GroupRunnersApp', () => { expect(findRegistrationDropdown().exists()).toBe(true); }); - it('when create_runner_workflow_for_namespace is enabled', () => { + it('shows the create runner button', () => { createComponent({ props: { newRunnerPath, }, - provide: { - glFeatures: { - createRunnerWorkflowForNamespace: true, - }, - }, }); expect(findNewRunnerBtn().attributes('href')).toBe(newRunnerPath); }); - - it('when create_runner_workflow_for_namespace is disabled', () => { - createComponent({ - props: { - newRunnerPath, - }, - provide: { - glFeatures: { - createRunnerWorkflowForNamespace: false, - }, - }, - }); - - expect(findNewRunnerBtn().exists()).toBe(false); - }); }); describe('when user has no permission to register group runner', () => { @@ -524,16 +504,11 @@ describe('GroupRunnersApp', () => { expect(findRegistrationDropdown().exists()).toBe(false); }); - it('when create_runner_workflow_for_namespace is enabled', () => { + it('shows the create runner button', () => { createComponent({ props: { newRunnerPath: null, }, - provide: { - glFeatures: { - createRunnerWorkflowForNamespace: true, - }, - }, }); expect(findNewRunnerBtn().exists()).toBe(false); |