diff --git a/.rubocop_todo/layout/argument_alignment.yml b/.rubocop_todo/layout/argument_alignment.yml index 9866be632a3..ac0a8f8c8b7 100644 --- a/.rubocop_todo/layout/argument_alignment.yml +++ b/.rubocop_todo/layout/argument_alignment.yml @@ -1879,26 +1879,6 @@ Layout/ArgumentAlignment: - 'spec/rubocop/cop/rspec/env_mocking_spec.rb' - 'spec/rubocop/cop/style/regexp_literal_mixed_preserve_spec.rb' - 'spec/rubocop/formatter/graceful_formatter_spec.rb' - - 'spec/services/design_management/save_designs_service_spec.rb' - - 'spec/services/discussions/resolve_service_spec.rb' - - 'spec/services/draft_notes/publish_service_spec.rb' - - 'spec/services/environments/stop_service_spec.rb' - - 'spec/services/environments/stop_stale_service_spec.rb' - - 'spec/services/loose_foreign_keys/batch_cleaner_service_spec.rb' - - 'spec/services/metrics/dashboard/clone_dashboard_service_spec.rb' - - 'spec/services/note_summary_spec.rb' - - 'spec/services/notification_service_spec.rb' - - 'spec/services/pages/migrate_legacy_storage_to_deployment_service_spec.rb' - - 'spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb' - - 'spec/services/preview_markdown_service_spec.rb' - - 'spec/services/protected_branches/api_service_spec.rb' - - 'spec/services/push_event_payload_service_spec.rb' - - 'spec/services/quick_actions/interpret_service_spec.rb' - - 'spec/services/releases/destroy_service_spec.rb' - - 'spec/services/resource_access_tokens/revoke_service_spec.rb' - - 'spec/services/resource_events/merge_into_notes_service_spec.rb' - - 'spec/services/security/ci_configuration/dependency_scanning_create_service_spec.rb' - - 'spec/services/security/merge_reports_service_spec.rb' - 'spec/sidekiq/cron/job_gem_dependency_spec.rb' - 'spec/support/shared_examples/initializers/uses_gitlab_url_blocker_shared_examples.rb' - 'spec/support/shared_examples/integrations/integration_settings_form.rb' diff --git a/app/assets/javascripts/issues/show/components/app.vue b/app/assets/javascripts/issues/show/components/app.vue index a05f609c7db..d66365e5456 100644 --- a/app/assets/javascripts/issues/show/components/app.vue +++ b/app/assets/javascripts/issues/show/components/app.vue @@ -10,16 +10,18 @@ import { TYPE_ISSUE, WORKSPACE_PROJECT, } from '~/issues/constants'; +import updateDescription from '~/issues/show/utils/update_description'; +import { sanitize } from '~/lib/dompurify'; +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import Poll from '~/lib/utils/poll'; +import { containsSensitiveToken, confirmSensitiveAction, i18n } from '~/lib/utils/secret_detection'; import { visitUrl } from '~/lib/utils/url_utility'; import { __, sprintf } from '~/locale'; import ConfidentialityBadge from '~/vue_shared/components/confidentiality_badge.vue'; -import { containsSensitiveToken, confirmSensitiveAction, i18n } from '~/lib/utils/secret_detection'; import { ISSUE_TYPE_PATH, INCIDENT_TYPE_PATH, POLLING_DELAY } from '../constants'; import eventHub from '../event_hub'; import getIssueStateQuery from '../queries/get_issue_state.query.graphql'; import Service from '../services/index'; -import Store from '../stores'; import DescriptionComponent from './description.vue'; import EditedComponent from './edited.vue'; import FormComponent from './form.vue'; @@ -234,21 +236,26 @@ export default { }, }, data() { - const store = new Store({ - titleHtml: this.initialTitleHtml, - titleText: this.initialTitleText, - descriptionHtml: this.initialDescriptionHtml, - descriptionText: this.initialDescriptionText, - updatedAt: this.updatedAt, - updatedByName: this.updatedByName, - updatedByPath: this.updatedByPath, - taskCompletionStatus: this.initialTaskCompletionStatus, - lock_version: this.lockVersion, - }); - return { - store, - state: store.state, + formState: { + title: '', + description: '', + lockedWarningVisible: false, + updateLoading: false, + lock_version: 0, + issuableTemplates: {}, + }, + state: { + titleHtml: this.initialTitleHtml, + titleText: this.initialTitleText, + descriptionHtml: this.initialDescriptionHtml, + descriptionText: this.initialDescriptionText, + updatedAt: this.updatedAt, + updatedByName: this.updatedByName, + updatedByPath: this.updatedByPath, + taskCompletionStatus: this.initialTaskCompletionStatus, + lock_version: this.lockVersion, + }, showForm: false, templatesRequested: false, isStickyHeaderShowing: false, @@ -264,17 +271,9 @@ export default { headerClasses() { return this.issuableType === TYPE_INCIDENT ? 'gl-mb-3' : 'gl-mb-6'; }, - issuableTemplates() { - return this.store.formState.issuableTemplates; - }, - formState() { - return this.store.formState; - }, issueChanged() { const { - store: { - formState: { description, title }, - }, + formState: { description, title }, initialDescriptionText, initialTitleText, } = this; @@ -322,7 +321,7 @@ export default { this.poll = new Poll({ resource: this.service, method: 'getData', - successCallback: (res) => this.store.updateState(res.data), + successCallback: (res) => this.updateState(res.data), errorCallback(err) { throw new Error(err); }, @@ -360,23 +359,37 @@ export default { } return undefined; }, + updateState(data) { + const stateShouldUpdate = + this.state.titleText !== data.title_text || + this.state.descriptionText !== data.description_text; - updateStoreState() { + if (stateShouldUpdate) { + this.formState.lockedWarningVisible = true; + } + + Object.assign(this.state, convertObjectPropsToCamelCase(data)); + // find if there is an open details node inside of the issue description. + const descriptionSection = document.body.querySelector( + '.detail-page-description.content-block', + ); + const details = + descriptionSection != null && descriptionSection.getElementsByTagName('details'); + + this.state.descriptionHtml = updateDescription(sanitize(data.description), details); + this.state.titleHtml = sanitize(data.title); + this.state.lock_version = data.lock_version; + }, + refetchData() { return this.service .getData() .then((res) => res.data) - .then((data) => { - this.store.updateState(data); - }) - .catch(() => { - createAlert({ - message: this.defaultErrorMessage, - }); - }); + .then(this.updateState) + .catch(() => createAlert({ message: this.defaultErrorMessage })); }, setFormState(state) { - this.store.setFormState(state); + this.formState = { ...this.formState, ...state }; }, updateFormState(templates = {}) { @@ -416,7 +429,7 @@ export default { this.templatesRequested = true; this.requestTemplatesAndShowForm(); } else { - this.updateAndShowForm(this.issuableTemplates); + this.updateAndShowForm(this.formState.issuableTemplates); } }, @@ -427,10 +440,7 @@ export default { async updateIssuable() { this.setFormState({ updateLoading: true }); - const { - store: { formState }, - issueState, - } = this; + const { formState, issueState } = this; const issuablePayload = issueState.isDirty ? { ...formState, issue_type: issueState.issueType } : formState; @@ -464,7 +474,7 @@ export default { visitUrl(URI); } }) - .then(this.updateStoreState) + .then(this.refetchData) .then(() => { eventHub.$emit('close.form'); }) @@ -518,7 +528,7 @@ export default { this.poll.enable(); this.poll.makeDelayedRequest(POLLING_DELAY); - this.updateStoreState(); + this.refetchData(); }, }, }; @@ -531,7 +541,7 @@ export default { :endpoint="endpoint" :form-state="formState" :initial-description-text="initialDescriptionText" - :issuable-templates="issuableTemplates" + :issuable-templates="formState.issuableTemplates" :markdown-docs-path="markdownDocsPath" :markdown-preview-path="markdownPreviewPath" :project-path="projectPath" diff --git a/app/assets/javascripts/issues/show/stores/index.js b/app/assets/javascripts/issues/show/stores/index.js deleted file mode 100644 index a50913d3455..00000000000 --- a/app/assets/javascripts/issues/show/stores/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import { sanitize } from '~/lib/dompurify'; -import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -import updateDescription from '../utils/update_description'; - -export default class Store { - constructor(initialState) { - this.state = initialState; - this.formState = { - title: '', - description: '', - lockedWarningVisible: false, - updateLoading: false, - lock_version: 0, - issuableTemplates: {}, - }; - } - - updateState(data) { - if (this.stateShouldUpdate(data)) { - this.formState.lockedWarningVisible = true; - } - - Object.assign(this.state, convertObjectPropsToCamelCase(data)); - // find if there is an open details node inside of the issue description. - const descriptionSection = document.body.querySelector( - '.detail-page-description.content-block', - ); - const details = - descriptionSection != null && descriptionSection.getElementsByTagName('details'); - - this.state.descriptionHtml = updateDescription(sanitize(data.description), details); - this.state.titleHtml = sanitize(data.title); - this.state.lock_version = data.lock_version; - } - - stateShouldUpdate(data) { - return ( - this.state.titleText !== data.title_text || - this.state.descriptionText !== data.description_text - ); - } - - setFormState(state) { - this.formState = Object.assign(this.formState, state); - } -} diff --git a/app/models/integrations/base_chat_notification.rb b/app/models/integrations/base_chat_notification.rb index 4d207574ca7..bf76d87c6b7 100644 --- a/app/models/integrations/base_chat_notification.rb +++ b/app/models/integrations/base_chat_notification.rb @@ -154,6 +154,15 @@ module Integrations supported_events.map { |event| event_channel_name(event) } end + override :api_field_names + def api_field_names + if mask_configurable_channels? + super - event_channel_names + else + super + end + end + def form_fields super.reject { |field| field[:name].end_with?('channel') } end diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index 76a3a2c0505..7665f30be62 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -180,11 +180,7 @@ class Packages::Package < ApplicationRecord scope :preload_conan_metadatum, -> { preload(:conan_metadatum) } scope :with_npm_scope, ->(scope) do - if Feature.enabled?(:npm_package_registry_fix_group_path_validation) - npm.where("position('/' in packages_packages.name) > 0 AND split_part(packages_packages.name, '/', 1) = :package_scope", package_scope: "@#{sanitize_sql_like(scope)}") - else - npm.where("name ILIKE :package_name", package_name: "@#{sanitize_sql_like(scope)}/%") - end + npm.where("position('/' in packages_packages.name) > 0 AND split_part(packages_packages.name, '/', 1) = :package_scope", package_scope: "@#{sanitize_sql_like(scope)}") end scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) } diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index 7d0142fc067..d91e09d212a 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -47,10 +47,6 @@ module Groups private def valid_path_change? - unless Feature.enabled?(:npm_package_registry_fix_group_path_validation) - return valid_path_change_with_npm_packages? - end - return true unless group.packages_feature_enabled? return true if params[:path].blank? return true if group.has_parent? @@ -68,21 +64,6 @@ module Groups false end - # TODO: delete this function along with npm_package_registry_fix_group_path_validation - def valid_path_change_with_npm_packages? - return true unless group.packages_feature_enabled? - return true if params[:path].blank? - return true if !group.has_parent? && group.path == params[:path] - - npm_packages = ::Packages::GroupPackagesFinder.new(current_user, group, package_type: :npm).execute - if npm_packages.exists? - group.errors.add(:path, s_('GroupSettings|cannot change when group contains projects with NPM packages')) - return - end - - true - end - def before_assignment_hook(group, params) @full_path_before = group.full_path @path_before = group.path diff --git a/app/workers/environments/stop_job_success_worker.rb b/app/workers/environments/stop_job_success_worker.rb index cc7d83512f3..93b743ee602 100644 --- a/app/workers/environments/stop_job_success_worker.rb +++ b/app/workers/environments/stop_job_success_worker.rb @@ -9,15 +9,15 @@ module Environments feature_category :continuous_delivery def perform(job_id, _params = {}) - Ci::Build.find_by_id(job_id).try do |build| - stop_environment(build) if build.stops_environment? && build.stop_action_successful? + Ci::Processable.find_by_id(job_id).try do |job| + stop_environment(job) if job.stops_environment? && job.stop_action_successful? end end private - def stop_environment(build) - build.persisted_environment.fire_state_event(:stop_complete) + def stop_environment(job) + job.persisted_environment.fire_state_event(:stop_complete) end end end diff --git a/config/feature_flags/development/npm_package_registry_fix_group_path_validation.yml b/config/feature_flags/development/npm_package_registry_fix_group_path_validation.yml deleted file mode 100644 index 36132703d28..00000000000 --- a/config/feature_flags/development/npm_package_registry_fix_group_path_validation.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: npm_package_registry_fix_group_path_validation -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127164 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/420160 -milestone: '16.3' -type: development -group: group::package registry -default_enabled: false diff --git a/doc/administration/gitaly/configure_gitaly.md b/doc/administration/gitaly/configure_gitaly.md index 47943820d44..ad7ecd1d796 100644 --- a/doc/administration/gitaly/configure_gitaly.md +++ b/doc/administration/gitaly/configure_gitaly.md @@ -872,10 +872,6 @@ When reached, limits _do_ result in disconnects that negatively impact users. For consistent and stable performance, you should first explore other options such as adjusting node specifications, and [reviewing large repositories](../../user/project/repository/managing_large_repositories.md) or workloads. -FLAG: -On self-managed GitLab, by default repository cgroups are not available. To make it available, an administrator can -[enable the feature flag](../feature_flags.md) named `gitaly_run_cmds_in_cgroup`. - When enabling cgroups for memory, you should ensure that no swap is configured on the Gitaly nodes as processes may switch to using that instead of being terminated. This situation could lead to notably compromised performance. diff --git a/doc/administration/settings/rate_limits_on_git_ssh_operations.md b/doc/administration/settings/rate_limits_on_git_ssh_operations.md index 64acb15b8ac..cb0d5e2a136 100644 --- a/doc/administration/settings/rate_limits_on_git_ssh_operations.md +++ b/doc/administration/settings/rate_limits_on_git_ssh_operations.md @@ -24,6 +24,8 @@ Users on self-managed GitLab can disable this rate limit. ## Configure GitLab Shell operation limit +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123761) in GitLab 16.2. + `Git operations using SSH` is enabled by default. Defaults to 600 per user per minute. 1. On the left sidebar, select **Your work > Admin Area**. diff --git a/doc/user/application_security/vulnerability_report/pipeline.md b/doc/user/application_security/vulnerability_report/pipeline.md index 7a414e9a4ae..4eb01917660 100644 --- a/doc/user/application_security/vulnerability_report/pipeline.md +++ b/doc/user/application_security/vulnerability_report/pipeline.md @@ -26,8 +26,10 @@ For example, if a pipeline contains DAST and SAST jobs, but the DAST job fails b The pipeline vulnerability report only shows results contained in the security report artifacts. This report differs from the [Vulnerability Report](index.md), which contains cumulative results of all successful jobs, and from the merge request -[security widget](../index.md#view-security-scan-information-in-merge-requests), which combines the branch results with -cumulative results. +[security widget](../index.md#view-security-scan-information-in-merge-requests), which contains new vulnerability findings that don't already exist in the default branch. + +NOTE: +If a new advisory is added to our advisory database and the last pipeline for the default branch is stale, the resulting vulnerability may appear in the MR widget as "New" when it is already in the default branch. This will be resolved by [Continuous Vulnerability Scans](https://gitlab.com/groups/gitlab-org/-/epics/7886). The pipeline vulnerability report only displays after the pipeline is complete. If the pipeline has a [blocking manual job](../../../ci/jobs/job_control.md#types-of-manual-jobs), the pipeline waits for the manual job and the vulnerabilities cannot be displayed if the blocking manual job did not run. diff --git a/doc/user/profile/preferences.md b/doc/user/profile/preferences.md index 64b76bcfb6e..b945f598759 100644 --- a/doc/user/profile/preferences.md +++ b/doc/user/profile/preferences.md @@ -178,12 +178,11 @@ To show one file per page on the **Changes** tab: Then, to move between files on the **Changes** tab, below each file, select the **Previous** and **Next** buttons. -### Autocomplete characters +### Auto-enclose characters -When you type an opening character, like a bracket or quote mark, in a description or comment box, -GitLab can automatically insert the closing character as you type. For example, if you begin your text with an open bracket, GitLab can insert the closing bracket. +Automatically add the corresponding closing character to text when you type the opening character. For example, you can automatically insert a closing bracket when you type an opening bracket. This setting works only in description and comment boxes and for the following characters: `**"`, `'`, ```, `(`, `[`, `{`, `<`, `*`, `_**`. -To autocomplete characters in description and comment boxes: +To auto-enclose characters in description and comment boxes: 1. On the left sidebar, select your avatar. 1. Select **Preferences**. @@ -191,9 +190,12 @@ To autocomplete characters in description and comment boxes: 1. Select the **Surround text selection when typing quotes or brackets** checkbox. 1. Select **Save changes**. +In a description or comment box, you can now type a word, highlight it, then type an +opening character. Instead of replacing the text, the closing character is added to the end. + ### Automate new list items -Create a new list item when you press Enter within a list in description and comment boxes. +Create a new list item when you press Enter in a list in description and comment boxes. To add a new list item when you press the Enter key: diff --git a/doc/user/project/import/github.md b/doc/user/project/import/github.md index 40d0ffad1c6..58710194a94 100644 --- a/doc/user/project/import/github.md +++ b/doc/user/project/import/github.md @@ -510,3 +510,11 @@ To disable the feature flag, run this command: # Disable Feature.disable(:github_importer_lower_per_page_limit, group) ``` + +## Known limitations + +When importing a GitHub pull request with assigned reviewers that do not exist in the GitLab instance, the reviewers will not be imported. + +In this case, the import will create comment events showing the non-existent users were added as reviewers and approvers. However, the actual reviewer status and approval are not applied to the merge request in GitLab. + +There is currently no workaround to map the reviewers if they do not exist in the GitLab instance. The importer cannot apply approvals or reviewers from users that cannot be mapped. diff --git a/lib/quality/seeders/issues.rb b/lib/quality/seeders/issues.rb index fb3d78bc8d2..c724396a54c 100644 --- a/lib/quality/seeders/issues.rb +++ b/lib/quality/seeders/issues.rb @@ -5,7 +5,7 @@ module Quality module Seeders class Issues DEFAULT_BACKFILL_WEEKS = 52 - DEFAULT_AVERAGE_ISSUES_PER_WEEK = 10 + DEFAULT_AVERAGE_ISSUES_PER_WEEK = 20 attr_reader :project, :user @@ -14,23 +14,27 @@ module Quality end def seed(backfill_weeks: DEFAULT_BACKFILL_WEEKS, average_issues_per_week: DEFAULT_AVERAGE_ISSUES_PER_WEEK) + create_milestones! + create_team_members! + created_at = backfill_weeks.to_i.weeks.ago team = project.team.users created_issues_count = 0 loop do - rand(average_issues_per_week * 2).times do + rand(1..average_issues_per_week).times do params = { title: FFaker::Lorem.sentence(6), description: FFaker::Lorem.sentence, created_at: created_at + rand(6).days, state: %w[opened closed].sample, - milestone: project.milestones.sample, - assignee_ids: Array(team.pluck(:id).sample(3)), + milestone_id: project.milestones.sample&.id, + assignee_ids: Array(team.pluck(:id).sample(rand(3))), + due_date: rand(10).days.from_now, labels: labels.join(',') - } - params[:closed_at] = params[:created_at] + rand(35).days if params[:state] == 'closed' + }.merge(additional_params) + params[:closed_at] = params[:created_at] + rand(35).days if params[:state] == 'closed' create_result = ::Issues::CreateService.new(container: project, current_user: team.sample, params: params, perform_spam_check: false).execute_without_rate_limiting if create_result.success? @@ -49,6 +53,46 @@ module Quality private + # Overriden on Quality::Seeders::Insights::Issues + def additional_params + {} + end + + def create_team_members! + 3.times do |i| + user = FactoryBot.create( + :user, + name: "I User#{i}", + username: "i-user-#{i}-#{suffix}", + email: "i-user-#{i}@#{suffix}.com" + ) + + # need owner access to allow changing Issue#created_at + project.add_owner(user) + end + + AuthorizedProjectUpdate::ProjectRecalculateService.new(project).execute + # Refind object toreload ProjectTeam association which is memoized at Project model + @project = Project.find(project.id) + end + + def create_milestones! + 3.times do |i| + params = { + project: project, + title: "Sprint #{i}", + description: FFaker::Lorem.sentence, + state: [:active, :closed].sample + } + + FactoryBot.create(:milestone, **params) + end + end + + def suffix + @suffix ||= Time.now.to_i + end + def labels @labels_pool ||= project.labels.limit(rand(3)).pluck(:title).tap do |labels_array| labels_array.concat(project.group.labels.limit(rand(3)).pluck(:title)) if project.group diff --git a/qa/qa/flow/merge_request.rb b/qa/qa/flow/merge_request.rb index 24abfa9e356..040fd8bdd51 100644 --- a/qa/qa/flow/merge_request.rb +++ b/qa/qa/flow/merge_request.rb @@ -22,7 +22,7 @@ module QA return end - Page::Project::Menu.perform(&:click_merge_requests) + Page::Project::Menu.perform(&:go_to_merge_requests) Page::MergeRequest::Index.perform(&:click_new_merge_request) Page::MergeRequest::New.perform do |merge_request| merge_request.select_source_branch(source_branch) diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb index c8f826b20e7..fc6c53049b6 100644 --- a/qa/qa/page/group/menu.rb +++ b/qa/qa/page/group/menu.rb @@ -5,174 +5,13 @@ module QA module Group class Menu < Page::Base include QA::Page::SubMenus::Common - - if Runtime::Env.super_sidebar_enabled? - prepend Page::SubMenus::SuperSidebar::Manage - prepend Page::SubMenus::SuperSidebar::Plan - prepend Page::SubMenus::SuperSidebar::Settings - prepend SubMenus::SuperSidebar::Main - prepend SubMenus::SuperSidebar::Build - prepend SubMenus::SuperSidebar::Operate - prepend SubMenus::SuperSidebar::Deploy - end - - def click_group_members_item - return go_to_members if Runtime::Env.super_sidebar_enabled? - - hover_group_information do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Members') - end - end - end - - def click_subgroup_members_item - return go_to_members if Runtime::Env.super_sidebar_enabled? - - hover_subgroup_information do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Members') - end - end - end - - def click_settings - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Settings') - end - end - - def click_group_general_settings_item - return go_to_general_settings if Runtime::Env.super_sidebar_enabled? - - hover_group_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'General') - end - end - end - - def go_to_milestones - hover_issues do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Milestones') - end - end - end - - def go_to_runners - hover_group_ci_cd do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Runners') - end - end - end - - def go_to_package_settings - hover_group_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Packages and registries') - end - end - end - - def go_to_group_packages - return go_to_package_registry if Runtime::Env.super_sidebar_enabled? - - hover_group_packages do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Package Registry') - end - end - end - - def go_to_group_dependency_proxy - return go_to_dependency_proxy if Runtime::Env.super_sidebar_enabled? - - hover_group_packages do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Dependency Proxy') - end - end - end - - def go_to_repository_settings - hover_group_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Repository') - end - end - end - - def go_to_access_token_settings - hover_group_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Access Tokens') - end - end - end - - private - - def hover_settings - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Settings') - find_element(:sidebar_menu_link, menu_item: 'Settings').hover - - yield - end - end - - def hover_issues - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Issues') - find_element(:sidebar_menu_link, menu_item: 'Issues').hover - - yield - end - end - - def hover_group_information - within_sidebar do - find_element(:sidebar_menu_link, menu_item: 'Group information').hover - - yield - end - end - - def hover_subgroup_information - within_sidebar do - find_element(:sidebar_menu_link, menu_item: 'Subgroup information').hover - - yield - end - end - - def hover_group_ci_cd - within_sidebar do - find_element(:sidebar_menu_link, menu_item: 'CI/CD').hover - - yield - end - end - - def hover_group_packages - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Packages and registries') - find_element(:sidebar_menu_link, menu_item: 'Packages and registries').hover - - yield - end - end - - def hover_group_settings - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Settings') - find_element(:sidebar_menu_link, menu_item: 'Settings').hover - - yield - end - end + include Page::SubMenus::SuperSidebar::Manage + include Page::SubMenus::SuperSidebar::Plan + include Page::SubMenus::SuperSidebar::Settings + include SubMenus::SuperSidebar::Main + include SubMenus::SuperSidebar::Build + include SubMenus::SuperSidebar::Operate + include SubMenus::SuperSidebar::Deploy end end end diff --git a/qa/qa/page/group/sub_menus/super_sidebar/deploy.rb b/qa/qa/page/group/sub_menus/super_sidebar/deploy.rb index 4d205898bf6..c6764b3a5f0 100644 --- a/qa/qa/page/group/sub_menus/super_sidebar/deploy.rb +++ b/qa/qa/page/group/sub_menus/super_sidebar/deploy.rb @@ -8,7 +8,7 @@ module QA module Deploy extend QA::Page::PageConcern - def self.prepended(base) + def self.included(base) super base.class_eval do diff --git a/qa/qa/page/group/sub_menus/super_sidebar/main.rb b/qa/qa/page/group/sub_menus/super_sidebar/main.rb index 1bc6fa84935..e470c03b9e5 100644 --- a/qa/qa/page/group/sub_menus/super_sidebar/main.rb +++ b/qa/qa/page/group/sub_menus/super_sidebar/main.rb @@ -8,7 +8,7 @@ module QA module Main extend QA::Page::PageConcern - def self.prepended(base) + def self.included(base) super base.class_eval do diff --git a/qa/qa/page/group/sub_menus/super_sidebar/operate.rb b/qa/qa/page/group/sub_menus/super_sidebar/operate.rb index 640e1e969de..c0b7aaec48e 100644 --- a/qa/qa/page/group/sub_menus/super_sidebar/operate.rb +++ b/qa/qa/page/group/sub_menus/super_sidebar/operate.rb @@ -8,7 +8,7 @@ module QA module Operate extend QA::Page::PageConcern - def self.prepended(base) + def self.included(base) super base.class_eval do diff --git a/qa/qa/page/profile/menu.rb b/qa/qa/page/profile/menu.rb index f9493dbefcc..8b1f2f9be5b 100644 --- a/qa/qa/page/profile/menu.rb +++ b/qa/qa/page/profile/menu.rb @@ -4,64 +4,27 @@ module QA module Page module Profile class Menu < Page::Base - prepend QA::Mobile::Page::SubMenus::Common if QA::Runtime::Env.mobile_layout? - # TODO: integrate back once super sidebar becomes default - prepend QA::Page::Profile::SuperSidebar::Menu if QA::Runtime::Env.super_sidebar_enabled? - - view 'lib/sidebars/user_settings/menus/access_tokens_menu.rb' do - element :access_token_link - end - - view 'lib/sidebars/user_settings/menus/ssh_keys_menu.rb' do - element :ssh_keys_link - end - - view 'lib/sidebars/user_settings/menus/emails_menu.rb' do - element :profile_emails_link - end - - view 'lib/sidebars/user_settings/menus/password_menu.rb' do - element :profile_password_link - end - - view 'lib/sidebars/user_settings/menus/account_menu.rb' do - element :profile_account_link - end - - def click_access_tokens - within_sidebar do - click_element(:access_token_link) - end - end + include SubMenus::CreateNewMenu + include SubMenus::SuperSidebar::ContextSwitcher def click_ssh_keys - within_sidebar do - click_element(:ssh_keys_link) - end + click_element(:nav_item_link, submenu_item: 'SSH Keys') end def click_account - within_sidebar do - click_element(:profile_account_link) - end + click_element(:nav_item_link, submenu_item: 'Account') end def click_emails - within_sidebar do - click_element(:profile_emails_link) - end + click_element(:nav_item_link, submenu_item: 'Emails') end def click_password - within_sidebar do - click_element(:profile_password_link) - end + click_element(:nav_item_link, submenu_item: 'Password') end - private - - def within_sidebar(&block) - page.within('.sidebar-top-level-items', &block) + def click_access_tokens + click_element(:nav_item_link, submenu_item: 'Access Tokens') end end end diff --git a/qa/qa/page/profile/super_sidebar/menu.rb b/qa/qa/page/profile/super_sidebar/menu.rb deleted file mode 100644 index ade9c47313d..00000000000 --- a/qa/qa/page/profile/super_sidebar/menu.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Profile - module SuperSidebar - module Menu - def click_ssh_keys - click_element(:nav_item_link, submenu_item: 'SSH Keys') - end - - def click_account - click_element(:nav_item_link, submenu_item: 'Account') - end - - def click_emails - click_element(:nav_item_link, submenu_item: 'Emails') - end - - def click_password - click_element(:nav_item_link, submenu_item: 'Password') - end - - def click_access_tokens - click_element(:nav_item_link, submenu_item: 'Access Tokens') - end - end - end - end - end -end diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 534a4da8426..5771484c5a6 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -5,83 +5,16 @@ module QA module Project class Menu < Page::Base include SubMenus::Common - include SubMenus::Project - include SubMenus::CiCd - include SubMenus::Issues - include SubMenus::Deployments - include SubMenus::Monitor - include SubMenus::Infrastructure - include SubMenus::Repository - include SubMenus::Settings - include SubMenus::Packages include SubMenus::CreateNewMenu - - if Runtime::Env.super_sidebar_enabled? - include Page::SubMenus::SuperSidebar::Manage - include Page::SubMenus::SuperSidebar::Deploy - include SubMenus::SuperSidebar::Plan - include SubMenus::SuperSidebar::Settings - include SubMenus::SuperSidebar::Code - include SubMenus::SuperSidebar::Build - include SubMenus::SuperSidebar::Operate - include SubMenus::SuperSidebar::Monitor - include SubMenus::SuperSidebar::Main - end - - def click_merge_requests - return go_to_merge_requests if Runtime::Env.super_sidebar_enabled? - - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Merge requests') - end - end - - def click_wiki - return go_to_wiki if Runtime::Env.super_sidebar_enabled? - - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Wiki') - end - end - - def click_activity - return go_to_activity if Runtime::Env.super_sidebar_enabled? - - hover_project_information do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Activity') - end - end - end - - def click_snippets - return go_to_snippets if Runtime::Env.super_sidebar_enabled? - - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Snippets') - end - end - - def click_members - return go_to_members if Runtime::Env.super_sidebar_enabled? - - hover_project_information do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Members') - end - end - end - - private - - def hover_project_information - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Project information') - find_element(:sidebar_menu_link, menu_item: 'Project information').hover - - yield - end - end + include SubMenus::SuperSidebar::Plan + include SubMenus::SuperSidebar::Settings + include SubMenus::SuperSidebar::Code + include SubMenus::SuperSidebar::Build + include SubMenus::SuperSidebar::Operate + include SubMenus::SuperSidebar::Monitor + include SubMenus::SuperSidebar::Main + include Page::SubMenus::SuperSidebar::Manage + include Page::SubMenus::SuperSidebar::Deploy end end end diff --git a/qa/qa/page/project/sub_menus/ci_cd.rb b/qa/qa/page/project/sub_menus/ci_cd.rb deleted file mode 100644 index 3547ea76182..00000000000 --- a/qa/qa/page/project/sub_menus/ci_cd.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module CiCd - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_pipelines - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'CI/CD') - end - end - - def go_to_pipeline_editor - hover_ci_cd_pipelines do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Editor') - end - end - end - - private - - def hover_ci_cd_pipelines - within_sidebar do - find_element(:sidebar_menu_link, menu_item: 'CI/CD').hover - - yield - end - end - end - end - end - end -end - -QA::Page::Project::SubMenus::CiCd.prepend_mod_with('Page::Project::SubMenus::CiCd', namespace: QA) diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index 280d28a697d..563bc9257c5 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -13,14 +13,6 @@ module QA base.class_eval do include QA::Page::SubMenus::Common - view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do - element :sidebar_menu_item_link - end - - view 'app/views/shared/nav/_sidebar_menu.html.haml' do - element :sidebar_menu_link - end - view 'app/views/layouts/nav/_top_bar.html.haml' do element :toggle_mobile_nav_button end diff --git a/qa/qa/page/project/sub_menus/create_new_menu.rb b/qa/qa/page/project/sub_menus/create_new_menu.rb index cfb91c29d5e..f79478b09d4 100644 --- a/qa/qa/page/project/sub_menus/create_new_menu.rb +++ b/qa/qa/page/project/sub_menus/create_new_menu.rb @@ -11,21 +11,12 @@ module QA super base.class_eval do - # TODO: remove this when the super sidebar is enabled by default - view 'app/helpers/nav/new_dropdown_helper.rb' do - element :new_issue_link - end - - view 'app/helpers/sidebars_helper.rb' do - element :create_menu_item - end + include QA::Page::SubMenus::CreateNewMenu end end def go_to_new_issue within_new_item_menu do - next click_element(:new_issue_link) unless QA::Runtime::Env.super_sidebar_enabled? - click_element(:create_menu_item, create_menu_item: 'new_issue') end end diff --git a/qa/qa/page/project/sub_menus/deployments.rb b/qa/qa/page/project/sub_menus/deployments.rb deleted file mode 100644 index 24243cb2436..00000000000 --- a/qa/qa/page/project/sub_menus/deployments.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Deployments - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_deployments_environments - hover_deployments do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Environments') - end - end - end - - private - - def hover_deployments - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Deployments') - find_element(:sidebar_menu_link, menu_item: 'Deployments').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/infrastructure.rb b/qa/qa/page/project/sub_menus/infrastructure.rb deleted file mode 100644 index 2c207022c8d..00000000000 --- a/qa/qa/page/project/sub_menus/infrastructure.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Infrastructure - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_infrastructure_kubernetes - hover_infrastructure do - within_submenu do - click_link('Kubernetes clusters') - end - end - end - - private - - def hover_infrastructure - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Infrastructure') - find_element(:sidebar_menu_link, menu_item: 'Infrastructure').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb deleted file mode 100644 index b5b918e076d..00000000000 --- a/qa/qa/page/project/sub_menus/issues.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Issues - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_issues - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Issues') - end - end - - def click_milestones - within_sidebar do - click_element(:sidebar_menu_item_link, menu_item: 'Milestones') - end - end - - def go_to_issue_boards - hover_issues do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Boards') - end - end - end - - def go_to_labels - hover_issues do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Labels') - end - end - end - - def go_to_milestones - hover_issues do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Milestones') - end - end - end - - def go_to_jira_issues - hover_issues do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Jira issues') - end - end - end - - private - - def hover_issues - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Issues') - find_element(:sidebar_menu_link, menu_item: 'Issues').hover - - yield - end - end - end - end - end - end -end - -QA::Page::Project::SubMenus::Issues.prepend_mod_with('Page::Project::SubMenus::Issues', namespace: QA) diff --git a/qa/qa/page/project/sub_menus/monitor.rb b/qa/qa/page/project/sub_menus/monitor.rb deleted file mode 100644 index 00774261467..00000000000 --- a/qa/qa/page/project/sub_menus/monitor.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Monitor - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_monitor_incidents - hover_monitor do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Incidents') - end - end - end - - def go_to_monitor_alerts - hover_monitor do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Alerts') - end - end - end - - def go_to_monitor_on_call_schedules - hover_monitor do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'On-call Schedules') - end - end - end - - def go_to_monitor_escalation_policies - hover_monitor do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Escalation Policies') - end - end - end - - private - - def hover_monitor - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Monitor') - find_element(:sidebar_menu_link, menu_item: 'Monitor').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/packages.rb b/qa/qa/page/project/sub_menus/packages.rb deleted file mode 100644 index 9f3446bfd39..00000000000 --- a/qa/qa/page/project/sub_menus/packages.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Packages - extend QA::Page::PageConcern - - def go_to_package_registry - hover_registry do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Package Registry') - end - end - end - - def go_to_container_registry - hover_registry do - within_submenu do - click_link('Container Registry') - end - end - end - - def go_to_infrastructure_registry - hover_registry do - within_submenu do - click_link('Terraform modules') - end - end - end - - private - - def hover_registry - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Packages and registries') - find_element(:sidebar_menu_link, menu_item: 'Packages and registries').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/project.rb b/qa/qa/page/project/sub_menus/project.rb deleted file mode 100644 index 89d4ed578ed..00000000000 --- a/qa/qa/page/project/sub_menus/project.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Project - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def click_project - retry_on_exception do - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Project scope') - end - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/repository.rb b/qa/qa/page/project/sub_menus/repository.rb deleted file mode 100644 index 274dd3a58c8..00000000000 --- a/qa/qa/page/project/sub_menus/repository.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Repository - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def click_repository - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Repository') - end - end - - def go_to_repository_branches - hover_repository do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Branches') - end - end - end - - def go_to_repository_tags - hover_repository do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Tags') - end - end - end - - def go_to_repository_contributors - return go_to_contributor_statistics if Runtime::Env.super_sidebar_enabled? - - hover_repository do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Contributor statistics') - end - end - end - - private - - def hover_repository - within_sidebar do - find_element(:sidebar_menu_link, menu_item: 'Repository').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb deleted file mode 100644 index 2ed4c28afb7..00000000000 --- a/qa/qa/page/project/sub_menus/settings.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module SubMenus - module Settings - extend QA::Page::PageConcern - - def self.included(base) - super - - base.class_eval do - include QA::Page::Project::SubMenus::Common - end - end - - def go_to_ci_cd_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'CI/CD') - end - end - end - - def go_to_repository_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Repository') - end - end - end - - def go_to_general_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'General') - end - end - end - - def click_settings - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Settings') - end - end - - def go_to_integrations_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Integrations') - end - end - end - - def go_to_monitor_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Monitor') - end - end - end - - def go_to_access_token_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Access Tokens') - end - end - end - - def go_to_pages_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Pages') - end - end - end - - def go_to_merge_request_settings - hover_settings do - within_submenu do - click_element(:sidebar_menu_item_link, menu_item: 'Merge requests') - end - end - end - - private - - def hover_settings - within_sidebar do - scroll_to_element(:sidebar_menu_link, menu_item: 'Settings') - find_element(:sidebar_menu_link, menu_item: 'Settings').hover - - yield - end - end - end - end - end - end -end diff --git a/qa/qa/page/sub_menus/common.rb b/qa/qa/page/sub_menus/common.rb index 10d1fc28d37..dc878674877 100644 --- a/qa/qa/page/sub_menus/common.rb +++ b/qa/qa/page/sub_menus/common.rb @@ -4,12 +4,12 @@ module QA module Page module SubMenus module Common - prepend Mobile::Page::SubMenus::Common if QA::Runtime::Env.mobile_layout? - def self.included(base) super base.class_eval do + prepend Mobile::Page::SubMenus::Common if QA::Runtime::Env.mobile_layout? + view 'app/assets/javascripts/super_sidebar/components/super_sidebar.vue' do element :navbar end @@ -33,7 +33,7 @@ module QA yield end - # Implementation for super-sidebar, will replace within_submenu + # Open sidebar navigation submenu # # @param [String] parent_menu_name # @param [String] parent_section_id diff --git a/qa/qa/page/sub_menus/super_sidebar/context_switcher.rb b/qa/qa/page/sub_menus/super_sidebar/context_switcher.rb index 83e84661553..41d13d9d192 100644 --- a/qa/qa/page/sub_menus/super_sidebar/context_switcher.rb +++ b/qa/qa/page/sub_menus/super_sidebar/context_switcher.rb @@ -7,7 +7,7 @@ module QA module ContextSwitcher extend QA::Page::PageConcern - def self.prepended(base) + def self.included(base) super base.class_eval do diff --git a/qa/qa/page/user/show.rb b/qa/qa/page/user/show.rb index 1cfaca2fc57..e5ee943a69d 100644 --- a/qa/qa/page/user/show.rb +++ b/qa/qa/page/user/show.rb @@ -4,10 +4,6 @@ module QA module Page module User class Show < Page::Base - view 'app/views/users/show.html.haml' do - element :following_tab - end - view 'app/views/users/_follow_user.html.haml' do element :follow_user_link end @@ -25,9 +21,7 @@ module QA end def click_following_tab - return click_element(:nav_item_link, submenu_item: 'Following') if Runtime::Env.super_sidebar_enabled? - - click_element(:following_tab) + click_element(:nav_item_link, submenu_item: 'Following') end def click_user_link(username) diff --git a/qa/qa/resource/project_snippet.rb b/qa/qa/resource/project_snippet.rb index 9a22966efdb..0e546cef8f8 100644 --- a/qa/qa/resource/project_snippet.rb +++ b/qa/qa/resource/project_snippet.rb @@ -12,7 +12,7 @@ module QA def fabricate! project.visit! - Page::Project::Menu.perform { |sidebar| sidebar.click_snippets } + Page::Project::Menu.perform(&:go_to_snippets) Page::Project::Snippet::New.perform do |new_snippet| new_snippet.click_create_first_snippet diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 7c9a6c93335..f88ffd05332 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -667,10 +667,6 @@ module QA ENV['DEFAULT_CHROME_DOWNLOAD_PATH'] || Dir.tmpdir end - def super_sidebar_enabled? - enabled?(ENV['QA_SUPER_SIDEBAR_ENABLED'], default: true) - end - def require_slack_env! missing_env = %i[slack_workspace slack_email slack_password].select do |method| ::QA::Runtime::Env.public_send(method).nil? diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index 2d05fc4b902..d7f088e08e3 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -17,25 +17,31 @@ module QA end let(:group) do - create(:group, sandbox: sandbox_group, api_client: owner_api_client, path: "group-with-2fa-#{SecureRandom.hex(8)}") + create(:group, sandbox: sandbox_group, api_client: owner_api_client, + path: "group-with-2fa-#{SecureRandom.hex(8)}") end let(:developer_user) { create(:user, username: "developer_user_#{SecureRandom.hex(4)}", api_client: admin_api_client) } - let(:two_fa_expected_text) { /The group settings for.*require you to enable Two-Factor Authentication for your account.*You need to do this before/ } + let(:two_fa_expected_text) do + /The group settings for.*require you to enable Two-Factor Authentication for your account.*You need to do this before/ + end before do group.add_member(developer_user, Resource::Members::AccessLevel::DEVELOPER) end + after do + group.set_require_two_factor_authentication(value: 'false') + group.remove_via_api! do |resource| + resource.api_client = admin_api_client + end + developer_user.remove_via_api! + end + it( 'allows enforcing 2FA via UI and logging in with 2FA', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931', - quarantine: { - type: :bug, - only: { condition: -> { QA::Runtime::Env.super_sidebar_enabled? } }, - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/409336' - } + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931' ) do enforce_two_factor_authentication_on_group(group) @@ -58,21 +64,13 @@ module QA expect(Page::Main::Menu.perform(&:signed_in?)).to be_truthy end - after do - group.set_require_two_factor_authentication(value: 'false') - group.remove_via_api! do |resource| - resource.api_client = admin_api_client - end - developer_user.remove_via_api! - end - # We are intentionally using the UI to enforce 2FA to exercise the flow with UI. # Any future tests should use the API for this purpose. def enforce_two_factor_authentication_on_group(group) Flow::Login.while_signed_in(as: owner_user) do group.visit! - Page::Group::Menu.perform(&:click_group_general_settings_item) + Page::Group::Menu.perform(&:go_to_general_settings) Page::Group::Settings::General.perform(&:set_require_2fa_enabled) QA::Support::Retrier.retry_on_exception(reload_page: page) do diff --git a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb index afc7e8202e2..8b6c35ea63d 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb @@ -18,7 +18,7 @@ module QA it 'is received by a user for project invitation', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347961' do project.visit! - Page::Project::Menu.perform(&:click_members) + Page::Project::Menu.perform(&:go_to_members) Page::Project::Members.perform do |member_settings| member_settings.add_member(user.username) end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb index fe4a8aad109..109331630d7 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb @@ -22,7 +22,7 @@ module QA user Flow::Login.sign_in_as_admin project.visit! - Page::Project::Menu.perform(&:click_members) + Page::Project::Menu.perform(&:go_to_members) Page::Project::Members.perform do |members| members.add_member(user.username) end diff --git a/qa/qa/specs/features/browser_ui/2_plan/project_wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/project_wiki/project_based_content_creation_spec.rb index 19c9ac6c238..9881b1ad6b8 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/project_wiki/project_based_content_creation_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/project_wiki/project_based_content_creation_spec.rb @@ -18,7 +18,7 @@ module QA testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do project.visit! - Page::Project::Menu.perform(&:click_wiki) + Page::Project::Menu.perform(&:go_to_wiki) Page::Project::Wiki::Show.perform(&:click_create_your_first_page) Page::Project::Wiki::Edit.perform do |edit| diff --git a/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb b/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb index dae0e17746c..6b698d089f6 100644 --- a/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb @@ -142,7 +142,7 @@ module QA project.group.visit! - Page::Group::Menu.perform(&:go_to_group_dependency_proxy) + Page::Group::Menu.perform(&:go_to_dependency_proxy) Page::Group::DependencyProxy.perform do |index| expect(index).to have_blob_count("Contains 1 blobs of images") diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb index 04e020178ee..c6504ed3b18 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb @@ -163,7 +163,7 @@ module QA project.group.visit! - Page::Group::Menu.perform(&:go_to_group_packages) + Page::Group::Menu.perform(&:go_to_package_registry) Page::Project::Packages::Index.perform do |index| expect(index).to have_package(package.name) diff --git a/qa/qa/specs/features/browser_ui/9_data_stores/group/transfer_group_spec.rb b/qa/qa/specs/features/browser_ui/9_data_stores/group/transfer_group_spec.rb index 2a1f8a58108..41e6723d300 100644 --- a/qa/qa/specs/features/browser_ui/9_data_stores/group/transfer_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/9_data_stores/group/transfer_group_spec.rb @@ -18,7 +18,7 @@ module QA it 'transfers a subgroup to another group', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347692' do - Page::Group::Menu.perform(&:click_group_general_settings_item) + Page::Group::Menu.perform(&:go_to_general_settings) Page::Group::Settings::General.perform do |general| general.transfer_group(sub_group_for_transfer, target_group) diff --git a/qa/qa/specs/features/browser_ui/9_data_stores/project/add_project_member_spec.rb b/qa/qa/specs/features/browser_ui/9_data_stores/project/add_project_member_spec.rb index 7fb970c3f25..41c8bcd53ef 100644 --- a/qa/qa/specs/features/browser_ui/9_data_stores/project/add_project_member_spec.rb +++ b/qa/qa/specs/features/browser_ui/9_data_stores/project/add_project_member_spec.rb @@ -11,7 +11,7 @@ module QA project = create(:project, name: 'add-member-project') project.visit! - Page::Project::Menu.perform(&:click_members) + Page::Project::Menu.perform(&:go_to_members) Page::Project::Members.perform do |members| members.add_member(user.username) members.search_member(user.username) diff --git a/qa/qa/specs/features/browser_ui/9_data_stores/project/invite_group_to_project_spec.rb b/qa/qa/specs/features/browser_ui/9_data_stores/project/invite_group_to_project_spec.rb index 29e39d48c67..28253c1f1df 100644 --- a/qa/qa/specs/features/browser_ui/9_data_stores/project/invite_group_to_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/9_data_stores/project/invite_group_to_project_spec.rb @@ -5,7 +5,7 @@ module QA describe 'Invite group', :reliable, product_group: :tenant_scale do shared_examples 'invites group to project' do it 'grants group and members correct access level' do - Page::Project::Menu.perform(&:click_members) + Page::Project::Menu.perform(&:go_to_members) Page::Project::Members.perform do |project_members| project_members.invite_group(group.path, 'Developer') diff --git a/qa/qa/specs/features/browser_ui/9_data_stores/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/9_data_stores/project/view_project_activity_spec.rb index 5cdb88407fb..c5a6e92cb99 100644 --- a/qa/qa/specs/features/browser_ui/9_data_stores/project/view_project_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/9_data_stores/project/view_project_activity_spec.rb @@ -15,7 +15,7 @@ module QA end.project project.visit! - Page::Project::Menu.perform(&:click_activity) + Page::Project::Menu.perform(&:go_to_activity) Page::Project::Activity.perform do |activity| activity.click_push_events diff --git a/qa/qa/specs/features/browser_ui/9_data_stores/user/parent_group_access_termination_spec.rb b/qa/qa/specs/features/browser_ui/9_data_stores/user/parent_group_access_termination_spec.rb index 84ef9e7a77c..6895b6a3268 100644 --- a/qa/qa/specs/features/browser_ui/9_data_stores/user/parent_group_access_termination_spec.rb +++ b/qa/qa/specs/features/browser_ui/9_data_stores/user/parent_group_access_termination_spec.rb @@ -24,7 +24,7 @@ module QA Flow::Login.while_signed_in_as_admin do group.visit! - Page::Group::Menu.perform(&:click_subgroup_members_item) + Page::Group::Menu.perform(&:go_to_members) Page::Group::Members.perform do |members_page| members_page.search_member(user.username) members_page.remove_member(user.username) diff --git a/qa/qa/specs/helpers/context_selector.rb b/qa/qa/specs/helpers/context_selector.rb index 3ef729c4500..aab2a82d90e 100644 --- a/qa/qa/specs/helpers/context_selector.rb +++ b/qa/qa/specs/helpers/context_selector.rb @@ -116,12 +116,12 @@ module QA # @return [String] 'gitlab' or 'jihulab' def production_domain(tld) return 'gitlab' unless GitlabEdition.jh? - return 'gitlab' if tld == 'hk' + return 'gitlab' if tld == 'hk' || tld == 'cn' return 'jihulab' if tld == 'com' end def opts_tld - GitlabEdition.jh? ? '(.com|.hk)' : '(.com|.net)' + GitlabEdition.jh? ? '(.com|.hk|.cn)' : '(.com|.net)' end def get_tld(host) diff --git a/qa/spec/specs/helpers/context_selector_spec.rb b/qa/spec/specs/helpers/context_selector_spec.rb index 369ee60d31d..a4573d96523 100644 --- a/qa/spec/specs/helpers/context_selector_spec.rb +++ b/qa/spec/specs/helpers/context_selector_spec.rb @@ -30,11 +30,19 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do end it 'returns true when url has .net' do + allow(GitlabEdition).to receive(:jh?).and_return(false) QA::Runtime::Scenario.define(:gitlab_address, "https://release.gitlab.net") expect(described_class.context_matches?).to be_truthy end + it 'returns true when url has .cn on jh side' do + allow(GitlabEdition).to receive(:jh?).and_return(true) + QA::Runtime::Scenario.define(:gitlab_address, "https://release.gitlab.cn") + + expect(described_class.context_matches?).to be_truthy + end + it 'returns false when url does not have .com' do QA::Runtime::Scenario.define(:gitlab_address, "https://gitlab.test") @@ -83,6 +91,9 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do QA::Runtime::Scenario.define(:gitlab_address, "https://gitlab.hk/") expect(described_class.context_matches?(:production)).to be_truthy + + QA::Runtime::Scenario.define(:gitlab_address, "https://gitlab.cn/") + expect(described_class.context_matches?(:production)).to be_truthy end it 'matches domain' do diff --git a/spec/frontend/issues/show/store_spec.js b/spec/frontend/issues/show/store_spec.js deleted file mode 100644 index 20d3a6cdaae..00000000000 --- a/spec/frontend/issues/show/store_spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import Store from '~/issues/show/stores'; -import updateDescription from '~/issues/show/utils/update_description'; - -jest.mock('~/issues/show/utils/update_description'); - -describe('Store', () => { - let store; - - beforeEach(() => { - store = new Store({ - descriptionHtml: '
This is a description
', - }); - }); - - describe('updateState', () => { - beforeEach(() => { - document.body.innerHTML = ` -