diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-28 03:12:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-28 03:12:20 +0300 |
commit | e74c47fb1bd1c137145e19143b0f77cf420990f4 (patch) | |
tree | 1ea75375e2d46a0fcc107c336759454c24a332e4 /spec/frontend/ci | |
parent | e49c47d3bc5603e8e9d6ad40fc7fccae9f885843 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci')
4 files changed, 47 insertions, 5 deletions
diff --git a/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js b/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js index a454066b457..dd88720aab6 100644 --- a/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js +++ b/spec/frontend/ci/runner/admin_new_runner_app/admin_new_runner_app_spec.js @@ -5,6 +5,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createAlert, VARIANT_SUCCESS } from '~/alert'; import AdminNewRunnerApp from '~/ci/runner/admin_new_runner/admin_new_runner_app.vue'; +import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import { saveAlertToLocalStorage } from '~/ci/runner/local_storage_alert/save_alert_to_local_storage'; import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; import { @@ -30,6 +31,8 @@ describe('AdminNewRunnerApp', () => { let wrapper; const findRunnerPlatformsRadioGroup = () => wrapper.findComponent(RunnerPlatformsRadioGroup); + const findRegistrationCompatibilityAlert = () => + wrapper.findComponent(RegistrationCompatibilityAlert); const findRunnerCreateForm = () => wrapper.findComponent(RunnerCreateForm); const createComponent = () => { @@ -44,6 +47,10 @@ describe('AdminNewRunnerApp', () => { createComponent(); }); + it('shows a registration compatibility alert', () => { + expect(findRegistrationCompatibilityAlert().props('alertKey')).toBe(INSTANCE_TYPE); + }); + describe('Platform', () => { it('shows the platforms radio group', () => { expect(findRunnerPlatformsRadioGroup().props('value')).toBe(DEFAULT_PLATFORM); diff --git a/spec/frontend/ci/runner/components/registration/registration_compatibility_alert_spec.js b/spec/frontend/ci/runner/components/registration/registration_compatibility_alert_spec.js index ba8a1ac6744..75658270104 100644 --- a/spec/frontend/ci/runner/components/registration/registration_compatibility_alert_spec.js +++ b/spec/frontend/ci/runner/components/registration/registration_compatibility_alert_spec.js @@ -1,30 +1,51 @@ import { GlAlert, GlLink } from '@gitlab/ui'; +import DismissibleFeedbackAlert from '~/vue_shared/components/dismissible_feedback_alert.vue'; import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import { CHANGELOG_URL } from '~/ci/runner/constants'; import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper'; +const ALERT_KEY = 'ALERT_KEY'; + describe('RegistrationCompatibilityAlert', () => { let wrapper; + const findDismissibleFeedbackAlert = () => wrapper.findComponent(DismissibleFeedbackAlert); const findAlert = () => wrapper.findComponent(GlAlert); const findLink = () => wrapper.findComponent(GlLink); - const createComponent = (mountFn = shallowMountExtended) => { - wrapper = mountFn(RegistrationCompatibilityAlert); + const createComponent = ({ mountFn = shallowMountExtended, ...options } = {}) => { + wrapper = mountFn(RegistrationCompatibilityAlert, { + propsData: { + alertKey: ALERT_KEY, + }, + ...options, + }); }; - it('alert has warning appearance', () => { + it('configures a featureName', () => { createComponent(); + expect(findDismissibleFeedbackAlert().props('featureName')).toBe( + `new_runner_compatibility_${ALERT_KEY}`, + ); + }); + + it('alert has warning appearance', () => { + createComponent({ + stubs: { + DismissibleFeedbackAlert, + }, + }); + expect(findAlert().props()).toMatchObject({ - dismissible: false, + dismissible: true, variant: 'warning', title: expect.any(String), }); }); it('shows alert content and link', () => { - createComponent(mountExtended); + createComponent({ mountFn: mountExtended }); expect(findAlert().text()).not.toBe(''); expect(findLink().attributes('href')).toBe(CHANGELOG_URL); diff --git a/spec/frontend/ci/runner/group_new_runner_app/group_new_runner_app_spec.js b/spec/frontend/ci/runner/group_new_runner_app/group_new_runner_app_spec.js index add2e58045c..ef8a2df1478 100644 --- a/spec/frontend/ci/runner/group_new_runner_app/group_new_runner_app_spec.js +++ b/spec/frontend/ci/runner/group_new_runner_app/group_new_runner_app_spec.js @@ -5,6 +5,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createAlert, VARIANT_SUCCESS } from '~/alert'; import GroupRunnerRunnerApp from '~/ci/runner/group_new_runner/group_new_runner_app.vue'; +import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import { saveAlertToLocalStorage } from '~/ci/runner/local_storage_alert/save_alert_to_local_storage'; import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; import { @@ -32,6 +33,8 @@ describe('GroupRunnerRunnerApp', () => { let wrapper; const findRunnerPlatformsRadioGroup = () => wrapper.findComponent(RunnerPlatformsRadioGroup); + const findRegistrationCompatibilityAlert = () => + wrapper.findComponent(RegistrationCompatibilityAlert); const findRunnerCreateForm = () => wrapper.findComponent(RunnerCreateForm); const createComponent = () => { @@ -49,6 +52,10 @@ describe('GroupRunnerRunnerApp', () => { createComponent(); }); + it('shows a registration compatibility alert', () => { + expect(findRegistrationCompatibilityAlert().props('alertKey')).toBe(mockGroupId); + }); + describe('Platform', () => { it('shows the platforms radio group', () => { expect(findRunnerPlatformsRadioGroup().props('value')).toBe(DEFAULT_PLATFORM); diff --git a/spec/frontend/ci/runner/project_new_runner_app/project_new_runner_app_spec.js b/spec/frontend/ci/runner/project_new_runner_app/project_new_runner_app_spec.js index 14e36e74549..9a7a89feb4e 100644 --- a/spec/frontend/ci/runner/project_new_runner_app/project_new_runner_app_spec.js +++ b/spec/frontend/ci/runner/project_new_runner_app/project_new_runner_app_spec.js @@ -5,6 +5,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createAlert, VARIANT_SUCCESS } from '~/alert'; import ProjectRunnerRunnerApp from '~/ci/runner/project_new_runner/project_new_runner_app.vue'; +import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import { saveAlertToLocalStorage } from '~/ci/runner/local_storage_alert/save_alert_to_local_storage'; import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; import { @@ -32,6 +33,8 @@ describe('ProjectRunnerRunnerApp', () => { let wrapper; const findRunnerPlatformsRadioGroup = () => wrapper.findComponent(RunnerPlatformsRadioGroup); + const findRegistrationCompatibilityAlert = () => + wrapper.findComponent(RegistrationCompatibilityAlert); const findRunnerCreateForm = () => wrapper.findComponent(RunnerCreateForm); const createComponent = () => { @@ -50,6 +53,10 @@ describe('ProjectRunnerRunnerApp', () => { createComponent(); }); + it('shows a registration compatibility alert', () => { + expect(findRegistrationCompatibilityAlert().props('alertKey')).toBe(mockProjectId); + }); + describe('Platform', () => { it('shows the platforms radio group', () => { expect(findRunnerPlatformsRadioGroup().props('value')).toBe(DEFAULT_PLATFORM); |