diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-03 21:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-03 21:08:58 +0300 |
commit | 7c8468c5ba828e1c1afe6ba0b25c77c130a69413 (patch) | |
tree | 3104d62bff9040a19756b9d407003eed14314f77 /spec | |
parent | 2a7fd3827b0838a900399b0c3440942cdaa09c75 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
25 files changed, 381 insertions, 59 deletions
diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 23a9ab74a7a..66014e676d5 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe "Admin Health Check", :js, feature_category: :continuous_verification do +RSpec.describe "Admin Health Check", :js, feature_category: :error_budgets do include StubENV include Spec::Support::Helpers::ModalHelpers let_it_be(:admin) { create(:admin) } diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index d6507e68692..34208cca113 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Admin::HookLogs', feature_category: :continuous_verification do +RSpec.describe 'Admin::HookLogs', feature_category: :integrations do let_it_be(:system_hook) { create(:system_hook) } let_it_be(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') } let_it_be(:admin) { create(:admin) } diff --git a/spec/features/boards/board_filters_spec.rb b/spec/features/boards/board_filters_spec.rb index dee63be8119..006b7ce45d4 100644 --- a/spec/features/boards/board_filters_spec.rb +++ b/spec/features/boards/board_filters_spec.rb @@ -50,7 +50,7 @@ RSpec.describe 'Issue board filters', :js, feature_category: :team_planning do set_filter('assignee') end - it_behaves_like 'loads all the users when opened' do + it_behaves_like 'loads all the users when opened', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/351426' do let(:issue) { issue_2 } end end diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index 4f6ce6e8f71..caf13c4111b 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User can display performance bar', :js, feature_category: :continuous_verification do +RSpec.describe 'User can display performance bar', :js, feature_category: :application_performance do shared_examples 'performance bar cannot be displayed' do it 'does not show the performance bar by default' do expect(page).not_to have_css('#js-peek') diff --git a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/rules_item_spec.js b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/rules_item_spec.js new file mode 100644 index 00000000000..659ccb25996 --- /dev/null +++ b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/rules_item_spec.js @@ -0,0 +1,70 @@ +import RulesItem from '~/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/rules_item.vue'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import { + JOB_TEMPLATE, + JOB_RULES_WHEN, + JOB_RULES_START_IN, +} from '~/ci/pipeline_editor/components/job_assistant_drawer/constants'; + +describe('Rules item', () => { + let wrapper; + + const findRulesWhenSelect = () => wrapper.findByTestId('rules-when-select'); + const findRulesStartInNumberInput = () => wrapper.findByTestId('rules-start-in-number-input'); + const findRulesStartInUnitSelect = () => wrapper.findByTestId('rules-start-in-unit-select'); + const findRulesAllowFailureCheckBox = () => wrapper.findByTestId('rules-allow-failure-checkbox'); + + const dummyRulesWhen = JOB_RULES_WHEN.delayed.value; + const dummyRulesStartInNumber = 2; + const dummyRulesStartInUnit = JOB_RULES_START_IN.week.value; + const dummyRulesAllowFailure = true; + + const createComponent = () => { + wrapper = shallowMountExtended(RulesItem, { + propsData: { + isStartValid: true, + job: JSON.parse(JSON.stringify(JOB_TEMPLATE)), + }, + }); + }; + + beforeEach(() => { + createComponent(); + }); + + it('should emit update job event when filling inputs', () => { + expect(wrapper.emitted('update-job')).toBeUndefined(); + + findRulesWhenSelect().vm.$emit('input', dummyRulesWhen); + + expect(wrapper.emitted('update-job')).toHaveLength(1); + expect(wrapper.emitted('update-job')[0]).toEqual([ + 'rules[0].when', + JOB_RULES_WHEN.delayed.value, + ]); + + findRulesStartInNumberInput().vm.$emit('input', dummyRulesStartInNumber); + + expect(wrapper.emitted('update-job')).toHaveLength(2); + expect(wrapper.emitted('update-job')[1]).toEqual([ + 'rules[0].start_in', + `2 ${JOB_RULES_START_IN.second.value}s`, + ]); + + findRulesStartInUnitSelect().vm.$emit('input', dummyRulesStartInUnit); + + expect(wrapper.emitted('update-job')).toHaveLength(3); + expect(wrapper.emitted('update-job')[2]).toEqual([ + 'rules[0].start_in', + `2 ${dummyRulesStartInUnit}s`, + ]); + + findRulesAllowFailureCheckBox().vm.$emit('input', dummyRulesAllowFailure); + + expect(wrapper.emitted('update-job')).toHaveLength(4); + expect(wrapper.emitted('update-job')[3]).toEqual([ + 'rules[0].allow_failure', + dummyRulesAllowFailure, + ]); + }); +}); diff --git a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js index 356de5b11e9..e03cd19da65 100644 --- a/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer_spec.js @@ -5,6 +5,8 @@ import { stringify } from 'yaml'; import JobAssistantDrawer from '~/ci/pipeline_editor/components/job_assistant_drawer/job_assistant_drawer.vue'; import JobSetupItem from '~/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/job_setup_item.vue'; import ImageItem from '~/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/image_item.vue'; +import RulesItem from '~/ci/pipeline_editor/components/job_assistant_drawer/accordion_items/rules_item.vue'; +import { JOB_RULES_WHEN } from '~/ci/pipeline_editor/components/job_assistant_drawer/constants'; import getRunnerTags from '~/ci/pipeline_editor/graphql/queries/runner_tags.query.graphql'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; @@ -23,10 +25,14 @@ describe('Job assistant drawer', () => { const dummyJobScript = 'b'; const dummyImageName = 'c'; const dummyImageEntrypoint = 'd'; + const dummyRulesWhen = JOB_RULES_WHEN.delayed.value; + const dummyRulesStartIn = '1 second'; + const dummyRulesAllowFailure = true; const findDrawer = () => wrapper.findComponent(GlDrawer); const findJobSetupItem = () => wrapper.findComponent(JobSetupItem); const findImageItem = () => wrapper.findComponent(ImageItem); + const findRulesItem = () => wrapper.findComponent(RulesItem); const findConfirmButton = () => wrapper.findByTestId('confirm-button'); const findCancelButton = () => wrapper.findByTestId('cancel-button'); @@ -68,6 +74,10 @@ describe('Job assistant drawer', () => { expect(findImageItem().exists()).toBe(true); }); + it('should contain rules accordion', () => { + expect(findRulesItem().exists()).toBe(true); + }); + it('should emit close job assistant drawer event when closing the drawer', () => { expect(wrapper.emitted('close-job-assistant-drawer')).toBeUndefined(); @@ -84,7 +94,7 @@ describe('Job assistant drawer', () => { expect(wrapper.emitted('close-job-assistant-drawer')).toHaveLength(1); }); - it('trigger validate if job name is empty', async () => { + it('should block submit if job name is empty', async () => { findJobSetupItem().vm.$emit('update-job', 'script', 'b'); findConfirmButton().trigger('click'); @@ -95,12 +105,25 @@ describe('Job assistant drawer', () => { expect(wrapper.emitted('updateCiConfig')).toBeUndefined(); }); + it('should block submit if rules when is delayed and start in is out of range', async () => { + findRulesItem().vm.$emit('update-job', 'rules[0].when', JOB_RULES_WHEN.delayed.value); + findRulesItem().vm.$emit('update-job', 'rules[0].start_in', '2 weeks'); + findConfirmButton().trigger('click'); + + await nextTick(); + + expect(wrapper.emitted('updateCiConfig')).toBeUndefined(); + }); + describe('when enter valid input', () => { beforeEach(() => { findJobSetupItem().vm.$emit('update-job', 'name', dummyJobName); findJobSetupItem().vm.$emit('update-job', 'script', dummyJobScript); findImageItem().vm.$emit('update-job', 'image.name', dummyImageName); findImageItem().vm.$emit('update-job', 'image.entrypoint', [dummyImageEntrypoint]); + findRulesItem().vm.$emit('update-job', 'rules[0].allow_failure', dummyRulesAllowFailure); + findRulesItem().vm.$emit('update-job', 'rules[0].when', dummyRulesWhen); + findRulesItem().vm.$emit('update-job', 'rules[0].start_in', dummyRulesStartIn); }); it('passes correct prop to accordions', () => { @@ -113,6 +136,13 @@ describe('Job assistant drawer', () => { name: dummyImageName, entrypoint: [dummyImageEntrypoint], }, + rules: [ + { + allow_failure: dummyRulesAllowFailure, + when: dummyRulesWhen, + start_in: dummyRulesStartIn, + }, + ], }); }); }); @@ -138,6 +168,24 @@ describe('Job assistant drawer', () => { expect(findJobSetupItem().props('job')).toMatchObject({ name: '', script: '' }); }); + it('should omit keys with default value when click add button', () => { + findRulesItem().vm.$emit('update-job', 'rules[0].allow_failure', false); + findRulesItem().vm.$emit('update-job', 'rules[0].when', JOB_RULES_WHEN.onSuccess.value); + findRulesItem().vm.$emit('update-job', 'rules[0].start_in', dummyRulesStartIn); + findConfirmButton().trigger('click'); + + expect(wrapper.emitted('updateCiConfig')).toStrictEqual([ + [ + `${wrapper.props('ciFileContent')}\n${stringify({ + [dummyJobName]: { + script: dummyJobScript, + image: { name: dummyImageName, entrypoint: [dummyImageEntrypoint] }, + }, + })}`, + ], + ]); + }); + it('should update correct ci content when click add button', () => { findConfirmButton().trigger('click'); @@ -147,6 +195,13 @@ describe('Job assistant drawer', () => { [dummyJobName]: { script: dummyJobScript, image: { name: dummyImageName, entrypoint: [dummyImageEntrypoint] }, + rules: [ + { + allow_failure: dummyRulesAllowFailure, + when: dummyRulesWhen, + start_in: dummyRulesStartIn, + }, + ], }, })}`, ], diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index 2ccf2c0392f..8cd651c5b36 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -67,7 +67,7 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do end end - describe 'Storage', feature_category: :subscription_cost_management do + describe 'Storage', feature_category: :consumables_cost_management do describe GraphQL::Query, type: :request do include GraphqlHelpers context 'project storage statistics query' do diff --git a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js index 60bb055b1db..6cfc80966b5 100644 --- a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js @@ -1,9 +1,11 @@ -import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui'; +import { GlButton, GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui'; import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; +import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; +import { s__ } from '~/locale'; import { WORKSPACE_GROUP, WORKSPACE_PROJECT } from '~/issues/constants'; import ListPage from '~/packages_and_registries/package_registry/pages/list.vue'; import PackageTitle from '~/packages_and_registries/package_registry/components/list/package_title.vue'; @@ -30,6 +32,7 @@ describe('PackagesListApp', () => { emptyListIllustration: 'emptyListIllustration', isGroupPage: true, fullPath: 'gitlab-org', + settingsPath: 'settings-path', }; const PackageList = { @@ -49,6 +52,7 @@ describe('PackagesListApp', () => { const findListComponent = () => wrapper.findComponent(PackageList); const findEmptyState = () => wrapper.findComponent(GlEmptyState); const findDeletePackages = () => wrapper.findComponent(DeletePackages); + const findSettingsLink = () => wrapper.findComponent(GlButton); const mountComponent = ({ resolver = jest.fn().mockResolvedValue(packagesListQuery()), @@ -71,9 +75,13 @@ describe('PackagesListApp', () => { GlLoadingIcon, GlSprintf, GlLink, + PackageTitle, PackageList, DeletePackages, }, + directives: { + GlTooltip: createMockDirective('gl-tooltip'), + }, }); }; @@ -103,6 +111,52 @@ describe('PackagesListApp', () => { }); }); + describe('link to settings', () => { + describe('when settings path is not provided', () => { + beforeEach(() => { + mountComponent({ + provide: { + ...defaultProvide, + settingsPath: '', + }, + }); + }); + + it('is not rendered', () => { + expect(findSettingsLink().exists()).toBe(false); + }); + }); + + describe('when settings path is provided', () => { + const label = s__('PackageRegistry|Configure in settings'); + + beforeEach(() => { + mountComponent(); + }); + + it('is rendered', () => { + expect(findSettingsLink().exists()).toBe(true); + }); + + it('has the right icon', () => { + expect(findSettingsLink().props('icon')).toBe('settings'); + }); + + it('has the right attributes', () => { + expect(findSettingsLink().attributes()).toMatchObject({ + 'aria-label': label, + href: defaultProvide.settingsPath, + }); + }); + + it('sets tooltip with right label', () => { + const tooltip = getBinding(findSettingsLink().element, 'gl-tooltip'); + + expect(tooltip.value).toBe(label); + }); + }); + }); + describe('search component', () => { it('exists', () => { mountComponent(); diff --git a/spec/frontend/projects/commit/components/branches_dropdown_spec.js b/spec/frontend/projects/commit/components/branches_dropdown_spec.js index 0e68bd21cd4..5210abe154d 100644 --- a/spec/frontend/projects/commit/components/branches_dropdown_spec.js +++ b/spec/frontend/projects/commit/components/branches_dropdown_spec.js @@ -68,13 +68,11 @@ describe('BranchesDropdown', () => { describe('When searching', () => { it('invokes fetchBranches', async () => { - const spy = jest.spyOn(wrapper.vm, 'fetchBranches'); - findDropdown().vm.$emit('search', '_anything_'); await nextTick(); - expect(spy).toHaveBeenCalledWith('_anything_'); + expect(spyFetchBranches).toHaveBeenCalledWith(expect.any(Object), '_anything_'); }); }); }); diff --git a/spec/frontend/sidebar/components/subscriptions/subscriptions_spec.js b/spec/frontend/sidebar/components/subscriptions/subscriptions_spec.js index cae21189ee0..b644b7a9421 100644 --- a/spec/frontend/sidebar/components/subscriptions/subscriptions_spec.js +++ b/spec/frontend/sidebar/components/subscriptions/subscriptions_spec.js @@ -1,23 +1,24 @@ import { GlToggle } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import { mockTracking } from 'helpers/tracking_helper'; import Subscriptions from '~/sidebar/components/subscriptions/subscriptions.vue'; import eventHub from '~/sidebar/event_hub'; describe('Subscriptions', () => { let wrapper; + let trackingSpy; const findToggleButton = () => wrapper.findComponent(GlToggle); + const findTooltip = () => wrapper.findComponent({ ref: 'tooltip' }); - const mountComponent = (propsData) => - extendedWrapper( - shallowMount(Subscriptions, { - propsData, - }), - ); + const mountComponent = (propsData) => { + wrapper = shallowMountExtended(Subscriptions, { + propsData, + }); + }; it('shows loading spinner when loading', () => { - wrapper = mountComponent({ + mountComponent({ loading: true, subscribed: undefined, }); @@ -26,7 +27,7 @@ describe('Subscriptions', () => { }); it('is toggled "off" when currently not subscribed', () => { - wrapper = mountComponent({ + mountComponent({ subscribed: false, }); @@ -34,7 +35,7 @@ describe('Subscriptions', () => { }); it('is toggled "on" when currently subscribed', () => { - wrapper = mountComponent({ + mountComponent({ subscribed: true, }); @@ -43,44 +44,38 @@ describe('Subscriptions', () => { it('toggleSubscription method emits `toggleSubscription` event on eventHub and Component', () => { const id = 42; - wrapper = mountComponent({ subscribed: true, id }); + mountComponent({ subscribed: true, id }); const eventHubSpy = jest.spyOn(eventHub, '$emit'); - const wrapperEmitSpy = jest.spyOn(wrapper.vm, '$emit'); - wrapper.vm.toggleSubscription(); + findToggleButton().vm.$emit('change'); expect(eventHubSpy).toHaveBeenCalledWith('toggleSubscription', id); - expect(wrapperEmitSpy).toHaveBeenCalledWith('toggleSubscription', id); - eventHubSpy.mockRestore(); - wrapperEmitSpy.mockRestore(); + expect(wrapper.emitted('toggleSubscription')).toEqual([[id]]); }); it('tracks the event when toggled', () => { - wrapper = mountComponent({ subscribed: true }); - - const wrapperTrackSpy = jest.spyOn(wrapper.vm, 'track'); + trackingSpy = mockTracking('_category_', undefined, jest.spyOn); + mountComponent({ subscribed: true }); - wrapper.vm.toggleSubscription(); + findToggleButton().vm.$emit('change'); - expect(wrapperTrackSpy).toHaveBeenCalledWith('toggle_button', { + expect(trackingSpy).toHaveBeenCalledWith(undefined, 'toggle_button', { + category: undefined, + label: 'right_sidebar', property: 'notifications', value: 0, }); - wrapperTrackSpy.mockRestore(); }); it('onClickCollapsedIcon method emits `toggleSidebar` event on component', () => { - wrapper = mountComponent({ subscribed: true }); - const spy = jest.spyOn(wrapper.vm, '$emit'); - - wrapper.vm.onClickCollapsedIcon(); + mountComponent({ subscribed: true }); + findTooltip().trigger('click'); - expect(spy).toHaveBeenCalledWith('toggleSidebar'); - spy.mockRestore(); + expect(wrapper.emitted('toggleSidebar')).toHaveLength(1); }); it('has visually hidden label', () => { - wrapper = mountComponent(); + mountComponent(); expect(findToggleButton().props()).toMatchObject({ label: 'Notifications', @@ -92,7 +87,7 @@ describe('Subscriptions', () => { const subscribeDisabledDescription = 'Notifications have been disabled'; beforeEach(() => { - wrapper = mountComponent({ + mountComponent({ subscribed: false, projectEmailsDisabled: true, subscribeDisabledDescription, @@ -103,9 +98,7 @@ describe('Subscriptions', () => { expect(wrapper.findByTestId('subscription-title').text()).toContain( subscribeDisabledDescription, ); - expect(wrapper.findComponent({ ref: 'tooltip' }).attributes('title')).toBe( - subscribeDisabledDescription, - ); + expect(findTooltip().attributes('title')).toBe(subscribeDisabledDescription); }); it('does not render the toggle button', () => { diff --git a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js index 7bda37bcaa8..3964d895b4b 100644 --- a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js +++ b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js @@ -346,6 +346,16 @@ describe('vue_shared/component/markdown/markdown_editor', () => { }); }); + describe('when contentEditor is disabled', () => { + it('resets the editingMode to markdownField', async () => { + localStorage.setItem('gl-markdown-editor-mode', 'contentEditor'); + + buildWrapper({ propsData: { autosaveKey: 'issue/1234', enableContentEditor: false } }); + + expect(wrapper.vm.editingMode).toBe(EDITING_MODE_MARKDOWN_FIELD); + }); + }); + describe(`when editingMode is ${EDITING_MODE_CONTENT_EDITOR}`, () => { beforeEach(async () => { buildWrapper({ propsData: { autosaveKey: 'issue/1234' } }); diff --git a/spec/helpers/packages_helper_spec.rb b/spec/helpers/packages_helper_spec.rb index b6546a2eaf3..dcc5e336253 100644 --- a/spec/helpers/packages_helper_spec.rb +++ b/spec/helpers/packages_helper_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe PackagesHelper, feature_category: :package_registry do using RSpec::Parameterized::TableSyntax + include AdminModeHelper let_it_be_with_reload(:project) { create(:project) } let_it_be(:base_url) { "#{Gitlab.config.gitlab.url}/api/v4/" } @@ -127,4 +128,72 @@ RSpec.describe PackagesHelper, feature_category: :package_registry do it { is_expected.to eq(expected_result) } end end + + describe '#show_group_package_registry_settings' do + let_it_be(:group) { create(:group) } + let_it_be(:user) { create(:user) } + let_it_be(:admin) { create(:admin) } + + before do + allow(helper).to receive(:current_user) { user } + end + + subject { helper.show_group_package_registry_settings(group) } + + context 'with package registry config enabled' do + before do + stub_config(packages: { enabled: true }) + end + + context "with admin", :enable_admin_mode do + before do + allow(helper).to receive(:current_user) { admin } + end + + it { is_expected.to be(true) } + end + + context "with owner" do + before do + group.add_owner(user) + end + + it { is_expected.to be(true) } + end + + %i[maintainer developer reporter guest].each do |role| + context "with #{role}" do + before do + group.public_send("add_#{role}", user) + end + + it { is_expected.to be(false) } + end + end + end + + context 'with package registry config disabled' do + before do + stub_config(packages: { enabled: false }) + end + + context "with admin", :enable_admin_mode do + before do + allow(helper).to receive(:current_user) { admin } + end + + it { is_expected.to be(false) } + end + + %i[owner maintainer developer reporter guest].each do |role| + context "with #{role}" do + before do + group.public_send("add_#{role}", user) + end + + it { is_expected.to be(false) } + end + end + end + end end diff --git a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb index 36c65612bb9..b731a8c8c18 100644 --- a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb +++ b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :subscription_cost_management do +RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :seat_cost_management do let!(:users) { table(:users) } let!(:user_highest_roles) { table(:user_highest_roles) } diff --git a/spec/migrations/20221104115712_backfill_project_statistics_storage_size_without_uploads_size_spec.rb b/spec/migrations/20221104115712_backfill_project_statistics_storage_size_without_uploads_size_spec.rb index d86720365c4..9658b5a699a 100644 --- a/spec/migrations/20221104115712_backfill_project_statistics_storage_size_without_uploads_size_spec.rb +++ b/spec/migrations/20221104115712_backfill_project_statistics_storage_size_without_uploads_size_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe BackfillProjectStatisticsStorageSizeWithoutUploadsSize, - feature_category: :subscription_cost_management do + feature_category: :consumables_cost_management do let!(:batched_migration) { described_class::MIGRATION_CLASS } it 'does not schedule background jobs when Gitlab.org_or_com? is false' do diff --git a/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb b/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb index 1b6899b5b30..440a932c76b 100644 --- a/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb +++ b/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe RemoveTempIndexForProjectStatisticsUploadSizeMigration, - feature_category: :subscription_cost_management do + feature_category: :consumables_cost_management do let(:table_name) { 'project_statistics' } let(:index_name) { described_class::INDEX_NAME } diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 5759d9b06f5..8fd9cb0be28 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -3733,7 +3733,7 @@ RSpec.describe Group, feature_category: :subgroups do end end - describe '#usage_quotas_enabled?', feature_category: :subscription_cost_management, unless: Gitlab.ee? do + describe '#usage_quotas_enabled?', feature_category: :consumables_cost_management, unless: Gitlab.ee? do using RSpec::Parameterized::TableSyntax where(:feature_enabled, :root_group, :result) do diff --git a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb index 16dd0dfcfcb..c1ac0367853 100644 --- a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb @@ -51,7 +51,7 @@ RSpec.describe 'getting Alert Management Alert Notes', feature_category: :team_p expect(first_notes_result.first).to include( 'id' => first_system_note.to_global_id.to_s, - 'systemNoteIconName' => 'git-merge', + 'systemNoteIconName' => 'merge', 'body' => first_system_note.note ) end diff --git a/spec/requests/groups/usage_quotas_controller_spec.rb b/spec/requests/groups/usage_quotas_controller_spec.rb index a329398aab3..67aef23704a 100644 --- a/spec/requests/groups/usage_quotas_controller_spec.rb +++ b/spec/requests/groups/usage_quotas_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Groups::UsageQuotasController, :with_license, feature_category: :subscription_cost_management do +RSpec.describe Groups::UsageQuotasController, :with_license, feature_category: :consumables_cost_management do let_it_be(:group) { create(:group) } let_it_be(:subgroup) { create(:group, parent: group) } let_it_be(:user) { create(:user) } diff --git a/spec/requests/projects/usage_quotas_spec.rb b/spec/requests/projects/usage_quotas_spec.rb index 60ab64c30c3..33b206c8dc0 100644 --- a/spec/requests/projects/usage_quotas_spec.rb +++ b/spec/requests/projects/usage_quotas_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Project Usage Quotas', feature_category: :subscription_cost_management do +RSpec.describe 'Project Usage Quotas', feature_category: :consumables_cost_management do let_it_be(:project) { create(:project) } let_it_be(:role) { :maintainer } let_it_be(:user) { create(:user) } diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index 0e50ee953b7..5e0481e92f7 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -285,7 +285,6 @@ - './ee/spec/features/groups/audit_events_spec.rb' - './ee/spec/features/groups/billing_spec.rb' - './ee/spec/features/groups/contribution_analytics_spec.rb' -- './ee/spec/features/groups/feature_discovery_moments_spec.rb' - './ee/spec/features/groups/group_overview_spec.rb' - './ee/spec/features/groups/group_page_with_external_authorization_service_spec.rb' - './ee/spec/features/groups/group_projects_spec.rb' @@ -989,7 +988,6 @@ - './ee/spec/helpers/ee/wiki_helper_spec.rb' - './ee/spec/helpers/epics_helper_spec.rb' - './ee/spec/helpers/gitlab_subscriptions/upcoming_reconciliation_helper_spec.rb' -- './ee/spec/helpers/groups/feature_discovery_moments_helper_spec.rb' - './ee/spec/helpers/groups/ldap_sync_helper_spec.rb' - './ee/spec/helpers/groups/security_features_helper_spec.rb' - './ee/spec/helpers/groups/sso_helper_spec.rb' @@ -2327,7 +2325,6 @@ - './ee/spec/requests/groups_controller_spec.rb' - './ee/spec/requests/groups/epics/epic_links_controller_spec.rb' - './ee/spec/requests/groups/epics/related_epic_links_controller_spec.rb' -- './ee/spec/requests/groups/feature_discovery_moments_spec.rb' - './ee/spec/requests/groups/group_members_controller_spec.rb' - './ee/spec/requests/groups/hook_logs_controller_spec.rb' - './ee/spec/requests/groups/labels_spec.rb' @@ -3102,7 +3099,6 @@ - './ee/spec/views/groups/_compliance_frameworks.html.haml_spec.rb' - './ee/spec/views/groups/compliance_frameworks/new.html.haml_spec.rb' - './ee/spec/views/groups/edit.html.haml_spec.rb' -- './ee/spec/views/groups/feature_discovery_moments/advanced_features_dashboard.html.haml_spec.rb' - './ee/spec/views/groups/hook_logs/show.html.haml_spec.rb' - './ee/spec/views/groups/hooks/edit.html.haml_spec.rb' - './ee/spec/views/groups/security/discover/show.html.haml_spec.rb' @@ -3112,7 +3108,6 @@ - './ee/spec/views/layouts/checkout.html.haml_spec.rb' - './ee/spec/views/layouts/header/_current_user_dropdown.html.haml_spec.rb' - './ee/spec/views/layouts/header/_ee_subscribable_banner.html.haml_spec.rb' -- './ee/spec/views/layouts/header/help_dropdown/_cross_stage_fdm.html.haml_spec.rb' - './ee/spec/views/layouts/header/_read_only_banner.html.haml_spec.rb' - './ee/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb' - './ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb' diff --git a/spec/views/groups/packages/index.html.haml_spec.rb b/spec/views/groups/packages/index.html.haml_spec.rb new file mode 100644 index 00000000000..26f6268a224 --- /dev/null +++ b/spec/views/groups/packages/index.html.haml_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'groups/packages/index.html.haml', feature_category: :package_registry do + let_it_be(:group) { build(:group) } + + subject { rendered } + + before do + assign(:group, group) + end + + it 'renders vue entrypoint' do + render + + expect(rendered).to have_selector('#js-vue-packages-list') + end + + describe 'settings path' do + it 'without permission sets empty settings path' do + allow(view).to receive(:show_group_package_registry_settings).and_return(false) + + render + + expect(rendered).to have_selector('[data-settings-path=""]') + end + + it 'with permission sets group settings path' do + allow(view).to receive(:show_group_package_registry_settings).and_return(true) + + render + + expect(rendered).to have_selector( + "[data-settings-path=\"#{group_settings_packages_and_registries_path(group)}\"]" + ) + end + end +end diff --git a/spec/views/projects/packages/index.html.haml_spec.rb b/spec/views/projects/packages/index.html.haml_spec.rb new file mode 100644 index 00000000000..2557ceb70b3 --- /dev/null +++ b/spec/views/projects/packages/index.html.haml_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'projects/packages/packages/index.html.haml', feature_category: :package_registry do + let_it_be(:project) { build(:project) } + + subject { rendered } + + before do + assign(:project, project) + end + + it 'renders vue entrypoint' do + render + + expect(rendered).to have_selector('#js-vue-packages-list') + end + + describe 'settings path' do + it 'without permission sets empty settings path' do + allow(view).to receive(:show_package_registry_settings).and_return(false) + + render + + expect(rendered).to have_selector('[data-settings-path=""]') + end + + it 'with permission sets project settings path' do + allow(view).to receive(:show_package_registry_settings).and_return(true) + + render + + expect(rendered).to have_selector( + "[data-settings-path=\"#{project_settings_packages_and_registries_path(project)}\"]" + ) + end + end +end diff --git a/spec/workers/update_highest_role_worker_spec.rb b/spec/workers/update_highest_role_worker_spec.rb index 94811260f0e..3e4a2f6be36 100644 --- a/spec/workers/update_highest_role_worker_spec.rb +++ b/spec/workers/update_highest_role_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state, feature_category: :subscription_cost_management do +RSpec.describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state, feature_category: :seat_cost_management do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/users/deactivate_dormant_users_worker_spec.rb b/spec/workers/users/deactivate_dormant_users_worker_spec.rb index bd6c6dfc6b2..fdcbb624562 100644 --- a/spec/workers/users/deactivate_dormant_users_worker_spec.rb +++ b/spec/workers/users/deactivate_dormant_users_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Users::DeactivateDormantUsersWorker, feature_category: :subscription_cost_management do +RSpec.describe Users::DeactivateDormantUsersWorker, feature_category: :seat_cost_management do using RSpec::Parameterized::TableSyntax describe '#perform' do diff --git a/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb b/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb index 73faffb5387..38ea7c43267 100644 --- a/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb +++ b/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Users::MigrateRecordsToGhostUserInBatchesWorker, feature_category: :subscription_cost_management do +RSpec.describe Users::MigrateRecordsToGhostUserInBatchesWorker, feature_category: :seat_cost_management do include ExclusiveLeaseHelpers let(:worker) { described_class.new } |