diff options
28 files changed, 93 insertions, 102 deletions
diff --git a/.gitlab/ci/package-and-test/main.gitlab-ci.yml b/.gitlab/ci/package-and-test/main.gitlab-ci.yml index 9a8acbb3af0..7b2f398cbda 100644 --- a/.gitlab/ci/package-and-test/main.gitlab-ci.yml +++ b/.gitlab/ci/package-and-test/main.gitlab-ci.yml @@ -229,7 +229,6 @@ _ee:super-sidebar-nav: GITLAB_QA_OPTS: --set-feature-flags super_sidebar_nav=enabled allow_failure: true rules: - - if: $CI_MERGE_REQUEST_LABELS =~ /group::foundations/ - !reference [.rules:test:manual, rules] # ------------------------------------------ diff --git a/app/assets/javascripts/behaviors/copy_code.js b/app/assets/javascripts/behaviors/copy_code.js index 970864eef74..218a402772f 100644 --- a/app/assets/javascripts/behaviors/copy_code.js +++ b/app/assets/javascripts/behaviors/copy_code.js @@ -5,6 +5,8 @@ import { setAttributes } from '~/lib/utils/dom_utils'; class CopyCodeButton extends HTMLElement { connectedCallback() { + if (this.querySelector('.btn')) return; + this.for = uniqueId('code-'); const target = this.parentNode.querySelector('pre'); diff --git a/app/assets/javascripts/super_sidebar/components/create_menu.vue b/app/assets/javascripts/super_sidebar/components/create_menu.vue index e92a6cbf5f5..d3bb31a69fa 100644 --- a/app/assets/javascripts/super_sidebar/components/create_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/create_menu.vue @@ -30,6 +30,7 @@ export default { text-sr-only :toggle-text="$options.i18n.createNew" :toggle-id="$options.toggleId" + data-qa-selector="new_menu_toggle" /> <gl-tooltip :target="`#${$options.toggleId}`" placement="bottom" container="#super-sidebar"> {{ $options.i18n.createNew }} diff --git a/app/assets/javascripts/super_sidebar/components/nav_item.vue b/app/assets/javascripts/super_sidebar/components/nav_item.vue index 173e62cefbd..46e281b5a21 100644 --- a/app/assets/javascripts/super_sidebar/components/nav_item.vue +++ b/app/assets/javascripts/super_sidebar/components/nav_item.vue @@ -75,6 +75,8 @@ export default { v-bind="linkProps" class="gl-rounded-base gl-relative gl-display-flex gl-py-3 gl-px-0 gl-line-height-normal gl-text-black-normal! gl-hover-bg-t-gray-a-08 gl-text-decoration-none!" :class="linkClasses" + data-qa-selector="sidebar_menu_link" + :data-qa-menu-item="item.title" @click="click" > <div diff --git a/app/assets/javascripts/super_sidebar/components/user_bar.vue b/app/assets/javascripts/super_sidebar/components/user_bar.vue index 32ce4abd646..15ba39a9edb 100644 --- a/app/assets/javascripts/super_sidebar/components/user_bar.vue +++ b/app/assets/javascripts/super_sidebar/components/user_bar.vue @@ -105,6 +105,7 @@ export default { :count="sidebarData.todos_pending_count" href="/dashboard/todos" :label="$options.i18n.todoList" + data-qa-selector="todos_shortcut_button" /> </div> </div> diff --git a/app/assets/javascripts/super_sidebar/components/user_menu.vue b/app/assets/javascripts/super_sidebar/components/user_menu.vue index 103501e86ef..883fa85f1d9 100644 --- a/app/assets/javascripts/super_sidebar/components/user_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/user_menu.vue @@ -78,6 +78,9 @@ export default { return { text: this.$options.i18n.editProfile, href: this.data.settings.profile_path, + extraAttrs: { + 'data-qa-selector': 'edit_profile_link', + }, }; }, preferencesItem() { @@ -122,6 +125,7 @@ export default { href: this.data.sign_out_link, extraAttrs: { 'data-method': 'post', + 'data-qa-selector': 'sign_out_link', class: 'sign-out-link', }, }, diff --git a/app/models/chat_name.rb b/app/models/chat_name.rb index 9bd618c1008..cda19273f52 100644 --- a/app/models/chat_name.rb +++ b/app/models/chat_name.rb @@ -3,7 +3,9 @@ class ChatName < ApplicationRecord LAST_USED_AT_INTERVAL = 1.hour - belongs_to :integration + include IgnorableColumns + ignore_column :integration_id, remove_with: '16.0', remove_after: '2023-04-22' + belongs_to :user validates :user, presence: true diff --git a/app/models/integrations/base_slash_commands.rb b/app/models/integrations/base_slash_commands.rb index eece67b86d4..7662da933ba 100644 --- a/app/models/integrations/base_slash_commands.rb +++ b/app/models/integrations/base_slash_commands.rb @@ -6,8 +6,6 @@ module Integrations class BaseSlashCommands < Integration attribute :category, default: 'chat' - has_many :chat_names, foreign_key: :integration_id, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent - def valid_token?(token) self.respond_to?(:token) && self.token.present? && diff --git a/app/models/onboarding/completion.rb b/app/models/onboarding/completion.rb index 2d1cfc4e876..0966a9f2912 100644 --- a/app/models/onboarding/completion.rb +++ b/app/models/onboarding/completion.rb @@ -5,14 +5,11 @@ module Onboarding include Gitlab::Utils::StrongMemoize include Gitlab::Experiment::Dsl - ACTION_ISSUE_IDS = { - trial_started: 2, - required_mr_approvals_enabled: 11, - code_owners_enabled: 10 - }.freeze - ACTION_PATHS = [ :pipeline_created, + :trial_started, + :required_mr_approvals_enabled, + :code_owners_enabled, :issue_created, :git_write, :merge_request_created, @@ -66,7 +63,7 @@ module Onboarding strong_memoize_attr :action_columns def tracked_actions - ACTION_ISSUE_IDS.keys + ACTION_PATHS + deploy_section_tracked_actions + ACTION_PATHS + deploy_section_tracked_actions end def deploy_section_tracked_actions diff --git a/app/views/profiles/chat_names/_chat_name.html.haml b/app/views/profiles/chat_names/_chat_name.html.haml index ce2fc2098c5..afc3894c23b 100644 --- a/app/views/profiles/chat_names/_chat_name.html.haml +++ b/app/views/profiles/chat_names/_chat_name.html.haml @@ -1,21 +1,5 @@ -- integration = chat_name.integration -- project = integration&.project %tr %td - %strong - - if project.present? && can?(current_user, :read_project, project) - = link_to project.full_name, project_path(project) - - else - .light= _('Not applicable.') - %td - %strong - - if integration.present? && can?(current_user, :admin_project, project) - = link_to integration.title, edit_project_settings_integration_path(project, integration) - - elsif integration.present? - = integration.title - - else - .light= _('Not applicable.') - %td = chat_name.team_domain %td = chat_name.chat_name diff --git a/app/views/profiles/chat_names/index.html.haml b/app/views/profiles/chat_names/index.html.haml index 41bd81d0250..43d7c9bf7c6 100644 --- a/app/views/profiles/chat_names/index.html.haml +++ b/app/views/profiles/chat_names/index.html.haml @@ -14,11 +14,9 @@ - if @chat_names.present? .table-responsive - %table.table.chat-names + %table.table %thead %tr - %th= _('Project') - %th= _('Service') %th= _('Team domain') %th= _('Nickname') %th= _('Last used') diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 2866f811b71..f6ac330f645 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -6316,6 +6316,7 @@ Input type: `VulnerabilityRevertToDetectedInput` | Name | Type | Description | | ---- | ---- | ----------- | | <a id="mutationvulnerabilityreverttodetectedclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | +| <a id="mutationvulnerabilityreverttodetectedcomment"></a>`comment` | [`String`](#string) | Comment why vulnerability was reverted to detected (max. 50 000 characters). | | <a id="mutationvulnerabilityreverttodetectedid"></a>`id` | [`VulnerabilityID!`](#vulnerabilityid) | ID of the vulnerability to be reverted. | #### Fields diff --git a/lib/gitlab/ci/templates/Jobs/SAST-IaC.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/SAST-IaC.latest.gitlab-ci.yml index 77048037915..b4bff9d9667 100644 --- a/lib/gitlab/ci/templates/Jobs/SAST-IaC.latest.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/SAST-IaC.latest.gitlab-ci.yml @@ -34,7 +34,7 @@ kics-iac-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/kics:$SAST_ANALYZER_IMAGE_TAG$SAST_IMAGE_SUFFIX" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /kics/ when: never diff --git a/lib/gitlab/ci/templates/Jobs/SAST.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/SAST.latest.gitlab-ci.yml index 1c4dbe6cd0f..e7c8356662b 100644 --- a/lib/gitlab/ci/templates/Jobs/SAST.latest.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/SAST.latest.gitlab-ci.yml @@ -51,7 +51,7 @@ brakeman-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/brakeman:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /brakeman/ when: never @@ -83,7 +83,7 @@ flawfinder-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/flawfinder:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /flawfinder/ when: never @@ -123,7 +123,7 @@ kubesec-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/kubesec:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /kubesec/ when: never @@ -147,7 +147,7 @@ kubesec-sast: mobsf-android-sast: extends: .mobsf-sast rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /mobsf/ when: never @@ -169,7 +169,7 @@ mobsf-android-sast: mobsf-ios-sast: extends: .mobsf-sast rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /mobsf/ when: never @@ -196,7 +196,7 @@ nodejs-scan-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/nodejs-scan:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /nodejs-scan/ when: never @@ -217,7 +217,7 @@ phpcs-security-audit-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/phpcs-security-audit:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /phpcs-security-audit/ when: never @@ -238,7 +238,7 @@ pmd-apex-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/pmd-apex:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /pmd-apex/ when: never @@ -259,7 +259,7 @@ security-code-scan-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/security-code-scan:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /security-code-scan/ when: never @@ -283,7 +283,7 @@ semgrep-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/semgrep:$SAST_ANALYZER_IMAGE_TAG$SAST_IMAGE_SUFFIX" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /semgrep/ when: never @@ -326,7 +326,7 @@ sobelow-sast: SAST_ANALYZER_IMAGE_TAG: 3 SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/sobelow:$SAST_ANALYZER_IMAGE_TAG" rules: - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $SAST_EXCLUDED_ANALYZERS =~ /sobelow/ when: never @@ -353,7 +353,7 @@ spotbugs-sast: exists: - '**/AndroidManifest.xml' when: never - - if: $SAST_DISABLED + - if: $SAST_DISABLED == 'true' || $SAST_DISABLED == '1' when: never - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request. exists: diff --git a/lib/gitlab/ci/templates/Jobs/Secret-Detection.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Secret-Detection.latest.gitlab-ci.yml index 6603ee4268e..f343dfaa28f 100644 --- a/lib/gitlab/ci/templates/Jobs/Secret-Detection.latest.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Secret-Detection.latest.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: secret_detection: extends: .secret-analyzer rules: - - if: $SECRET_DETECTION_DISABLED + - if: $SECRET_DETECTION_DISABLED == 'true' || $SECRET_DETECTION_DISABLED == '1' when: never - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Add the job to merge request pipelines if there's an open merge request. - if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline. diff --git a/qa/qa/page/group/sub_menus/common.rb b/qa/qa/page/group/sub_menus/common.rb index 2f8a3fdeb4e..3cbca3db359 100644 --- a/qa/qa/page/group/sub_menus/common.rb +++ b/qa/qa/page/group/sub_menus/common.rb @@ -21,7 +21,7 @@ module QA private def sidebar_element - :group_sidebar + QA::Runtime::Env.super_sidebar_enabled? ? :navbar : :group_sidebar end end end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 0b258c9ee34..bc99aa14b0d 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -6,12 +6,6 @@ module QA class Menu < Page::Base prepend Mobile::Page::Main::Menu if Runtime::Env.mobile_layout? - view 'app/views/layouts/header/_current_user_dropdown.html.haml' do - element :sign_out_link - element :edit_profile_link - element :user_profile_link - end - if QA::Runtime::Env.super_sidebar_enabled? # Define alternative navbar (super sidebar) which does not yet implement all the same elements view 'app/assets/javascripts/super_sidebar/components/super_sidebar.vue' do @@ -19,6 +13,11 @@ module QA element :user_menu, required: !QA::Runtime::Env.mobile_layout? element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout? end + + view 'app/assets/javascripts/super_sidebar/components/user_menu.vue' do + element :sign_out_link + element :edit_profile_link + end else view 'app/views/layouts/header/_default.html.haml' do element :navbar, required: true @@ -30,6 +29,12 @@ module QA element :merge_requests_shortcut_button, required: !QA::Runtime::Env.mobile_layout? element :todos_shortcut_button, required: !QA::Runtime::Env.mobile_layout? end + + view 'app/views/layouts/header/_current_user_dropdown.html.haml' do + element :sign_out_link + element :edit_profile_link + element :user_profile_link + end end view 'app/assets/javascripts/nav/components/top_nav_app.vue' do @@ -100,6 +105,8 @@ module QA end def go_to_menu_dropdown_option(option_name) + return click_element(option_name) if QA::Runtime::Env.super_sidebar_enabled? + within_top_menu do click_element(:navbar_dropdown, title: 'Menu') click_element(option_name) diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index 112f49a90ee..79054ec9802 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -29,7 +29,7 @@ module QA private def sidebar_element - :project_sidebar + QA::Runtime::Env.super_sidebar_enabled? ? :navbar : :project_sidebar end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb index feb0f28763c..2b04ede25b0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb @@ -15,7 +15,7 @@ module QA end it 'by adding a home page to the wiki', -testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do project.visit! Page::Project::Menu.perform(&:click_wiki) @@ -36,7 +36,7 @@ testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do end it 'by adding a second page to the wiki', -testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do wiki.visit! Page::Project::Wiki::Show.perform(&:click_new_page) @@ -56,7 +56,7 @@ testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do end it 'by adding a home page to the wiki using git push', -testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki| empty_wiki.project = project end @@ -76,7 +76,7 @@ testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do end it 'by adding a second page to the wiki using git push', -testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do Resource::Repository::WikiPush.fabricate! do |push| push.file_name = "#{new_wiki_title}.md" push.file_content = new_wiki_content diff --git a/spec/factories/chat_names.rb b/spec/factories/chat_names.rb index 56567394bf5..c872694ee64 100644 --- a/spec/factories/chat_names.rb +++ b/spec/factories/chat_names.rb @@ -3,7 +3,6 @@ FactoryBot.define do factory :chat_name, class: 'ChatName' do user - integration team_id { 'T0001' } team_domain { 'Awesome Team' } diff --git a/spec/features/profiles/chat_names_spec.rb b/spec/features/profiles/chat_names_spec.rb index 299ecdb6032..9e1bd69a239 100644 --- a/spec/features/profiles/chat_names_spec.rb +++ b/spec/features/profiles/chat_names_spec.rb @@ -3,8 +3,7 @@ require 'spec_helper' RSpec.describe 'Profile > Chat', feature_category: :user_profile do - let(:user) { create(:user) } - let(:integration) { create(:integration) } + let_it_be(:user) { create(:user) } before do sign_in(user) @@ -60,7 +59,7 @@ RSpec.describe 'Profile > Chat', feature_category: :user_profile do end describe 'visits chat accounts' do - let!(:chat_name) { create(:chat_name, user: user, integration: integration) } + let_it_be(:chat_name) { create(:chat_name, user: user) } before do visit profile_chat_names_path diff --git a/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb index 039a6a739dd..2b9213ea921 100644 --- a/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/Jobs/sast_iac_latest_gitlab_ci_yaml_spec.rb @@ -23,27 +23,33 @@ RSpec.describe 'Jobs/SAST-IaC.latest.gitlab-ci.yml', feature_category: :continuo allow(project).to receive(:default_branch).and_return(default_branch) end - context 'on feature branch' do - let(:pipeline_ref) { 'feature' } + context 'when SAST_DISABLED="false"' do + before do + create(:ci_variable, key: 'SAST_DISABLED', value: 'false', project: project) + end + + context 'on feature branch' do + let(:pipeline_ref) { 'feature' } - it 'creates the kics-iac-sast job' do - expect(build_names).to contain_exactly('kics-iac-sast') + it 'creates the kics-iac-sast job' do + expect(build_names).to contain_exactly('kics-iac-sast') + end end - end - context 'on merge request' do - let(:service) { MergeRequests::CreatePipelineService.new(project: project, current_user: user) } - let(:merge_request) { create(:merge_request, :simple, source_project: project) } - let(:pipeline) { service.execute(merge_request).payload } + context 'on merge request' do + let(:service) { MergeRequests::CreatePipelineService.new(project: project, current_user: user) } + let(:merge_request) { create(:merge_request, :simple, source_project: project) } + let(:pipeline) { service.execute(merge_request).payload } - it 'creates a pipeline with the expected jobs' do - expect(pipeline).to be_merge_request_event - expect(pipeline.errors.full_messages).to be_empty - expect(build_names).to match_array(%w(kics-iac-sast)) + it 'creates a pipeline with the expected jobs' do + expect(pipeline).to be_merge_request_event + expect(pipeline.errors.full_messages).to be_empty + expect(build_names).to match_array(%w(kics-iac-sast)) + end end end - context 'SAST_DISABLED is set' do + context 'when SAST_DISABLED="true"' do before do create(:ci_variable, key: 'SAST_DISABLED', value: 'true', project: project) end diff --git a/spec/models/chat_name_spec.rb b/spec/models/chat_name_spec.rb index 0838c232872..9d6b1a56458 100644 --- a/spec/models/chat_name_spec.rb +++ b/spec/models/chat_name_spec.rb @@ -7,7 +7,6 @@ RSpec.describe ChatName, feature_category: :integrations do subject { chat_name } - it { is_expected.to belong_to(:integration) } it { is_expected.to belong_to(:user) } it { is_expected.to validate_presence_of(:user) } @@ -16,12 +15,6 @@ RSpec.describe ChatName, feature_category: :integrations do it { is_expected.to validate_uniqueness_of(:chat_id).scoped_to(:team_id) } - it 'is not removed when the project is deleted' do - expect { subject.reload.integration.project.delete }.not_to change { ChatName.count } - - expect(ChatName.where(id: subject.id)).to exist - end - describe '#update_last_used_at', :clean_gitlab_redis_shared_state do it 'updates the last_used_at timestamp' do expect(subject.last_used_at).to be_nil diff --git a/spec/models/onboarding/completion_spec.rb b/spec/models/onboarding/completion_spec.rb index 175f8d6ef68..0639762b76c 100644 --- a/spec/models/onboarding/completion_spec.rb +++ b/spec/models/onboarding/completion_spec.rb @@ -11,11 +11,9 @@ RSpec.describe Onboarding::Completion, feature_category: :onboarding do describe '#percentage' do let(:tracked_action_columns) do - [ - *described_class::ACTION_ISSUE_IDS.keys, - *described_class::ACTION_PATHS, - :security_scan_enabled - ].map { |key| ::Onboarding::Progress.column_name(key) } + [*described_class::ACTION_PATHS, :security_scan_enabled].map do |key| + ::Onboarding::Progress.column_name(key) + end end subject(:percentage) { described_class.new(project).percentage } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 7d431de9f07..d11257cbf89 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -7326,20 +7326,6 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do end end - describe 'with integrations and chat names' do - subject { create(:project) } - - let(:integration) { create(:integration, project: subject) } - - before do - create_list(:chat_name, 5, integration: integration) - end - - it 'does not remove chat names on removal' do - expect { subject.destroy! }.not_to change { ChatName.count } - end - end - describe 'with_issues_or_mrs_available_for_user' do before do Project.delete_all diff --git a/spec/support/shared_examples/models/integrations/base_slash_commands_shared_examples.rb b/spec/support/shared_examples/models/integrations/base_slash_commands_shared_examples.rb index 7dfdd24177e..0cf109ce5c5 100644 --- a/spec/support/shared_examples/models/integrations/base_slash_commands_shared_examples.rb +++ b/spec/support/shared_examples/models/integrations/base_slash_commands_shared_examples.rb @@ -3,7 +3,6 @@ RSpec.shared_examples Integrations::BaseSlashCommands do describe "Associations" do it { is_expected.to respond_to :token } - it { is_expected.to have_many :chat_names } end describe 'default values' do @@ -85,7 +84,7 @@ RSpec.shared_examples Integrations::BaseSlashCommands do end context 'when the user is authenticated' do - let!(:chat_name) { create(:chat_name, integration: subject) } + let!(:chat_name) { create(:chat_name) } let(:params) { { token: 'token', team_id: chat_name.team_id, user_id: chat_name.chat_id } } subject do diff --git a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb index 72e02547938..12a73480440 100644 --- a/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb +++ b/spec/tooling/lib/tooling/mappings/js_to_system_specs_mappings_spec.rb @@ -129,6 +129,20 @@ RSpec.describe Tooling::Mappings::JsToSystemSpecsMappings, feature_category: :to it 'returns a singularized keyword based on the first folder the file is in' do expect(subject).to eq(%w[board query]) end + + context 'when the files are under the pages folder' do + let(:js_files) do + %w[ + app/assets/javascripts/pages/boards/issue_board_filters.js + ee/app/assets/javascripts/pages2/queries/epic_due_date.query.graphql + ee/app/assets/javascripts/queries/epic_due_date.query.graphql + ] + end + + it 'captures the second folder' do + expect(subject).to eq(%w[board pages2 query]) + end + end end describe '#system_specs_for_edition' do diff --git a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb index 365e466011b..e78ce266a32 100644 --- a/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb +++ b/tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb @@ -18,6 +18,7 @@ module Tooling @first_js_folder_extract_regexp = %r{ (?:.*/)? # Skips the GitLab edition (e.g. ee/, jh/) #{@js_base_folder}/ # Most likely app/assets/javascripts/ + (?:pages/)? # If under a pages folder, we capture the following folder ([\w-]*) # Captures the first folder }x end |