diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-22 00:16:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-22 00:16:43 +0000 |
commit | 6e3df404ce4365d20af0e06484528b29f92c31a3 (patch) | |
tree | 5c6b3eaf09be6e10611c59cf1209b707c7c9ab76 | |
parent | 9fe1a4945b8db40c6b5d7b3ce7c6dbc93cdf67be (diff) | |
download | gitlab-ce-6e3df404ce4365d20af0e06484528b29f92c31a3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
137 files changed, 911 insertions, 933 deletions
diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index a7ecfebbafb..1eea9729550 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -461,7 +461,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/administration/operations/moving_repositories.md @eread /doc/administration/package_information/ @axil /doc/administration/packages/ @marcel.amirault -/doc/administration/pages/ @ashrafkhamis /doc/administration/polling.md @axil /doc/administration/postgresql/ @aqualls /doc/administration/postgresql/multiple_databases.md @lciutacu @@ -490,7 +489,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/administration/troubleshooting/postgresql.md @aqualls /doc/administration/uploads.md @axil /doc/administration/user_settings.md @jglassman1 -/doc/administration/wikis/ @ashrafkhamis /doc/api/access_requests.md @jglassman1 /doc/api/admin_sidekiq_queues.md @axil /doc/api/alert_management_alerts.md @msedlakjakubowski @@ -551,7 +549,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/api/group_relations_export.md @eread /doc/api/group_releases.md @phillipwells /doc/api/group_repository_storage_moves.md @ashrafkhamis -/doc/api/group_wikis.md @ashrafkhamis /doc/api/groups.md @lciutacu /doc/api/import.md @eread /doc/api/index.md @ashrafkhamis @@ -588,8 +585,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/api/openapi/ @ashrafkhamis /doc/api/packages.md @marcel.amirault /doc/api/packages/ @marcel.amirault -/doc/api/pages.md @ashrafkhamis -/doc/api/pages_domains.md @ashrafkhamis /doc/api/personal_access_tokens.md @eread /doc/api/pipeline_schedules.md @drcatherinepope /doc/api/pipeline_triggers.md @drcatherinepope @@ -651,7 +646,7 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/api/vulnerabilities.md @rdickenson /doc/api/vulnerability_exports.md @rdickenson /doc/api/vulnerability_findings.md @rdickenson -/doc/api/wikis.md @ashrafkhamis +/doc/architecture/blueprints/cells/ @lciutacu /doc/architecture/blueprints/database/scalability/patterns/ @aqualls /doc/architecture/blueprints/database_scaling/ @aqualls /doc/ci/ @drcatherinepope @@ -715,9 +710,9 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/development/developing_with_solargraph.md @aqualls /doc/development/development_processes.md @sselhorn /doc/development/distributed_tracing.md @msedlakjakubowski +/doc/development/distribution/ @axil /doc/development/documentation/ @sselhorn /doc/development/export_csv.md @eread -/doc/development/fe_guide/content_editor.md @ashrafkhamis /doc/development/fe_guide/customizable_dashboards.md @lciutacu /doc/development/fe_guide/dark_mode.md @sselhorn /doc/development/fe_guide/graphql.md @sselhorn @@ -758,7 +753,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/development/omnibus.md @axil /doc/development/organization/ @lciutacu /doc/development/packages/ @marcel.amirault -/doc/development/pages/ @ashrafkhamis /doc/development/permissions.md @jglassman1 /doc/development/policies.md @jglassman1 /doc/development/project_templates.md @aqualls @@ -775,7 +769,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/development/testing_guide/ @sselhorn /doc/development/value_stream_analytics.md @lciutacu /doc/development/value_stream_analytics/ @lciutacu -/doc/development/wikis.md @ashrafkhamis /doc/development/work_items.md @msedlakjakubowski /doc/development/work_items_widgets.md @msedlakjakubowski /doc/development/workhorse/ @aqualls @@ -912,11 +905,11 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/user/permissions.md @jglassman1 /doc/user/product_analytics/ @lciutacu /doc/user/profile/account/ @jglassman1 +/doc/user/profile/comment_templates.md @aqualls /doc/user/profile/contributions_calendar.md @lciutacu /doc/user/profile/index.md @jglassman1 /doc/user/profile/notifications.md @msedlakjakubowski /doc/user/profile/personal_access_tokens.md @jglassman1 -/doc/user/profile/saved_replies.md @aqualls /doc/user/profile/user_passwords.md @jglassman1 /doc/user/project/autocomplete_characters.md @aqualls /doc/user/project/badges.md @lciutacu @@ -948,7 +941,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/user/project/merge_requests/status_checks.md @eread /doc/user/project/milestones/ @msedlakjakubowski /doc/user/project/organize_work_with_projects.md @lciutacu -/doc/user/project/pages/ @ashrafkhamis /doc/user/project/protected_branches.md @aqualls /doc/user/project/protected_tags.md @aqualls /doc/user/project/push_options.md @aqualls @@ -970,7 +962,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab /doc/user/project/time_tracking.md @msedlakjakubowski /doc/user/project/web_ide/ @ashrafkhamis /doc/user/project/web_ide_beta/ @ashrafkhamis -/doc/user/project/wiki/ @ashrafkhamis /doc/user/project/working_with_projects.md @lciutacu /doc/user/public_access.md @lciutacu /doc/user/report_abuse.md @phillipwells diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 385789e60f5..9a9cb2ce36c 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -a5dcb3e33bd34d46db7a6e419a743c65429bfee6 +c4030b2e8f984424f37f2310a7266bb690c8e435 @@ -166,6 +166,7 @@ gem 'google-apis-cloudresourcemanager_v1', '~> 0.31.0' gem 'google-apis-iam_v1', '~> 0.36.0' gem 'google-apis-serviceusage_v1', '~> 0.28.0' gem 'google-apis-sqladmin_v1beta4', '~> 0.41.0' +gem 'google-apis-androidpublisher_v3', '~> 0.34.0' # for aws storage gem 'unf', '~> 0.1.4' diff --git a/Gemfile.checksum b/Gemfile.checksum index 2aeb3a40570..89403a4f1bf 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -219,6 +219,7 @@ {"name":"gitlab_omniauth-ldap","version":"2.2.0","platform":"ruby","checksum":"bb4d20acb3b123ed654a8f6a47d3fac673ece7ed0b6992edb92dca14bad2838c"}, {"name":"globalid","version":"1.0.0","platform":"ruby","checksum":"1253641b1dc3392721c964351773755d75135d3d3c5cc65d88b0a3880a60bed8"}, {"name":"gon","version":"6.4.0","platform":"ruby","checksum":"e3a618d659392890f1aa7db420f17c75fd7d35aeb5f8fe003697d02c4b88d2f0"}, +{"name":"google-apis-androidpublisher_v3","version":"0.34.0","platform":"ruby","checksum":"d7e1d7dd92f79c498fe2082222a1740d788e022e660c135564b3fd299cab5425"}, {"name":"google-apis-cloudbilling_v1","version":"0.21.0","platform":"ruby","checksum":"ea2d847b4409e2ccd7f8a11a58cfcfdcbfb44ffd81c05768389f67341e291e02"}, {"name":"google-apis-cloudresourcemanager_v1","version":"0.31.0","platform":"ruby","checksum":"f0a472a228c0b9b592741380ce79ead2458ea0066a4b5a78635818b9b62efbbf"}, {"name":"google-apis-compute_v1","version":"0.57.0","platform":"ruby","checksum":"404514548abc3a44f5e96393d6a6d588d287548ecb6f5a886ad76e1beea78068"}, diff --git a/Gemfile.lock b/Gemfile.lock index 1df0af6510a..d7c1d970656 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -635,6 +635,8 @@ GEM i18n (>= 0.7) multi_json request_store (>= 1.0) + google-apis-androidpublisher_v3 (0.34.0) + google-apis-core (>= 0.9.1, < 2.a) google-apis-cloudbilling_v1 (0.21.0) google-apis-core (>= 0.9.1, < 2.a) google-apis-cloudresourcemanager_v1 (0.31.0) @@ -1728,6 +1730,7 @@ DEPENDENCIES gitlab_chronic_duration (~> 0.10.6.2) gitlab_omniauth-ldap (~> 2.2.0) gon (~> 6.4.0) + google-apis-androidpublisher_v3 (~> 0.34.0) google-apis-cloudbilling_v1 (~> 0.21.0) google-apis-cloudresourcemanager_v1 (~> 0.31.0) google-apis-compute_v1 (~> 0.57.0) diff --git a/app/controllers/concerns/integrations/params.rb b/app/controllers/concerns/integrations/params.rb index d33d3b046e3..2e6b21e41cb 100644 --- a/app/controllers/concerns/integrations/params.rb +++ b/app/controllers/concerns/integrations/params.rb @@ -63,6 +63,7 @@ module Integrations :namespace, :new_issue_url, :notify_only_broken_pipelines, + :package_name, :password, :priority, :project_key, diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 716be080851..4f6ca5a9617 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -8,10 +8,12 @@ class CommitStatus < Ci::ApplicationRecord include Presentable include BulkInsertableAssociations include TaggableQueries + include SafelyChangeColumnDefault self.table_name = 'ci_builds' self.primary_key = :id partitionable scope: :pipeline + columns_changing_default :partition_id belongs_to :user belongs_to :project diff --git a/app/models/concerns/ci/partitionable.rb b/app/models/concerns/ci/partitionable.rb index 28cc17432bc..5268970db00 100644 --- a/app/models/concerns/ci/partitionable.rb +++ b/app/models/concerns/ci/partitionable.rb @@ -2,7 +2,7 @@ module Ci ## - # This module implements a way to set the `partion_id` value on a dependent + # This module implements a way to set the `partition_id` value on a dependent # resource from a parent record. # Usage: # diff --git a/app/models/integrations/google_play.rb b/app/models/integrations/google_play.rb index 8f1d2e7e1ec..d4e44945843 100644 --- a/app/models/integrations/google_play.rb +++ b/app/models/integrations/google_play.rb @@ -2,6 +2,8 @@ module Integrations class GooglePlay < Integration + PACKAGE_NAME_REGEX = /\A[a-zA-Z0-9]+(\.[a-zA-Z0-9]+){2,20}\z/ + SECTION_TYPE_GOOGLE_PLAY = 'google_play' with_options if: :activated? do @@ -9,8 +11,14 @@ module Integrations filename: "google_service_account_key", parse_json: true } validates :service_account_key_file_name, presence: true + validates :package_name, presence: true, format: { with: PACKAGE_NAME_REGEX } end + field :package_name, + section: SECTION_TYPE_CONNECTION, + placeholder: 'com.example.myapp', + required: true + field :service_account_key_file_name, section: SECTION_TYPE_CONNECTION, required: true, @@ -28,6 +36,7 @@ module Integrations def help variable_list = [ + '<code>SUPPLY_PACKAGE_NAME</code>', '<code>SUPPLY_JSON_KEY_DATA</code>' ] @@ -36,7 +45,7 @@ module Integrations s_("Use the Google Play integration to connect to Google Play with fastlane in CI/CD pipelines."), s_("After you enable the integration, the following protected variable is created for CI/CD use:"), variable_list.join('<br>'), - s_(format("To generate a Google Play service account key and use this integration, see the <a href='%{url}' target='_blank'>integration documentation</a>.", url: "#")).html_safe + s_(format("To generate a Google Play service account key and use this integration, see the <a href='%{url}' target='_blank'>integration documentation</a>.", url: Rails.application.routes.url_helpers.help_page_url('user/project/integrations/google_play'))).html_safe ] # rubocop:enable Layout/LineLength @@ -62,9 +71,9 @@ module Integrations end def test(*_args) - client.fetch_access_token! + client.list_reviews(package_name) { success: true } - rescue Signet::AuthorizationError => error + rescue Google::Apis::ClientError => error { success: false, message: error } end @@ -72,17 +81,22 @@ module Integrations return [] unless activated? [ - { key: 'SUPPLY_JSON_KEY_DATA', value: service_account_key, masked: true, public: false } + { key: 'SUPPLY_JSON_KEY_DATA', value: service_account_key, masked: true, public: false }, + { key: 'SUPPLY_PACKAGE_NAME', value: package_name, masked: false, public: false } ] end private def client - Google::Auth::ServiceAccountCredentials.make_creds( + service = Google::Apis::AndroidpublisherV3::AndroidPublisherService.new # rubocop: disable CodeReuse/ServiceClass + + service.authorization = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: StringIO.new(service_account_key), - scope: ['https://www.googleapis.com/auth/androidpublisher'] + scope: [Google::Apis::AndroidpublisherV3::AUTH_ANDROIDPUBLISHER] ) + + service end end end diff --git a/config/metrics/counts_28d/20210216180747_action_monthly_active_users_wiki_repo.yml b/config/metrics/counts_28d/20210216180747_action_monthly_active_users_wiki_repo.yml index 2a9353caf6a..06407d7a18a 100644 --- a/config/metrics/counts_28d/20210216180747_action_monthly_active_users_wiki_repo.yml +++ b/config/metrics/counts_28d/20210216180747_action_monthly_active_users_wiki_repo.yml @@ -7,7 +7,9 @@ product_stage: create product_group: editor product_category: wiki value_type: number -status: active +status: removed +milestone_removed: "15.10" +removed_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/114997" time_frame: 28d data_source: redis_hll instrumentation_class: RedisHLLMetric diff --git a/db/post_migrate/20230321124837_remove_ci_builds_partition_id_default.rb b/db/post_migrate/20230321124837_remove_ci_builds_partition_id_default.rb new file mode 100644 index 00000000000..17fd8258e9c --- /dev/null +++ b/db/post_migrate/20230321124837_remove_ci_builds_partition_id_default.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveCiBuildsPartitionIdDefault < Gitlab::Database::Migration[2.1] + enable_lock_retries! + + def up + change_column_default :ci_builds, :partition_id, from: 100, to: nil + end + + def down + change_column_default :ci_builds, :partition_id, from: nil, to: 100 + end +end diff --git a/db/schema_migrations/20230321124837 b/db/schema_migrations/20230321124837 new file mode 100644 index 00000000000..934f467c5e0 --- /dev/null +++ b/db/schema_migrations/20230321124837 @@ -0,0 +1 @@ +17c78ffb8298207d36866e51974fb09432d9ccbbf5f3b401c4335392849f75c3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 79aadffeda6..1a8e7e947c8 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13018,7 +13018,7 @@ CREATE TABLE ci_builds ( scheduling_type smallint, id bigint NOT NULL, stage_id bigint, - partition_id bigint DEFAULT 100 NOT NULL, + partition_id bigint NOT NULL, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ); diff --git a/doc/api/draft_notes.md b/doc/api/draft_notes.md index 079b08781ae..e532de6a502 100644 --- a/doc/api/draft_notes.md +++ b/doc/api/draft_notes.md @@ -169,3 +169,20 @@ PUT /projects/:id/merge_requests/:merge_request_iid/draft_notes/:draft_note_id/p ```shell curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes/5/publish" ``` + +## Publish all pending draft notes + +Bulk publishes all existing draft notes for a given merge request that belong to the user. + +```plaintext +POST /projects/:id/merge_requests/:merge_request_iid/draft_notes/bulk_publish +``` + +| Attribute | Type | Required | Description | +| ------------------- | ----------------- | -------- | --------------------- | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). +| `merge_request_iid` | integer | yes | The IID of a project merge request. + +```shell +curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes/bulk_publish" +``` diff --git a/doc/user/application_security/secret_detection/post_processing.md b/doc/user/application_security/secret_detection/post_processing.md index 22d7a8ba5af..539d9e6fd88 100644 --- a/doc/user/application_security/secret_detection/post_processing.md +++ b/doc/user/application_security/secret_detection/post_processing.md @@ -4,7 +4,7 @@ group: Static Analysis info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments --- -# Secret Detection post-processing and revocation **(ULTIMATE SAAS)** +# Secret Detection post-processing and revocation **(ULTIMATE)** > - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/4639) in GitLab 13.6. > - [Disabled by default for GitLab personal access tokens](https://gitlab.com/gitlab-org/gitlab/-/issues/371658) in GitLab 15.6 [with a flag](../../../administration/feature_flags.md) named `gitlab_pat_auto_revocation`. Available to GitLab.com only. diff --git a/doc/user/project/integrations/google_play.md b/doc/user/project/integrations/google_play.md index 553e82be382..01850be8b8b 100644 --- a/doc/user/project/integrations/google_play.md +++ b/doc/user/project/integrations/google_play.md @@ -27,11 +27,12 @@ To enable the Google Play integration in GitLab: 1. On the top bar, select **Main menu > Projects** and find your project. 1. On the left sidebar, select **Settings > Integrations**. 1. Select **Google Play**. -1. In **Enable Integration**, select the **Active** checkbox. +1. In **Enable integration**, select the **Active** checkbox. +1. In **Package name**, enter the package name of the app (for example, `com.gitlab.app_name`). 1. In **Service account key (.JSON)**, drag or upload your key file. 1. Select **Save changes**. -After you enable the integration, the global variable `$SUPPLY_JSON_KEY_DATA` is created for CI/CD use. +After you enable the integration, the global variables `$SUPPLY_PACKAGE_NAME` and `$SUPPLY_JSON_KEY_DATA` are created for CI/CD use. ### CI/CD variable security diff --git a/lib/api/helpers/integrations_helpers.rb b/lib/api/helpers/integrations_helpers.rb index a5ed029c978..f38fabc9586 100644 --- a/lib/api/helpers/integrations_helpers.rb +++ b/lib/api/helpers/integrations_helpers.rb @@ -456,15 +456,21 @@ module API 'google-play' => [ { required: true, + name: :package_name, + type: String, + desc: 'The package name of the app in Google Play' + }, + { + required: true, name: :service_account_key, type: String, - desc: 'The Google Play Service Account Key' + desc: 'The Google Play service account key' }, { required: true, name: :service_account_key_file_name, type: String, - desc: 'The Google Play Service Account Key File Name' + desc: 'The filename of the Google Play service account key' } ], 'hangouts-chat' => [ diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake index 2ff3dd668b7..a2417128c48 100644 --- a/lib/tasks/gitlab/tw/codeowners.rake +++ b/lib/tasks/gitlab/tw/codeowners.rake @@ -29,7 +29,7 @@ namespace :tw do CodeOwnerRule.new('Code Review', '@aqualls'), CodeOwnerRule.new('Compliance', '@eread'), CodeOwnerRule.new('Composition Analysis', '@rdickenson'), - CodeOwnerRule.new('Configure', '@phillipwells'), + CodeOwnerRule.new('Environments', '@phillipwells'), CodeOwnerRule.new('Container Registry', '@marcel.amirault'), CodeOwnerRule.new('Contributor Experience', '@eread'), CodeOwnerRule.new('Database', '@aqualls'), diff --git a/qa/qa/specs/features/shared_contexts/sends_and_resolves_test_alerts.rb b/qa/qa/specs/features/shared_contexts/sends_and_resolves_test_alerts.rb index a72140f41e0..9623bcbb7b5 100644 --- a/qa/qa/specs/features/shared_contexts/sends_and_resolves_test_alerts.rb +++ b/qa/qa/specs/features/shared_contexts/sends_and_resolves_test_alerts.rb @@ -35,6 +35,8 @@ module QA private def mark_as_resolved(payload, http) + sleep 3 # To ensure create and end time are different + if http payload[:end_time] = Time.now else diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 3df718e0ab6..189cde4de05 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -313,6 +313,25 @@ RSpec.describe 'Database schema', feature_category: :database do expect(problematic_tables).to be_empty end end + + context 'for CI partitioned table' do + # Check that each partitionable model with more than 1 column has the partition_id column at the trailing + # position. Using PARTITIONABLE_MODELS instead of iterating tables since when partitioning existing tables, + # the routing table only gets created after the PK has already been created, which would be too late for a check. + Ci::Partitionable::Testing::PARTITIONABLE_MODELS.each do |klass| + model = klass.safe_constantize + table_name = model.table_name + + primary_key_columns = Array(model.connection.primary_key(table_name)) + next if primary_key_columns.count == 1 + + describe table_name do + it 'expects every PK to have partition_id at trailing position' do + expect(primary_key_columns).to match([an_instance_of(String), 'partition_id']) + end + end + end + end end context 'index names' do diff --git a/spec/factories/integrations.rb b/spec/factories/integrations.rb index f0fe0d56e93..d765e5562b6 100644 --- a/spec/factories/integrations.rb +++ b/spec/factories/integrations.rb @@ -272,6 +272,7 @@ FactoryBot.define do active { true } type { 'Integrations::GooglePlay' } + package_name { 'com.gitlab.foo.bar' } service_account_key_file_name { 'service_account.json' } service_account_key { File.read('spec/fixtures/service_account.json') } end diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index a07a5c48713..34fe98d22bd 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Admin Groups', feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers include Spec::Support::Helpers::ModalHelpers let(:internal) { Gitlab::VisibilityLevel::INTERNAL } diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index 25f77da4401..a64d3f241f6 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do include TermsHelper include UserLoginHelper - include Spec::Support::Helpers::Features::TopNavSpecHelpers + include Features::TopNavSpecHelpers let(:user) { create(:admin) } diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb index 305927663e9..124c43eef9d 100644 --- a/spec/features/admin/admin_mode/workers_spec.rb +++ b/spec/features/admin/admin_mode/workers_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' # Test an operation that triggers background jobs requiring administrative rights RSpec.describe 'Admin mode for workers', :request_store, feature_category: :system_access do - include Spec::Support::Helpers::Features::AdminUsersHelpers + include Features::AdminUsersHelpers let(:user) { create(:user) } let(:user_to_delete) { create(:user) } diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index 3c47a991fd1..f78f32a15fa 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Admin mode', :js, feature_category: :shared do include MobileHelpers - include Spec::Support::Helpers::Features::TopNavSpecHelpers + include Features::TopNavSpecHelpers include StubENV let(:admin) { create(:admin) } diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 405a254dc84..f864a6b3669 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe "Admin::Projects", feature_category: :projects do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers include Spec::Support::Helpers::ModalHelpers include ListboxHelpers diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index d9867c2e704..2c0bac9c801 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe "Admin Runners", feature_category: :runner_fleet do - include Spec::Support::Helpers::Features::RunnersHelpers + include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:admin) { create(:admin) } diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 342e23d0cab..0350c8ab066 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Admin > Users > Impersonation Tokens', :js, feature_category: :system_access do include Spec::Support::Helpers::ModalHelpers - include Spec::Support::Helpers::AccessTokenHelpers + include Features::AccessTokenHelpers let(:admin) { create(:admin) } let!(:user) { create(:user) } diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index 1552d4e6187..71e2429c4fe 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Admin::Users::User', feature_category: :user_management do - include Spec::Support::Helpers::Features::AdminUsersHelpers + include Features::AdminUsersHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') } diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 07db0750074..95f25d5c23d 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Admin::Users', feature_category: :user_management do - include Spec::Support::Helpers::Features::AdminUsersHelpers + include Features::AdminUsersHelpers include Spec::Support::Helpers::ModalHelpers include ListboxHelpers diff --git a/spec/features/canonical_link_spec.rb b/spec/features/canonical_link_spec.rb index d8f9a7584e7..0ed76c30ce4 100644 --- a/spec/features/canonical_link_spec.rb +++ b/spec/features/canonical_link_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Canonical link', feature_category: :remote_development do - include Spec::Support::Helpers::Features::CanonicalLinkHelpers + include Features::CanonicalLinkHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public, namespace: user.namespace) } diff --git a/spec/features/commits/user_uses_quick_actions_spec.rb b/spec/features/commits/user_uses_quick_actions_spec.rb index 6d043a0bb2f..c83a30c99c3 100644 --- a/spec/features/commits/user_uses_quick_actions_spec.rb +++ b/spec/features/commits/user_uses_quick_actions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Commit > User uses quick actions', :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers include RepoHelpers let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb b/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb index a5d6ba58ffa..3040c97a16f 100644 --- a/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb +++ b/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'The group dashboard', :js, feature_category: :subgroups do include ExternalAuthorizationServiceHelpers - include Spec::Support::Helpers::Features::TopNavSpecHelpers + include Features::TopNavSpecHelpers let(:user) { create(:user) } diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index a7734ed50c2..1a2268a838b 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Issues filtering', :js, feature_category: :team_planning do - include Spec::Support::Helpers::Features::SortingHelpers + include Features::SortingHelpers include FilteredSearchHelpers let(:user) { create(:user) } diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index 34bab9dffd0..663cca1eac0 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Merge Requests', feature_category: :code_review_workflow do - include Spec::Support::Helpers::Features::SortingHelpers + include Features::SortingHelpers include FilteredSearchHelpers include ProjectForksHelper diff --git a/spec/features/frequently_visited_projects_and_groups_spec.rb b/spec/features/frequently_visited_projects_and_groups_spec.rb index 19495230795..514b642a2d4 100644 --- a/spec/features/frequently_visited_projects_and_groups_spec.rb +++ b/spec/features/frequently_visited_projects_and_groups_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Frequently visited items', :js, feature_category: :shared do - include Spec::Support::Helpers::Features::TopNavSpecHelpers + include Features::TopNavSpecHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/groups/group_runners_spec.rb b/spec/features/groups/group_runners_spec.rb index ae757e04716..171e4025f49 100644 --- a/spec/features/groups/group_runners_spec.rb +++ b/spec/features/groups/group_runners_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe "Group Runners", feature_category: :runner_fleet do - include Spec::Support::Helpers::Features::RunnersHelpers + include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:group_owner) { create(:user) } diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb index dc33bb11bea..c2ec709576b 100644 --- a/spec/features/groups/members/filter_members_spec.rb +++ b/spec/features/groups/members/filter_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Filter members', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user) { create(:user) } let(:nested_group_user) { create(:user) } diff --git a/spec/features/groups/members/leave_group_spec.rb b/spec/features/groups/members/leave_group_spec.rb index cfb1b24bccb..e1c2d8c0547 100644 --- a/spec/features/groups/members/leave_group_spec.rb +++ b/spec/features/groups/members/leave_group_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Leave group', feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers include Spec::Support::Helpers::ModalHelpers let(:user) { create(:user) } diff --git a/spec/features/groups/members/list_members_spec.rb b/spec/features/groups/members/list_members_spec.rb index 1aea5a76b41..6e20f92c16b 100644 --- a/spec/features/groups/members/list_members_spec.rb +++ b/spec/features/groups/members/list_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Groups > Members > List members', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user1) { create(:user, name: 'John Doe') } let(:user2) { create(:user, name: 'Mary Jane') } diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index ee8786a2e36..f9c11dd0183 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Manage groups', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/groups/members/manage_members_spec.rb b/spec/features/groups/members/manage_members_spec.rb index 5cd5908b359..2d5a3dbb8f8 100644 --- a/spec/features/groups/members/manage_members_spec.rb +++ b/spec/features/groups/members/manage_members_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Manage members', feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:user1) { create(:user, name: 'John Doe') } diff --git a/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb index e9f80b05fa7..4f56c807ec8 100644 --- a/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Owner adds member with expiration date', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers let_it_be(:user1) { create(:user, name: 'John Doe') } let_it_be(:group) { create(:group) } diff --git a/spec/features/groups/members/search_members_spec.rb b/spec/features/groups/members/search_members_spec.rb index 6b2896b194c..80de1cabd1e 100644 --- a/spec/features/groups/members/search_members_spec.rb +++ b/spec/features/groups/members/search_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Search group member', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user) { create :user } let(:member) { create :user } diff --git a/spec/features/groups/members/sort_members_spec.rb b/spec/features/groups/members/sort_members_spec.rb index fa5a14f18b4..d2e5445deae 100644 --- a/spec/features/groups/members/sort_members_spec.rb +++ b/spec/features/groups/members/sort_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Sort members', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:owner) { create(:user, name: 'John Doe', created_at: 5.days.ago, last_activity_on: Date.today) } let(:developer) { create(:user, name: 'Mary Jane', created_at: 1.day.ago, last_sign_in_at: 5.days.ago, last_activity_on: Date.today - 5) } diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 5cab79b40cf..0f936173e5d 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Group show page', feature_category: :subgroups do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group) } diff --git a/spec/features/ide_spec.rb b/spec/features/ide_spec.rb index 2ca8d3f7156..615f2a30b34 100644 --- a/spec/features/ide_spec.rb +++ b/spec/features/ide_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'IDE', :js, feature_category: :web_ide do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers let_it_be(:ide_iframe_selector) { '#ide iframe' } let_it_be(:normal_project) { create(:project, :repository) } diff --git a/spec/features/incidents/user_uses_quick_actions_spec.rb b/spec/features/incidents/user_uses_quick_actions_spec.rb index 3740f2fca47..27facbcafe8 100644 --- a/spec/features/incidents/user_uses_quick_actions_spec.rb +++ b/spec/features/incidents/user_uses_quick_actions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Incidents > User uses quick actions', :js, feature_category: :incident_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers describe 'incident-only commands' do let_it_be(:user) { create(:user) } diff --git a/spec/features/issuables/markdown_references/internal_references_spec.rb b/spec/features/issuables/markdown_references/internal_references_spec.rb index aeae76b1b77..04950c7c7d4 100644 --- a/spec/features/issuables/markdown_references/internal_references_spec.rb +++ b/spec/features/issuables/markdown_references/internal_references_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe "Internal references", :js, feature_category: :team_planning do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers let(:private_project_user) { private_project.first_owner } let(:private_project) { create(:project, :private, :repository) } diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 95277caf0f5..3610c350f67 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Issue Sidebar', feature_category: :team_planning do include MobileHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:group) { create(:group, :nested) } let_it_be(:project) { create(:project, :public, namespace: group) } diff --git a/spec/features/issues/user_comments_on_issue_spec.rb b/spec/features/issues/user_comments_on_issue_spec.rb index 145fa3c4a9e..3ace560fb40 100644 --- a/spec/features/issues/user_comments_on_issue_spec.rb +++ b/spec/features/issues/user_comments_on_issue_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe "User comments on issue", :js, feature_category: :team_planning do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers let_it_be(:project) { create(:project, :public) } let_it_be(:issue) { create(:issue, project: project) } diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/spec/features/issues/user_uses_quick_actions_spec.rb index 963f1c56fef..e85a521e242 100644 --- a/spec/features/issues/user_uses_quick_actions_spec.rb +++ b/spec/features/issues/user_uses_quick_actions_spec.rb @@ -8,7 +8,7 @@ require 'spec_helper' # Because this kind of spec takes more time to run there is no need to add new ones # for each existing quick action unless they test something not tested by existing tests. RSpec.describe 'Issues > User uses quick actions', :js, feature_category: :team_planning do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers context "issuable common quick actions" do let(:new_url_opts) { {} } diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index b8dc3af8a6a..c9aa22e396b 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'a maintainer edits files on a source-branch of an MR from a fork', :js, :sidekiq_might_not_need_inline, feature_category: :code_review_workflow do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers include ProjectForksHelper let(:user) { create(:user, username: 'the-maintainer') } let(:target_project) { create(:project, :public, :repository) } diff --git a/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb b/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb index becbf0ccfa7..faef4f6f517 100644 --- a/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb +++ b/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Merge request > User edits assignees sidebar', :js, feature_category: :code_review_workflow do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let(:project) { create(:project, :public, :repository) } let(:protected_branch) { create(:protected_branch, :maintainers_can_push, name: 'master', project: project) } diff --git a/spec/features/merge_request/user_resolves_conflicts_spec.rb b/spec/features/merge_request/user_resolves_conflicts_spec.rb index 7b1afd786f7..0f283f1194f 100644 --- a/spec/features/merge_request/user_resolves_conflicts_spec.rb +++ b/spec/features/merge_request/user_resolves_conflicts_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Merge request > User resolves conflicts', :js, feature_category: :code_review_workflow do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers let(:project) { create(:project, :repository) } let(:user) { project.creator } diff --git a/spec/features/merge_request/user_uses_quick_actions_spec.rb b/spec/features/merge_request/user_uses_quick_actions_spec.rb index 1a88918da65..1ec86948065 100644 --- a/spec/features/merge_request/user_uses_quick_actions_spec.rb +++ b/spec/features/merge_request/user_uses_quick_actions_spec.rb @@ -9,7 +9,7 @@ require 'spec_helper' # for each existing quick action unless they test something not tested by existing tests. RSpec.describe 'Merge request > User uses quick actions', :js, :use_clean_rails_redis_caching, feature_category: :code_review_workflow do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } diff --git a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb index 58d796f8288..5ccc24ebca1 100644 --- a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'User sorts merge requests', :js, feature_category: :code_review_workflow do include CookieHelper - include Spec::Support::Helpers::Features::SortingHelpers + include Features::SortingHelpers let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let!(:merge_request2) do diff --git a/spec/features/nav/top_nav_responsive_spec.rb b/spec/features/nav/top_nav_responsive_spec.rb index 9ac63c26ba0..f6187672f0e 100644 --- a/spec/features/nav/top_nav_responsive_spec.rb +++ b/spec/features/nav/top_nav_responsive_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'top nav responsive', :js, feature_category: :navigation do include MobileHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/nav/top_nav_spec.rb b/spec/features/nav/top_nav_spec.rb index d2c0286cb4d..74022a4a976 100644 --- a/spec/features/nav/top_nav_spec.rb +++ b/spec/features/nav/top_nav_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'top nav responsive', :js, feature_category: :navigation do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index a050e87241b..65fe1330be2 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Profile > Personal Access Tokens', :js, feature_category: :user_profile do include Spec::Support::Helpers::ModalHelpers - include Spec::Support::Helpers::AccessTokenHelpers + include Features::AccessTokenHelpers let(:user) { create(:user) } let(:pat_create_service) { double('PersonalAccessTokens::CreateService', execute: ServiceResponse.error(message: 'error', payload: { personal_access_token: PersonalAccessToken.new })) } diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index 196134a0bda..e22ff585b67 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User edit profile', feature_category: :user_profile do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 144b4ed85cd..2b6b09ccc10 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' RSpec.describe 'Editing file blob', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers include TreeHelper - include BlobSpecHelpers + include Features::BlobSpecHelpers let_it_be(:project) { create(:project, :public, :repository) } let_it_be(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') } diff --git a/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb b/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb index 2f67e909543..3b383793de2 100644 --- a/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb +++ b/spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User views pipeline editor button on root ci config file', :js, feature_category: :projects do - include BlobSpecHelpers + include Features::BlobSpecHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public, :repository) } diff --git a/spec/features/projects/branches/user_creates_branch_spec.rb b/spec/features/projects/branches/user_creates_branch_spec.rb index 60bd77393e9..369736a6670 100644 --- a/spec/features/projects/branches/user_creates_branch_spec.rb +++ b/spec/features/projects/branches/user_creates_branch_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User creates branch', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::BranchesHelpers + include Features::BranchesHelpers let_it_be(:group) { create(:group, :public) } let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index ed03491d69a..20c1ef1b21f 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Pipeline Editor', :js, feature_category: :pipeline_composition do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers let(:project) { create(:project_empty_repo, :public) } let(:user) { create(:user) } diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index aa9556761c6..bc370a296e4 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'CI Lint', :js, feature_category: :pipeline_composition do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/commit/comments/user_adds_comment_spec.rb b/spec/features/projects/commit/comments/user_adds_comment_spec.rb index c53ac27bb5f..91b838116e9 100644 --- a/spec/features/projects/commit/comments/user_adds_comment_spec.rb +++ b/spec/features/projects/commit/comments/user_adds_comment_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe "User adds a comment on a commit", :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers include RepoHelpers let(:comment_text) { "XML attached" } diff --git a/spec/features/projects/commit/comments/user_deletes_comments_spec.rb b/spec/features/projects/commit/comments/user_deletes_comments_spec.rb index a1e7ddb4d6e..e23eb1cada8 100644 --- a/spec/features/projects/commit/comments/user_deletes_comments_spec.rb +++ b/spec/features/projects/commit/comments/user_deletes_comments_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe "User deletes comments on a commit", :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers include Spec::Support::Helpers::ModalHelpers include RepoHelpers diff --git a/spec/features/projects/commit/comments/user_edits_comments_spec.rb b/spec/features/projects/commit/comments/user_edits_comments_spec.rb index 9019a981a18..b0b963de91b 100644 --- a/spec/features/projects/commit/comments/user_edits_comments_spec.rb +++ b/spec/features/projects/commit/comments/user_edits_comments_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe "User edits a comment on a commit", :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers include RepoHelpers let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/commit/user_comments_on_commit_spec.rb b/spec/features/projects/commit/user_comments_on_commit_spec.rb index 66a407b5ff6..c4019b4d123 100644 --- a/spec/features/projects/commit/user_comments_on_commit_spec.rb +++ b/spec/features/projects/commit/user_comments_on_commit_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe "User comments on commit", :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers include Spec::Support::Helpers::ModalHelpers include RepoHelpers diff --git a/spec/features/projects/files/dockerfile_dropdown_spec.rb b/spec/features/projects/files/dockerfile_dropdown_spec.rb index 1e05bdae204..ec1f03570d9 100644 --- a/spec/features/projects/files/dockerfile_dropdown_spec.rb +++ b/spec/features/projects/files/dockerfile_dropdown_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Files > User wants to add a Dockerfile file', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers before do project = create(:project, :repository) diff --git a/spec/features/projects/files/gitignore_dropdown_spec.rb b/spec/features/projects/files/gitignore_dropdown_spec.rb index 5e11a94e65b..eedb79167bd 100644 --- a/spec/features/projects/files/gitignore_dropdown_spec.rb +++ b/spec/features/projects/files/gitignore_dropdown_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Files > User wants to add a .gitignore file', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers before do project = create(:project, :repository) diff --git a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb index 67678a937e5..f2d657b3513 100644 --- a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb +++ b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers let(:params) { {} } let(:filename) { '.gitlab-ci.yml' } diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index 8d64151e680..cfa55eba188 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js, feature_category: :projects do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers let(:project) { create(:project_empty_repo) } let(:project_maintainer) { project.first_owner } diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index 97ccb45dfc6..42aceef256a 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Files > User creates files', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers - include BlobSpecHelpers + include Features::SourceEditorSpecHelpers + include Features::BlobSpecHelpers let(:fork_message) do "You're not allowed to make changes to this project directly. "\ diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index 5a61aa146a2..779257b2e2b 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' RSpec.describe 'Projects > Files > User edits files', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers + include Features::SourceEditorSpecHelpers include ProjectForksHelper - include BlobSpecHelpers + include Features::BlobSpecHelpers let(:project) { create(:project, :repository, name: 'Shop') } let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') } diff --git a/spec/features/projects/issues/viewing_relocated_issues_spec.rb b/spec/features/projects/issues/viewing_relocated_issues_spec.rb index abd36b3ceef..f86f7bfacbd 100644 --- a/spec/features/projects/issues/viewing_relocated_issues_spec.rb +++ b/spec/features/projects/issues/viewing_relocated_issues_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'issues canonical link', feature_category: :team_planning do - include Spec::Support::Helpers::Features::CanonicalLinkHelpers + include Features::CanonicalLinkHelpers let_it_be(:original_project) { create(:project, :public) } let_it_be(:original_issue) { create(:issue, project: original_project) } diff --git a/spec/features/projects/members/anonymous_user_sees_members_spec.rb b/spec/features/projects/members/anonymous_user_sees_members_spec.rb index 6b92581d704..0b8661cce82 100644 --- a/spec/features/projects/members/anonymous_user_sees_members_spec.rb +++ b/spec/features/projects/members/anonymous_user_sees_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Anonymous user sees members' do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user) { create(:user) } let(:group) { create(:group, :public) } diff --git a/spec/features/projects/members/group_members_spec.rb b/spec/features/projects/members/group_members_spec.rb index 416b96ab668..c0257446a37 100644 --- a/spec/features/projects/members/group_members_spec.rb +++ b/spec/features/projects/members/group_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects members', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user) { create(:user) } let(:developer) { create(:user) } diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index 51acba246c5..8238f95fd47 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Groups with access list', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers include Spec::Support::Helpers::ModalHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group, :public) } diff --git a/spec/features/projects/members/manage_groups_spec.rb b/spec/features/projects/members/manage_groups_spec.rb index b78bfacf171..5efb5abefc6 100644 --- a/spec/features/projects/members/manage_groups_spec.rb +++ b/spec/features/projects/members/manage_groups_spec.rb @@ -4,8 +4,8 @@ require 'spec_helper' RSpec.describe 'Project > Members > Manage groups', :js, feature_category: :subgroups do include ActionView::Helpers::DateHelper - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers let_it_be(:maintainer) { create(:user) } diff --git a/spec/features/projects/members/manage_members_spec.rb b/spec/features/projects/members/manage_members_spec.rb index 615ef1b03dd..5ae6eb83b6b 100644 --- a/spec/features/projects/members/manage_members_spec.rb +++ b/spec/features/projects/members/manage_members_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Manage members', :js, feature_category: :onboarding do - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers include Spec::Support::Helpers::ModalHelpers let_it_be(:user1) { create(:user, name: 'John Doe') } diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index 31c8237aacc..be778def833 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -4,8 +4,8 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Maintainer adds member with expiration date', :js, feature_category: :subgroups do include ActiveSupport::Testing::TimeHelpers - include Spec::Support::Helpers::Features::MembersHelpers - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::MembersHelpers + include Features::InviteMembersModalHelpers let_it_be(:maintainer) { create(:user) } let_it_be(:project) { create(:project, :with_namespace_settings) } diff --git a/spec/features/projects/members/member_leaves_project_spec.rb b/spec/features/projects/members/member_leaves_project_spec.rb index 2632bc2f5bd..91e30b3396e 100644 --- a/spec/features/projects/members/member_leaves_project_spec.rb +++ b/spec/features/projects/members/member_leaves_project_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Member leaves project', feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers include Spec::Support::Helpers::ModalHelpers let(:user) { create(:user) } diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index 78fad9b0b55..85bf381404c 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Sorting', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:maintainer) { create(:user, name: 'John Doe', created_at: 5.days.ago, last_activity_on: Date.today) } let(:developer) { create(:user, name: 'Mary Jane', created_at: 1.day.ago, last_sign_in_at: 5.days.ago, last_activity_on: Date.today - 5) } diff --git a/spec/features/projects/members/tabs_spec.rb b/spec/features/projects/members/tabs_spec.rb index 232420224fc..9ee06edc0c1 100644 --- a/spec/features/projects/members/tabs_spec.rb +++ b/spec/features/projects/members/tabs_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Tabs', :js, feature_category: :subgroups do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers using RSpec::Parameterized::TableSyntax let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index 439ae4275ae..67f401359d6 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'New project', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::TopNavSpecHelpers + include Features::TopNavSpecHelpers context 'as a user' do let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/releases/user_creates_release_spec.rb b/spec/features/projects/releases/user_creates_release_spec.rb index f678d77b002..21d381a3928 100644 --- a/spec/features/projects/releases/user_creates_release_spec.rb +++ b/spec/features/projects/releases/user_creates_release_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User creates release', :js, feature_category: :continuous_delivery do - include Spec::Support::Helpers::Features::ReleasesHelpers + include Features::ReleasesHelpers let_it_be(:project) { create(:project, :repository) } let_it_be(:milestone_1) { create(:milestone, project: project, title: '1.1') } diff --git a/spec/features/projects/settings/user_manages_project_members_spec.rb b/spec/features/projects/settings/user_manages_project_members_spec.rb index 159a83a261d..b7463537fb2 100644 --- a/spec/features/projects/settings/user_manages_project_members_spec.rb +++ b/spec/features/projects/settings/user_manages_project_members_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > User manages project members', feature_category: :projects do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers include Spec::Support::Helpers::ModalHelpers include ListboxHelpers diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index 06e48bc82c0..a28416f3ca3 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Projects > Snippets > Create Snippet', :js, feature_category: :source_code_management do include DropzoneHelper - include Spec::Support::Helpers::Features::SnippetSpecHelpers + include Features::SnippetSpecHelpers let_it_be(:user) { create(:user) } let_it_be(:project) do diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb index 014bf63c696..dda9a556d17 100644 --- a/spec/features/projects/snippets/user_updates_snippet_spec.rb +++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects > Snippets > User updates a snippet', :js, feature_category: :source_code_management do - include Spec::Support::Helpers::Features::SnippetSpecHelpers + include Features::SnippetSpecHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, namespace: user.namespace) } diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb index 58f572bc021..8fae8f38025 100644 --- a/spec/features/projects/tree/create_directory_spec.rb +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Multi-file editor new directory', :js, feature_category: :web_ide do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index 674aef8e6f4..2f8935b9ce3 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Multi-file editor new file', :js, feature_category: :web_ide do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb index 52c6cb2192b..3becc48d450 100644 --- a/spec/features/projects/tree/tree_show_spec.rb +++ b/spec/features/projects/tree/tree_show_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Projects tree', :js, feature_category: :web_ide do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers include RepoHelpers include ListboxHelpers diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index 42fa88a0d3e..6ec57af2590 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Multi-file editor upload file', :js, feature_category: :web_ide do - include WebIdeSpecHelpers + include Features::WebIdeSpecHelpers let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/user_sees_user_popover_spec.rb b/spec/features/projects/user_sees_user_popover_spec.rb index 5badcd99dff..9d8d06c514e 100644 --- a/spec/features/projects/user_sees_user_popover_spec.rb +++ b/spec/features/projects/user_sees_user_popover_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User sees user popover', :js, feature_category: :projects do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers let_it_be(:user) { create(:user, pronouns: 'they/them') } let_it_be(:project) { create(:project, :repository, creator: user) } diff --git a/spec/features/projects/user_views_empty_project_spec.rb b/spec/features/projects/user_views_empty_project_spec.rb index e2b56e8ced6..e38cfc2273a 100644 --- a/spec/features/projects/user_views_empty_project_spec.rb +++ b/spec/features/projects/user_views_empty_project_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User views an empty project', feature_category: :projects do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers let_it_be(:project) { create(:project, :empty_repo) } let_it_be(:user) { create(:user) } diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 03f569fe4b0..6885182845d 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'User creates snippet', :js, feature_category: :source_code_management do include DropzoneHelper - include Spec::Support::Helpers::Features::SnippetSpecHelpers + include Features::SnippetSpecHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/snippets/user_edits_snippet_spec.rb b/spec/features/snippets/user_edits_snippet_spec.rb index 5096472ebe1..f58fda67b59 100644 --- a/spec/features/snippets/user_edits_snippet_spec.rb +++ b/spec/features/snippets/user_edits_snippet_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'User edits snippet', :js, feature_category: :source_code_management do include DropzoneHelper - include Spec::Support::Helpers::Features::SnippetSpecHelpers + include Features::SnippetSpecHelpers let_it_be(:file_name) { 'test.rb' } let_it_be(:content) { 'puts "test"' } diff --git a/spec/features/user_sorts_things_spec.rb b/spec/features/user_sorts_things_spec.rb index b45de88832c..bc377fb1f8f 100644 --- a/spec/features/user_sorts_things_spec.rb +++ b/spec/features/user_sorts_things_spec.rb @@ -7,7 +7,7 @@ require "spec_helper" # The `it`s are named here by convention `starting point -> some pages -> final point`. # All those specs are moved out to this spec intentionally to keep them all in one place. RSpec.describe "User sorts things", :js do - include Spec::Support::Helpers::Features::SortingHelpers + include Features::SortingHelpers include DashboardHelper let_it_be(:project) { create(:project_empty_repo, :public) } diff --git a/spec/features/webauthn_spec.rb b/spec/features/webauthn_spec.rb index fbbc746c0b0..5c42facfa8b 100644 --- a/spec/features/webauthn_spec.rb +++ b/spec/features/webauthn_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Using WebAuthn Devices for Authentication', :js, feature_category: :system_access do - include Spec::Support::Helpers::Features::TwoFactorHelpers + include Features::TwoFactorHelpers let(:app_id) { "http://#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}" } before do diff --git a/spec/fixtures/service_account.json b/spec/fixtures/service_account.json index 9f7f5526cf5..31ef182f8c2 100644 --- a/spec/fixtures/service_account.json +++ b/spec/fixtures/service_account.json @@ -2,7 +2,7 @@ "type": "service_account", "project_id": "demo-app-123", "private_key_id": "47f0b1700983da548af6fcd37007f42996099999", - "private_key": "-----BEGIN PRIVATE KEY-----\nABCDEFIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJn8w20WcN+fi5\nIhO1BEFCv7ExK8J5rW5Pc8XpJgpQoL5cfv6qC6aS+x4maI7S4AG7diqXBLCfjlnA\nqBzXwCRnnPtQhu+v1ehAj5fGNa7F51f9aacRNmKdHzNmWZEPDuLqq0I/Ewcsotu+\nnb+tCYk1o2ahyPZau8JtXFZs7oZb7SrfgoSJemccxeVreGm1Dt6SM74/3qJAeHN/\niK/v0IiQP1GS4Jxgz38XQGo+jiTpNrFcf4S0RNxKcNf+tuuEBDi57LBLwdotM7E5\nF1l9pZZMWkmQKQIxeER6+2HuE56V6QPITwkQ/u9XZFQSgl4SBIw2sHr5D/xaUxjw\n+kMy2Jt9AgMBAAECggEACL7E34rRIWbP043cv3ZQs1RiWzY2mvWmCiMEzkz0rRRv\nyqNv0yXVYtzVV7KjdpY56leLgjM1Sv0PEQoUUtpWFJAXSXdKLaewSXPrpXCoz5OD\nekMgeItnQcE7nECdyAKsCSQw/SXg4t4p0a3WGsCwt3If2TwWIrov9R4zGcn1wMZn\n922WtZDmh2NqdTZIKElWZLxNlIr/1v88mAp7oSa1DLfqWkwEEnxK7GGAiwN8ARIF\nkvgiuKdsHBf5aNKg70xN6AcZx/Z4+KZxXxyKKF5VkjCtDzA97EjJqftDPwGTkela\n2bgiDSJs0Un0wQpFFRDrlfyo7rr9Ey/Gf4rR66NWeQKBgQD7qPP55xoWHCDvoK9P\nMN67qFLNDPWcKVKr8siwUlZ6/+acATXjfNUjsJLM7vBxYLjdtFxQ/vojJTQyMxHt\n80wARDk1DTu2zhltL2rKo6LfbwjQsot1MLZFXAMwqtHTLfURaj8kO1JDV/j+4a94\nP0gzNMiBYAKWm6z08akEz2TrhQKBgQDNGfFvtxo4Mf6AA3iYXCwc0CJXb+cqZkW/\n7glnV+vDqYVo23HJaKHFD+Xqaj+cUrOUNglWgT9WSCZR++Hzw1OCPZvX2V9Z6eQh\ngqOBX6D19q9jfShfxLywEAD5pk7LMINumsNm6H+6shJQK5c67bsM9/KQbSnIlWhw\n7JBe8OlFmQKBgQDREyF2mb/7ZG0ch8N9qB0zjHkV79FRZqdPQUnn6s/8KgO90eei\nUkCFARpE9bF+kBul3UTg6aSIdE0z82fO51VZ11Qrtg3JJtrK8hznsyEKPaX2NI9V\n0h1r7DCeSxw9NS4nxLwmbr4+QqUTpA3yeaiTGiQGD+y2kSkU6nxACclPPQKBgFkb\nkVqg6YJKrjB90ZIYUY3/GzxzwLIaFumpCGretu6eIvkIhiokDExqeNBccuB+ych1\npZ7wrkzVMdjinythzFFEZQXlSdjtlhC9Cj52Bp92GoMV6EmbVwMDIPlVuNvsat3N\n3WFDV+ML5IryNVUD3gVnX/pBgyrDRsnw7VRiRGbZAoGBANxZwGKZo0zpyb5O5hS6\nxVrgJtIySlV5BOEjFXKeLwzByht8HmrHhSWix6WpPejfK1RHhl3boU6t9yeC0cre\nvUI/Y9LBhHXjSwWCWlqVe9yYqsde+xf0UYRS8IoaoJjus7YVJr9yPpCboEF28ZmQ\ndVBlpZYg6oLIar6waaLMz/1B\n-----END PRIVATE KEY-----\n", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJn8w20WcN+fi5\nIhO1BEFCv7ExK8J5rW5Pc8XpJgpQoL5cfv6qC6aS+x4maI7S4AG7diqXBLCfjlnA\nqBzXwCRnnPtQhu+v1ehAj5fGNa7F51f9aacRNmKdHzNmWZEPDuLqq0I/Ewcsotu+\nnb+tCYk1o2ahyPZau8JtXFZs7oZb7SrfgoSJemccxeVreGm1Dt6SM74/3qJAeHN/\niK/v0IiQP1GS4Jxgz38XQGo+jiTpNrFcf4S0RNxKcNf+tuuEBDi57LBLwdotM7E5\nF1l9pZZMWkmQKQIxeER6+2HuE56V6QPITwkQ/u9XZFQSgl4SBIw2sHr5D/xaUxjw\n+kMy2Jt9AgMBAAECggEACL7E34rRIWbP043cv3ZQs1RiWzY2mvWmCiMEzkz0rRRv\nyqNv0yXVYtzVV7KjdpY56leLgjM1Sv0PEQoUUtpWFJAXSXdKLaewSXPrpXCoz5OD\nekMgeItnQcE7nECdyAKsCSQw/SXg4t4p0a3WGsCwt3If2TwWIrov9R4zGcn1wMZn\n922WtZDmh2NqdTZIKElWZLxNlIr/1v88mAp7oSa1DLfqWkwEEnxK7GGAiwN8ARIF\nkvgiuKdsHBf5aNKg70xN6AcZx/Z4+KZxXxyKKF5VkjCtDzA97EjJqftDPwGTkela\n2bgiDSJs0Un0wQpFFRDrlfyo7rr9Ey/Gf4rR66NWeQKBgQD7qPP55xoWHCDvoK9P\nMN67qFLNDPWcKVKr8siwUlZ6/+acATXjfNUjsJLM7vBxYLjdtFxQ/vojJTQyMxHt\n80wARDk1DTu2zhltL2rKo6LfbwjQsot1MLZFXAMwqtHTLfURaj8kO1JDV/j+4a94\nP0gzNMiBYAKWm6z08akEz2TrhQKBgQDNGfFvtxo4Mf6AA3iYXCwc0CJXb+cqZkW/\n7glnV+vDqYVo23HJaKHFD+Xqaj+cUrOUNglWgT9WSCZR++Hzw1OCPZvX2V9Z6eQh\ngqOBX6D19q9jfShfxLywEAD5pk7LMINumsNm6H+6shJQK5c67bsM9/KQbSnIlWhw\n7JBe8OlFmQKBgQDREyF2mb/7ZG0ch8N9qB0zjHkV79FRZqdPQUnn6s/8KgO90eei\nUkCFARpE9bF+kBul3UTg6aSIdE0z82fO51VZ11Qrtg3JJtrK8hznsyEKPaX2NI9V\n0h1r7DCeSxw9NS4nxLwmbr4+QqUTpA3yeaiTGiQGD+y2kSkU6nxACclPPQKBgFkb\nkVqg6YJKrjB90ZIYUY3/GzxzwLIaFumpCGretu6eIvkIhiokDExqeNBccuB+ych1\npZ7wrkzVMdjinythzFFEZQXlSdjtlhC9Cj52Bp92GoMV6EmbVwMDIPlVuNvsat3N\n3WFDV+ML5IryNVUD3gVnX/pBgyrDRsnw7VRiRGbZAoGBANxZwGKZo0zpyb5O5hS6\nxVrgJtIySlV5BOEjFXKeLwzByht8HmrHhSWix6WpPejfK1RHhl3boU6t9yeC0cre\nvUI/Y9LBhHXjSwWCWlqVe9yYqsde+xf0UYRS8IoaoJjus7YVJr9yPpCboEF28ZmQ\ndVBlpZYg6oLIar6waaLMz/1B\n-----END PRIVATE KEY-----\n", "client_email": "demo-app-account@demo-app-374914.iam.gserviceaccount.com", "client_id": "111111116847110173051", "auth_uri": "https://accounts.google.com/o/oauth2/auth", diff --git a/spec/models/integrations/google_play_spec.rb b/spec/models/integrations/google_play_spec.rb index ab1aaad24e7..f322e6546c7 100644 --- a/spec/models/integrations/google_play_spec.rb +++ b/spec/models/integrations/google_play_spec.rb @@ -11,8 +11,14 @@ RSpec.describe Integrations::GooglePlay, feature_category: :mobile_devops do it { is_expected.to validate_presence_of :service_account_key_file_name } it { is_expected.to validate_presence_of :service_account_key } + it { is_expected.to validate_presence_of :package_name } it { is_expected.to allow_value(File.read('spec/fixtures/service_account.json')).for(:service_account_key) } it { is_expected.not_to allow_value(File.read('spec/fixtures/group.json')).for(:service_account_key) } + it { is_expected.to allow_value('com.example.myapp').for(:package_name) } + it { is_expected.to allow_value('com.example.myorg.myapp').for(:package_name) } + it { is_expected.not_to allow_value('com.example').for(:package_name) } + it { is_expected.not_to allow_value('com').for(:package_name) } + it { is_expected.not_to allow_value('com.example.my app').for(:package_name) } end end @@ -21,20 +27,23 @@ RSpec.describe Integrations::GooglePlay, feature_category: :mobile_devops do describe '#fields' do it 'returns custom fields' do - expect(google_play_integration.fields.pluck(:name)).to match_array(%w[service_account_key + expect(google_play_integration.fields.pluck(:name)).to match_array(%w[package_name service_account_key service_account_key_file_name]) end end describe '#test' do it 'returns true for a successful request' do - allow(Google::Auth::ServiceAccountCredentials).to receive_message_chain(:make_creds, :fetch_access_token!) + allow_next_instance_of(Google::Apis::AndroidpublisherV3::AndroidPublisherService) do |instance| + allow(instance).to receive(:list_reviews) + end expect(google_play_integration.test[:success]).to be true end it 'returns false for an invalid request' do - allow(Google::Auth::ServiceAccountCredentials).to receive_message_chain(:make_creds, - :fetch_access_token!).and_raise(Signet::AuthorizationError.new('error')) + allow_next_instance_of(Google::Apis::AndroidpublisherV3::AndroidPublisherService) do |instance| + allow(instance).to receive(:list_reviews).and_raise(Google::Apis::ClientError.new('error')) + end expect(google_play_integration.test[:success]).to be false end end @@ -57,6 +66,12 @@ RSpec.describe Integrations::GooglePlay, feature_category: :mobile_devops do it 'returns vars when the integration is activated' do ci_vars = [ { + key: 'SUPPLY_PACKAGE_NAME', + value: google_play_integration.package_name, + masked: false, + public: false + }, + { key: 'SUPPLY_JSON_KEY_DATA', value: google_play_integration.service_account_key, masked: true, diff --git a/spec/support/helpers/features/access_token_helpers.rb b/spec/support/helpers/features/access_token_helpers.rb index f4bdb70c160..bc839642914 100644 --- a/spec/support/helpers/features/access_token_helpers.rb +++ b/spec/support/helpers/features/access_token_helpers.rb @@ -1,18 +1,15 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module AccessTokenHelpers - def active_access_tokens - find("[data-testid='active-tokens']") - end - def created_access_token - within('[data-testid=access-token-section]') do - find('[data-testid=toggle-visibility-button]').click - find_field('new-access-token').value - end - end +module Features + module AccessTokenHelpers + def active_access_tokens + find("[data-testid='active-tokens']") + end + + def created_access_token + within('[data-testid=access-token-section]') do + find('[data-testid=toggle-visibility-button]').click + find_field('new-access-token').value end end end diff --git a/spec/support/helpers/features/admin_users_helpers.rb b/spec/support/helpers/features/admin_users_helpers.rb index 99b19eedcff..9a87ccf113a 100644 --- a/spec/support/helpers/features/admin_users_helpers.rb +++ b/spec/support/helpers/features/admin_users_helpers.rb @@ -1,24 +1,18 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module Features - module AdminUsersHelpers - def click_user_dropdown_toggle(user_id) - page.within("[data-testid='user-actions-#{user_id}']") do - find("[data-testid='dropdown-toggle']").click - end - end +module Features + module AdminUsersHelpers + def click_user_dropdown_toggle(user_id) + page.within("[data-testid='user-actions-#{user_id}']") do + find("[data-testid='dropdown-toggle']").click + end + end - def click_action_in_user_dropdown(user_id, action) - click_user_dropdown_toggle(user_id) + def click_action_in_user_dropdown(user_id, action) + click_user_dropdown_toggle(user_id) - within find("[data-testid='user-actions-#{user_id}']") do - find('li button', exact_text: action).click - end - end - end + within find("[data-testid='user-actions-#{user_id}']") do + find('li button', exact_text: action).click end end end diff --git a/spec/support/helpers/features/blob_spec_helpers.rb b/spec/support/helpers/features/blob_spec_helpers.rb index 7ccfc9be7e2..8254e1d76bd 100644 --- a/spec/support/helpers/features/blob_spec_helpers.rb +++ b/spec/support/helpers/features/blob_spec_helpers.rb @@ -1,14 +1,16 @@ # frozen_string_literal: true -# These helpers help you interact within the blobs page and blobs edit page (Single file editor). -module BlobSpecHelpers - include ActionView::Helpers::JavaScriptHelper +module Features + # These helpers help you interact within the blobs page and blobs edit page (Single file editor). + module BlobSpecHelpers + include ActionView::Helpers::JavaScriptHelper - def set_default_button(type) - evaluate_script("localStorage.setItem('gl-web-ide-button-selected', '#{type}')") - end + def set_default_button(type) + evaluate_script("localStorage.setItem('gl-web-ide-button-selected', '#{type}')") + end - def unset_default_button - set_default_button('') + def unset_default_button + set_default_button('') + end end end diff --git a/spec/support/helpers/features/branches_helpers.rb b/spec/support/helpers/features/branches_helpers.rb index dc4fa448167..14bfd26acf7 100644 --- a/spec/support/helpers/features/branches_helpers.rb +++ b/spec/support/helpers/features/branches_helpers.rb @@ -4,31 +4,25 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::BranchesHelpers +# include Features::BranchesHelpers # ... # # create_branch("feature") # select_branch("master") # -module Spec - module Support - module Helpers - module Features - module BranchesHelpers - def create_branch(branch_name, source_branch_name = "master") - fill_in("branch_name", with: branch_name) - select_branch(source_branch_name) - click_button("Create branch") - end +module Features + module BranchesHelpers + def create_branch(branch_name, source_branch_name = "master") + fill_in("branch_name", with: branch_name) + select_branch(source_branch_name) + click_button("Create branch") + end - def select_branch(branch_name) - wait_for_requests + def select_branch(branch_name) + wait_for_requests - click_button branch_name - send_keys branch_name - end - end - end + click_button branch_name + send_keys branch_name end end end diff --git a/spec/support/helpers/features/canonical_link_helpers.rb b/spec/support/helpers/features/canonical_link_helpers.rb index da3a28f1cb2..6ef934a924b 100644 --- a/spec/support/helpers/features/canonical_link_helpers.rb +++ b/spec/support/helpers/features/canonical_link_helpers.rb @@ -4,25 +4,19 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::CanonicalLinkHelpers +# include Features::CanonicalLinkHelpers # ... # # expect(page).to have_canonical_link(url) # -module Spec - module Support - module Helpers - module Features - module CanonicalLinkHelpers - def have_canonical_link(url) - have_xpath("//link[@rel=\"canonical\" and @href=\"#{url}\"]", visible: false) - end +module Features + module CanonicalLinkHelpers + def have_canonical_link(url) + have_xpath("//link[@rel=\"canonical\" and @href=\"#{url}\"]", visible: false) + end - def have_any_canonical_links - have_xpath('//link[@rel="canonical"]', visible: false) - end - end - end + def have_any_canonical_links + have_xpath('//link[@rel="canonical"]', visible: false) end end end diff --git a/spec/support/helpers/features/invite_members_modal_helper.rb b/spec/support/helpers/features/invite_members_modal_helper.rb deleted file mode 100644 index 47cbd6b5208..00000000000 --- a/spec/support/helpers/features/invite_members_modal_helper.rb +++ /dev/null @@ -1,154 +0,0 @@ -# frozen_string_literal: true - -module Spec - module Support - module Helpers - module Features - module InviteMembersModalHelper - def invite_member(names, role: 'Guest', expires_at: nil) - click_on 'Invite members' - - page.within invite_modal_selector do - select_members(names) - choose_options(role, expires_at) - submit_invites - end - - wait_for_requests - end - - def invite_member_by_email(role) - click_on _('Invite members') - - page.within invite_modal_selector do - choose_options(role, nil) - find(member_dropdown_selector).set('new_email@gitlab.com') - wait_for_requests - - find('.dropdown-item', text: 'Invite "new_email@gitlab.com" by email').click - - submit_invites - - wait_for_requests - end - end - - def input_invites(names) - click_on 'Invite members' - - page.within invite_modal_selector do - select_members(names) - end - end - - def select_members(names) - Array.wrap(names).each do |name| - find(member_dropdown_selector).set(name) - - wait_for_requests - click_button name - end - end - - def invite_group(name, role: 'Guest', expires_at: nil) - click_on 'Invite a group' - - click_on 'Select a group' - wait_for_requests - click_button name - choose_options(role, expires_at) - - submit_invites - end - - def submit_invites - click_button 'Invite' - end - - def choose_options(role, expires_at) - select role, from: 'Select a role' - fill_in 'YYYY-MM-DD', with: expires_at.strftime('%Y-%m-%d') if expires_at - end - - def click_groups_tab - expect(page).to have_link 'Groups' - click_link "Groups" - end - - def group_dropdown_selector - '[data-testid="group-select-dropdown"]' - end - - def member_dropdown_selector - '[data-testid="members-token-select-input"]' - end - - def invite_modal_selector - '[data-testid="invite-modal"]' - end - - def member_token_error_selector(id) - "[data-testid='error-icon-#{id}']" - end - - def member_token_avatar_selector - "[data-testid='token-avatar']" - end - - def member_token_selector(id) - "[data-token-id='#{id}']" - end - - def more_invite_errors_button_selector - "[data-testid='accordion-button']" - end - - def limited_invite_error_selector - "[data-testid='errors-limited-item']" - end - - def expanded_invite_error_selector - "[data-testid='errors-expanded-item']" - end - - def remove_token(id) - page.within member_token_selector(id) do - find('[data-testid="close-icon"]').click - end - end - - def expect_to_have_successful_invite_indicator(page, user) - expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100") - expect(page).not_to have_text("#{user.name}: ") - end - - def expect_to_have_invalid_invite_indicator(page, user, message: true) - expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100") - expect(page).to have_selector(member_token_error_selector(user.id)) - expect(page).to have_text("#{user.name}: Access level should be greater than or equal to") if message - end - - def expect_to_have_normal_invite_indicator(page, user) - expect(page).to have_selector(member_token_selector(user.id)) - expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100") - expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100") - expect(page).not_to have_text("#{user.name}: ") - end - - def expect_to_have_invite_removed(page, user) - expect(page).not_to have_selector(member_token_selector(user.id)) - expect(page).not_to have_text("#{user.name}: Access level should be greater than or equal to") - end - - def expect_to_have_group(group) - expect(page).to have_selector("[entity-id='#{group.id}']") - end - - def expect_not_to_have_group(group) - expect(page).not_to have_selector("[entity-id='#{group.id}']") - end - end - end - end - end -end diff --git a/spec/support/helpers/features/invite_members_modal_helpers.rb b/spec/support/helpers/features/invite_members_modal_helpers.rb new file mode 100644 index 00000000000..75573616686 --- /dev/null +++ b/spec/support/helpers/features/invite_members_modal_helpers.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +module Features + module InviteMembersModalHelpers + def invite_member(names, role: 'Guest', expires_at: nil) + click_on 'Invite members' + + page.within invite_modal_selector do + select_members(names) + choose_options(role, expires_at) + submit_invites + end + + wait_for_requests + end + + def invite_member_by_email(role) + click_on _('Invite members') + + page.within invite_modal_selector do + choose_options(role, nil) + find(member_dropdown_selector).set('new_email@gitlab.com') + wait_for_requests + + find('.dropdown-item', text: 'Invite "new_email@gitlab.com" by email').click + + submit_invites + + wait_for_requests + end + end + + def input_invites(names) + click_on 'Invite members' + + page.within invite_modal_selector do + select_members(names) + end + end + + def select_members(names) + Array.wrap(names).each do |name| + find(member_dropdown_selector).set(name) + + wait_for_requests + click_button name + end + end + + def invite_group(name, role: 'Guest', expires_at: nil) + click_on 'Invite a group' + + click_on 'Select a group' + wait_for_requests + click_button name + choose_options(role, expires_at) + + submit_invites + end + + def submit_invites + click_button 'Invite' + end + + def choose_options(role, expires_at) + select role, from: 'Select a role' + fill_in 'YYYY-MM-DD', with: expires_at.strftime('%Y-%m-%d') if expires_at + end + + def click_groups_tab + expect(page).to have_link 'Groups' + click_link "Groups" + end + + def group_dropdown_selector + '[data-testid="group-select-dropdown"]' + end + + def member_dropdown_selector + '[data-testid="members-token-select-input"]' + end + + def invite_modal_selector + '[data-testid="invite-modal"]' + end + + def member_token_error_selector(id) + "[data-testid='error-icon-#{id}']" + end + + def member_token_avatar_selector + "[data-testid='token-avatar']" + end + + def member_token_selector(id) + "[data-token-id='#{id}']" + end + + def more_invite_errors_button_selector + "[data-testid='accordion-button']" + end + + def limited_invite_error_selector + "[data-testid='errors-limited-item']" + end + + def expanded_invite_error_selector + "[data-testid='errors-expanded-item']" + end + + def remove_token(id) + page.within member_token_selector(id) do + find('[data-testid="close-icon"]').click + end + end + + def expect_to_have_successful_invite_indicator(page, user) + expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100") + expect(page).not_to have_text("#{user.name}: ") + end + + def expect_to_have_invalid_invite_indicator(page, user, message: true) + expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100") + expect(page).to have_selector(member_token_error_selector(user.id)) + expect(page).to have_text("#{user.name}: Access level should be greater than or equal to") if message + end + + def expect_to_have_normal_invite_indicator(page, user) + expect(page).to have_selector(member_token_selector(user.id)) + expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100") + expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100") + expect(page).not_to have_text("#{user.name}: ") + end + + def expect_to_have_invite_removed(page, user) + expect(page).not_to have_selector(member_token_selector(user.id)) + expect(page).not_to have_text("#{user.name}: Access level should be greater than or equal to") + end + + def expect_to_have_group(group) + expect(page).to have_selector("[entity-id='#{group.id}']") + end + + def expect_not_to_have_group(group) + expect(page).not_to have_selector("[entity-id='#{group.id}']") + end + end +end diff --git a/spec/support/helpers/features/iteration_helpers.rb b/spec/support/helpers/features/iteration_helpers.rb index 8e1d252f55f..fab373a547f 100644 --- a/spec/support/helpers/features/iteration_helpers.rb +++ b/spec/support/helpers/features/iteration_helpers.rb @@ -1,6 +1,9 @@ # frozen_string_literal: true -module IterationHelpers - def iteration_period(iteration) - "#{iteration.start_date.to_s(:medium)} - #{iteration.due_date.to_s(:medium)}" + +module Features + module IterationHelpers + def iteration_period(iteration) + "#{iteration.start_date.to_s(:medium)} - #{iteration.due_date.to_s(:medium)}" + end end end diff --git a/spec/support/helpers/features/list_rows_helpers.rb b/spec/support/helpers/features/list_rows_helpers.rb deleted file mode 100644 index 0626415361c..00000000000 --- a/spec/support/helpers/features/list_rows_helpers.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true -# These helpers allow you to access rows in the list -# -# Usage: -# describe "..." do -# include Spec::Support::Helpers::Features::ListRowsHelpers -# ... -# -# expect(first_row.text).to include("John Doe") -# expect(second_row.text).to include("John Smith") -# -module Spec - module Support - module Helpers - module Features - module ListRowsHelpers - def first_row - page.all('ul.content-list > li')[0] - end - - def second_row - page.all('ul.content-list > li')[1] - end - end - end - end - end -end diff --git a/spec/support/helpers/features/members_helpers.rb b/spec/support/helpers/features/members_helpers.rb index 2d3f0902a3c..9882767cecf 100644 --- a/spec/support/helpers/features/members_helpers.rb +++ b/spec/support/helpers/features/members_helpers.rb @@ -1,78 +1,72 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module Features - module MembersHelpers - def members_table - page.find('[data-testid="members-table"]') - end +module Features + module MembersHelpers + def members_table + page.find('[data-testid="members-table"]') + end - def all_rows - page.within(members_table) do - page.all('tbody > tr') - end - end + def all_rows + page.within(members_table) do + page.all('tbody > tr') + end + end - def first_row - all_rows[0] - end + def first_row + all_rows[0] + end - def second_row - all_rows[1] - end + def second_row + all_rows[1] + end - def third_row - all_rows[2] - end + def third_row + all_rows[2] + end - def find_row(name) - page.within(members_table) do - page.find('tbody > tr', text: name) - end - end + def find_row(name) + page.within(members_table) do + page.find('tbody > tr', text: name) + end + end - def find_member_row(user) - find_row(user.name) - end + def find_member_row(user) + find_row(user.name) + end - def find_username_row(user) - find_row(user.username) - end + def find_username_row(user) + find_row(user.username) + end - def find_invited_member_row(email) - find_row(email) - end + def find_invited_member_row(email) + find_row(email) + end - def find_group_row(group) - find_row(group.full_name) - end + def find_group_row(group) + find_row(group.full_name) + end - def fill_in_filtered_search(label, with:) - page.within '[data-testid="members-filtered-search-bar"]' do - find_field(label).click - find('input').native.send_keys(with) - click_button 'Search' - end - end + def fill_in_filtered_search(label, with:) + page.within '[data-testid="members-filtered-search-bar"]' do + find_field(label).click + find('input').native.send_keys(with) + click_button 'Search' + end + end - def user_action_dropdown - '[data-testid="user-action-dropdown"]' - end + def user_action_dropdown + '[data-testid="user-action-dropdown"]' + end - def show_actions - within user_action_dropdown do - find('button').click - end - end + def show_actions + within user_action_dropdown do + find('button').click + end + end - def show_actions_for_username(user) - within find_username_row(user) do - show_actions - end - end - end + def show_actions_for_username(user) + within find_username_row(user) do + show_actions end end end diff --git a/spec/support/helpers/features/merge_request_helpers.rb b/spec/support/helpers/features/merge_request_helpers.rb index 53896e1fe12..260a55487ea 100644 --- a/spec/support/helpers/features/merge_request_helpers.rb +++ b/spec/support/helpers/features/merge_request_helpers.rb @@ -1,25 +1,19 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module Features - module MergeRequestHelpers - def preload_view_requirements(merge_request, note) - # This will load the status fields of the author of the note and merge request - # to avoid queries when rendering the view being tested. - # - merge_request.author.status - note.author.status - end +module Features + module MergeRequestHelpers + def preload_view_requirements(merge_request, note) + # This will load the status fields of the author of the note and merge request + # to avoid queries when rendering the view being tested. + # + merge_request.author.status + note.author.status + end - def serialize_issuable_sidebar(user, project, merge_request) - MergeRequestSerializer - .new(current_user: user, project: project) - .represent(merge_request, serializer: 'sidebar') - end - end - end + def serialize_issuable_sidebar(user, project, merge_request) + MergeRequestSerializer + .new(current_user: user, project: project) + .represent(merge_request, serializer: 'sidebar') end end end diff --git a/spec/support/helpers/features/notes_helpers.rb b/spec/support/helpers/features/notes_helpers.rb index f8252254531..78774b515df 100644 --- a/spec/support/helpers/features/notes_helpers.rb +++ b/spec/support/helpers/features/notes_helpers.rb @@ -4,53 +4,47 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::NotesHelpers +# include Features::NotesHelpers # ... # # add_note("Hello world!") # -module Spec - module Support - module Helpers - module Features - module NotesHelpers - def add_note(text) - perform_enqueued_jobs do - page.within(".js-main-target-form") do - fill_in("note[note]", with: text) - find(".js-comment-submit-button").click - end - end - - wait_for_requests - end - - def edit_note(note_text_to_edit, new_note_text) - page.within('#notes-list li.note', text: note_text_to_edit) do - find('.js-note-edit').click - fill_in('note[note]', with: new_note_text) - find('.js-comment-button').click - end - - wait_for_requests - end - - def preview_note(text) - page.within('.js-main-target-form') do - filled_text = fill_in('note[note]', with: text) - - # Wait for quick action prompt to load and then dismiss it with ESC - # because it may block the Preview button - wait_for_requests - filled_text.send_keys(:escape) - - click_on('Preview') - - yield if block_given? - end - end +module Features + module NotesHelpers + def add_note(text) + perform_enqueued_jobs do + page.within(".js-main-target-form") do + fill_in("note[note]", with: text) + find(".js-comment-submit-button").click end end + + wait_for_requests + end + + def edit_note(note_text_to_edit, new_note_text) + page.within('#notes-list li.note', text: note_text_to_edit) do + find('.js-note-edit').click + fill_in('note[note]', with: new_note_text) + find('.js-comment-button').click + end + + wait_for_requests + end + + def preview_note(text) + page.within('.js-main-target-form') do + filled_text = fill_in('note[note]', with: text) + + # Wait for quick action prompt to load and then dismiss it with ESC + # because it may block the Preview button + wait_for_requests + filled_text.send_keys(:escape) + + click_on('Preview') + + yield if block_given? + end end end end diff --git a/spec/support/helpers/features/releases_helpers.rb b/spec/support/helpers/features/releases_helpers.rb index 545e12341ef..04d4d584c31 100644 --- a/spec/support/helpers/features/releases_helpers.rb +++ b/spec/support/helpers/features/releases_helpers.rb @@ -4,80 +4,74 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::ReleasesHelpers +# include Features::ReleasesHelpers # ... # # fill_tag_name("v1.0") # select_create_from("my-feature-branch") # -module Spec - module Support - module Helpers - module Features - module ReleasesHelpers - include ListboxHelpers +module Features + module ReleasesHelpers + include ListboxHelpers - def select_new_tag_name(tag_name) - page.within '[data-testid="tag-name-field"]' do - find('button').click - wait_for_all_requests + def select_new_tag_name(tag_name) + page.within '[data-testid="tag-name-field"]' do + find('button').click + wait_for_all_requests - find('input[aria-label="Search or create tag"]').set(tag_name) - wait_for_all_requests + find('input[aria-label="Search or create tag"]').set(tag_name) + wait_for_all_requests - click_button("Create tag #{tag_name}") - click_button tag_name - end - end + click_button("Create tag #{tag_name}") + click_button tag_name + end + end - def select_create_from(branch_name) - page.within '[data-testid="create-from-field"]' do - find('button').click + def select_create_from(branch_name) + page.within '[data-testid="create-from-field"]' do + find('button').click - wait_for_all_requests + wait_for_all_requests - find('input[aria-label="Search branches, tags, and commits"]').set(branch_name) + find('input[aria-label="Search branches, tags, and commits"]').set(branch_name) - wait_for_all_requests + wait_for_all_requests - select_listbox_item(branch_name.to_s, exact_text: true) - end - end + select_listbox_item(branch_name.to_s, exact_text: true) + end + end - def fill_release_title(release_title) - fill_in('Release title', with: release_title) - end + def fill_release_title(release_title) + fill_in('Release title', with: release_title) + end - def select_milestone(milestone_title) - page.within '[data-testid="milestones-field"]' do - find('button').click + def select_milestone(milestone_title) + page.within '[data-testid="milestones-field"]' do + find('button').click - wait_for_all_requests + wait_for_all_requests - find('input[aria-label="Search Milestones"]').set(milestone_title) + find('input[aria-label="Search Milestones"]').set(milestone_title) - wait_for_all_requests + wait_for_all_requests - find('button', text: milestone_title, match: :first).click - end - end + find('button', text: milestone_title, match: :first).click + end + end - def fill_release_notes(release_notes) - fill_in('Release notes', with: release_notes) - end + def fill_release_notes(release_notes) + fill_in('Release notes', with: release_notes) + end - def fill_asset_link(link) - all('input[name="asset-url"]').last.set(link[:url]) - all('input[name="asset-link-name"]').last.set(link[:title]) - all('select[name="asset-type"]').last.find("option[value=\"#{link[:type]}\"").select_option - end + def fill_asset_link(link) + all('input[name="asset-url"]').last.set(link[:url]) + all('input[name="asset-link-name"]').last.set(link[:title]) + all('select[name="asset-type"]').last.find("option[value=\"#{link[:type]}\"").select_option + end - # Click "Add another link" and tab back to the beginning of the new row - def add_another_asset_link - click_button('Add another link') - end - end - end + # Click "Add another link" and tab back to the beginning of the new row + def add_another_asset_link + click_button('Add another link') end end end diff --git a/spec/support/helpers/features/responsive_table_helpers.rb b/spec/support/helpers/features/responsive_table_helpers.rb index 7a175219fe9..980f09b7eea 100644 --- a/spec/support/helpers/features/responsive_table_helpers.rb +++ b/spec/support/helpers/features/responsive_table_helpers.rb @@ -3,7 +3,7 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::ResponsiveTableHelpers +# include Features::ResponsiveTableHelpers # ... # # expect(first_row.text).to include("John Doe") @@ -13,20 +13,14 @@ # index starts at 1 as index 0 is expected to be the table header # # -module Spec - module Support - module Helpers - module Features - module ResponsiveTableHelpers - def first_row - page.all('.gl-responsive-table-row')[1] - end +module Features + module ResponsiveTableHelpers + def first_row + page.all('.gl-responsive-table-row')[1] + end - def second_row - page.all('.gl-responsive-table-row')[2] - end - end - end + def second_row + page.all('.gl-responsive-table-row')[2] end end end diff --git a/spec/support/helpers/features/runners_helpers.rb b/spec/support/helpers/features/runners_helpers.rb index c5d26108953..0504e883b82 100644 --- a/spec/support/helpers/features/runners_helpers.rb +++ b/spec/support/helpers/features/runners_helpers.rb @@ -1,68 +1,62 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module Features - module RunnersHelpers - def within_runner_row(runner_id) - within "[data-testid='runner-row-#{runner_id}']" do - yield - end - end - - def search_bar_selector - '[data-testid="runners-filtered-search"]' - end +module Features + module RunnersHelpers + def within_runner_row(runner_id) + within "[data-testid='runner-row-#{runner_id}']" do + yield + end + end - # The filters must be clicked first to be able to receive events - # See: https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1493 - def focus_filtered_search - page.within(search_bar_selector) do - page.find('.gl-filtered-search-term-token').click - end - end + def search_bar_selector + '[data-testid="runners-filtered-search"]' + end - def input_filtered_search_keys(search_term) - focus_filtered_search + # The filters must be clicked first to be able to receive events + # See: https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1493 + def focus_filtered_search + page.within(search_bar_selector) do + page.find('.gl-filtered-search-term-token').click + end + end - page.within(search_bar_selector) do - page.find('input').send_keys(search_term) - click_on 'Search' - end + def input_filtered_search_keys(search_term) + focus_filtered_search - wait_for_requests - end + page.within(search_bar_selector) do + page.find('input').send_keys(search_term) + click_on 'Search' + end - def open_filtered_search_suggestions(filter) - focus_filtered_search + wait_for_requests + end - page.within(search_bar_selector) do - click_on filter - end + def open_filtered_search_suggestions(filter) + focus_filtered_search - wait_for_requests - end + page.within(search_bar_selector) do + click_on filter + end - def input_filtered_search_filter_is_only(filter, value) - focus_filtered_search + wait_for_requests + end - page.within(search_bar_selector) do - click_on filter + def input_filtered_search_filter_is_only(filter, value) + focus_filtered_search - # For OPERATORS_IS, clicking the filter - # immediately preselects "=" operator + page.within(search_bar_selector) do + click_on filter - page.find('input').send_keys(value) - page.find('input').send_keys(:enter) + # For OPERATORS_IS, clicking the filter + # immediately preselects "=" operator - click_on 'Search' - end + page.find('input').send_keys(value) + page.find('input').send_keys(:enter) - wait_for_requests - end - end + click_on 'Search' end + + wait_for_requests end end end diff --git a/spec/support/helpers/features/snippet_helpers.rb b/spec/support/helpers/features/snippet_helpers.rb deleted file mode 100644 index 3e32b0e4c67..00000000000 --- a/spec/support/helpers/features/snippet_helpers.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -# These helpers help you interact within the Source Editor (single-file editor, snippets, etc.). -# - -require Rails.root.join("spec/support/helpers/features/source_editor_spec_helpers.rb") - -module Spec - module Support - module Helpers - module Features - module SnippetSpecHelpers - include ActionView::Helpers::JavaScriptHelper - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers - - def snippet_description_locator - 'snippet-description' - end - - def snippet_blob_path_locator - 'snippet_file_name' - end - - def snippet_description_view_selector - '.snippet-header .snippet-description' - end - - def snippet_description_field_collapsed - find('.js-description-input').find('input,textarea') - end - - def snippet_get_first_blob_path - page.find_field('snippet_file_name', match: :first).value - end - - def snippet_get_first_blob_value - page.find('.gl-source-editor', match: :first) - end - - def snippet_description_value - page.find_field(snippet_description_locator).value - end - - def snippet_fill_in_visibility(text) - page.find('#visibility-level-setting').choose(text) - end - - def snippet_fill_in_title(value) - fill_in 'snippet-title', with: value - end - - def snippet_fill_in_description(value) - # Click placeholder first to expand full description field - snippet_description_field_collapsed.click - fill_in snippet_description_locator, with: value - end - - def snippet_fill_in_content(value) - page.within('.gl-source-editor') do - el = find('.inputarea') - el.send_keys value - end - end - - def snippet_fill_in_file_name(value) - fill_in(snippet_blob_path_locator, match: :first, with: value) - end - - def snippet_fill_in_form(title: nil, content: nil, file_name: nil, description: nil, visibility: nil) - if content - snippet_fill_in_content(content) - # It takes some time after sending keys for the vue component to - # update so let Capybara wait for the content before proceeding - expect(page).to have_content(content) - end - - snippet_fill_in_title(title) if title - - snippet_fill_in_description(description) if description - - snippet_fill_in_file_name(file_name) if file_name - - snippet_fill_in_visibility(visibility) if visibility - end - end - end - end - end -end diff --git a/spec/support/helpers/features/snippet_spec_helpers.rb b/spec/support/helpers/features/snippet_spec_helpers.rb new file mode 100644 index 00000000000..19393f6e438 --- /dev/null +++ b/spec/support/helpers/features/snippet_spec_helpers.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +# These helpers help you interact within the Source Editor (single-file editor, snippets, etc.). +# + +require Rails.root.join("spec/support/helpers/features/source_editor_spec_helpers.rb") + +module Features + module SnippetSpecHelpers + include ActionView::Helpers::JavaScriptHelper + include Features::SourceEditorSpecHelpers + + def snippet_description_locator + 'snippet-description' + end + + def snippet_blob_path_locator + 'snippet_file_name' + end + + def snippet_description_view_selector + '.snippet-header .snippet-description' + end + + def snippet_description_field_collapsed + find('.js-description-input').find('input,textarea') + end + + def snippet_get_first_blob_path + page.find_field('snippet_file_name', match: :first).value + end + + def snippet_get_first_blob_value + page.find('.gl-source-editor', match: :first) + end + + def snippet_description_value + page.find_field(snippet_description_locator).value + end + + def snippet_fill_in_visibility(text) + page.find('#visibility-level-setting').choose(text) + end + + def snippet_fill_in_title(value) + fill_in 'snippet-title', with: value + end + + def snippet_fill_in_description(value) + # Click placeholder first to expand full description field + snippet_description_field_collapsed.click + fill_in snippet_description_locator, with: value + end + + def snippet_fill_in_content(value) + page.within('.gl-source-editor') do + el = find('.inputarea') + el.send_keys value + end + end + + def snippet_fill_in_file_name(value) + fill_in(snippet_blob_path_locator, match: :first, with: value) + end + + def snippet_fill_in_form(title: nil, content: nil, file_name: nil, description: nil, visibility: nil) + if content + snippet_fill_in_content(content) + # It takes some time after sending keys for the vue component to + # update so let Capybara wait for the content before proceeding + expect(page).to have_content(content) + end + + snippet_fill_in_title(title) if title + + snippet_fill_in_description(description) if description + + snippet_fill_in_file_name(file_name) if file_name + + snippet_fill_in_visibility(visibility) if visibility + end + end +end diff --git a/spec/support/helpers/features/sorting_helpers.rb b/spec/support/helpers/features/sorting_helpers.rb index 504a9b764cf..8dda16af625 100644 --- a/spec/support/helpers/features/sorting_helpers.rb +++ b/spec/support/helpers/features/sorting_helpers.rb @@ -4,33 +4,27 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::SortingHelpers +# include Features::SortingHelpers # ... # # sort_by("Last updated") # -module Spec - module Support - module Helpers - module Features - module SortingHelpers - def sort_by(value) - find('.filter-dropdown-container .dropdown').click +module Features + module SortingHelpers + def sort_by(value) + find('.filter-dropdown-container .dropdown').click - page.within('ul.dropdown-menu.dropdown-menu-right li') do - click_link(value) - end - end - - # pajamas_sort_by is used to sort new pajamas dropdowns. When - # all of the dropdowns are converted, pajamas_sort_by can be renamed to sort_by - # https://gitlab.com/groups/gitlab-org/-/epics/7551 - def pajamas_sort_by(value) - find('.filter-dropdown-container .gl-new-dropdown').click - find('.gl-new-dropdown-item', text: value).click - end - end + page.within('ul.dropdown-menu.dropdown-menu-right li') do + click_link(value) end end + + # pajamas_sort_by is used to sort new pajamas dropdowns. When + # all of the dropdowns are converted, pajamas_sort_by can be renamed to sort_by + # https://gitlab.com/groups/gitlab-org/-/epics/7551 + def pajamas_sort_by(value) + find('.filter-dropdown-container .gl-new-dropdown').click + find('.gl-new-dropdown-item', text: value).click + end end end diff --git a/spec/support/helpers/features/source_editor_spec_helpers.rb b/spec/support/helpers/features/source_editor_spec_helpers.rb index f7eb2a52507..e20ded60b01 100644 --- a/spec/support/helpers/features/source_editor_spec_helpers.rb +++ b/spec/support/helpers/features/source_editor_spec_helpers.rb @@ -2,24 +2,18 @@ # These helpers help you interact within the Source Editor (single-file editor, snippets, etc.). # -module Spec - module Support - module Helpers - module Features - module SourceEditorSpecHelpers - include ActionView::Helpers::JavaScriptHelper +module Features + module SourceEditorSpecHelpers + include ActionView::Helpers::JavaScriptHelper - def editor_set_value(value) - editor = find('.monaco-editor') - uri = editor['data-uri'] - execute_script("localMonaco.getModel('#{uri}').setValue('#{escape_javascript(value)}')") + def editor_set_value(value) + editor = find('.monaco-editor') + uri = editor['data-uri'] + execute_script("localMonaco.getModel('#{uri}').setValue('#{escape_javascript(value)}')") - # We only check that the first line is present because when the content is long, - # only a part of the text will be rendered in the DOM due to scrolling - page.has_selector?('.gl-source-editor .view-lines', text: value.lines.first) - end - end - end + # We only check that the first line is present because when the content is long, + # only a part of the text will be rendered in the DOM due to scrolling + page.has_selector?('.gl-source-editor .view-lines', text: value.lines.first) end end end diff --git a/spec/support/helpers/features/top_nav_spec_helpers.rb b/spec/support/helpers/features/top_nav_spec_helpers.rb index de495eceabc..ecc05189fb4 100644 --- a/spec/support/helpers/features/top_nav_spec_helpers.rb +++ b/spec/support/helpers/features/top_nav_spec_helpers.rb @@ -2,37 +2,31 @@ # These helpers help you interact within the Source Editor (single-file editor, snippets, etc.). # -module Spec - module Support - module Helpers - module Features - module TopNavSpecHelpers - def open_top_nav - find('.js-top-nav-dropdown-toggle').click - end +module Features + module TopNavSpecHelpers + def open_top_nav + find('.js-top-nav-dropdown-toggle').click + end - def within_top_nav - within('.js-top-nav-dropdown-menu') do - yield - end - end + def within_top_nav + within('.js-top-nav-dropdown-menu') do + yield + end + end - def open_top_nav_projects - open_top_nav + def open_top_nav_projects + open_top_nav - within_top_nav do - click_button('Projects') - end - end + within_top_nav do + click_button('Projects') + end + end - def open_top_nav_groups - open_top_nav + def open_top_nav_groups + open_top_nav - within_top_nav do - click_button('Groups') - end - end - end + within_top_nav do + click_button('Groups') end end end diff --git a/spec/support/helpers/features/two_factor_helpers.rb b/spec/support/helpers/features/two_factor_helpers.rb index d5f069a40ea..e0469091d96 100644 --- a/spec/support/helpers/features/two_factor_helpers.rb +++ b/spec/support/helpers/features/two_factor_helpers.rb @@ -4,92 +4,86 @@ # # Usage: # describe "..." do -# include Spec::Support::Helpers::Features::TwoFactorHelpers +# include Features::TwoFactorHelpers # ... # # manage_two_factor_authentication # -module Spec - module Support - module Helpers - module Features - module TwoFactorHelpers - def copy_recovery_codes - click_on _('Copy codes') - click_on _('Proceed') - end +module Features + module TwoFactorHelpers + def copy_recovery_codes + click_on _('Copy codes') + click_on _('Proceed') + end - def enable_two_factor_authentication - click_on _('Enable two-factor authentication') - expect(page).to have_content(_('Set up new device')) - wait_for_requests - end + def enable_two_factor_authentication + click_on _('Enable two-factor authentication') + expect(page).to have_content(_('Set up new device')) + wait_for_requests + end - def manage_two_factor_authentication - click_on 'Manage two-factor authentication' - expect(page).to have_content("Set up new device") - wait_for_requests - end + def manage_two_factor_authentication + click_on 'Manage two-factor authentication' + expect(page).to have_content("Set up new device") + wait_for_requests + end + + # Registers webauthn device via UI + # Remove after `webauthn_without_totp` feature flag is deleted. + def register_webauthn_device(webauthn_device = nil, name: 'My device') + webauthn_device ||= FakeWebauthnDevice.new(page, name) + webauthn_device.respond_to_webauthn_registration + click_on 'Set up new device' + expect(page).to have_content('Your device was successfully set up') + fill_in 'Pick a name', with: name + click_on 'Register device' + webauthn_device + end - # Registers webauthn device via UI - # Remove after `webauthn_without_totp` feature flag is deleted. - def register_webauthn_device(webauthn_device = nil, name: 'My device') - webauthn_device ||= FakeWebauthnDevice.new(page, name) - webauthn_device.respond_to_webauthn_registration - click_on 'Set up new device' - expect(page).to have_content('Your device was successfully set up') - fill_in 'Pick a name', with: name - click_on 'Register device' - webauthn_device - end + def webauthn_device_registration(webauthn_device: nil, name: 'My device', password: 'fake') + webauthn_device ||= FakeWebauthnDevice.new(page, name) + webauthn_device.respond_to_webauthn_registration + click_on _('Set up new device') + webauthn_fill_form_and_submit(name: name, password: password) + webauthn_device + end - def webauthn_device_registration(webauthn_device: nil, name: 'My device', password: 'fake') - webauthn_device ||= FakeWebauthnDevice.new(page, name) - webauthn_device.respond_to_webauthn_registration - click_on _('Set up new device') - webauthn_fill_form_and_submit(name: name, password: password) - webauthn_device - end + def webauthn_fill_form_and_submit(name: 'My device', password: 'fake') + content = _('Your device was successfully set up! Give it a name and register it with the GitLab server.') + expect(page).to have_content(content) - def webauthn_fill_form_and_submit(name: 'My device', password: 'fake') - expect(page).to have_content( - _('Your device was successfully set up! Give it a name and register it with the GitLab server.') - ) - within '[data-testid="create-webauthn"]' do - fill_in _('Device name'), with: name - fill_in _('Current password'), with: password - click_on _('Register device') - end - end + within '[data-testid="create-webauthn"]' do + fill_in _('Device name'), with: name + fill_in _('Current password'), with: password + click_on _('Register device') + end + end - # Adds webauthn device directly via database - def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device') - fake_device ||= WebAuthn::FakeClient.new(app_id) + # Adds webauthn device directly via database + def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device') + fake_device ||= WebAuthn::FakeClient.new(app_id) - options_for_create = WebAuthn::Credential.options_for_create( - user: { id: user.webauthn_xid, name: user.username }, - authenticator_selection: { user_verification: 'discouraged' }, - rp: { name: 'GitLab' } - ) - challenge = options_for_create.challenge + options_for_create = WebAuthn::Credential.options_for_create( + user: { id: user.webauthn_xid, name: user.username }, + authenticator_selection: { user_verification: 'discouraged' }, + rp: { name: 'GitLab' } + ) + challenge = options_for_create.challenge - device_response = fake_device.create(challenge: challenge).to_json # rubocop:disable Rails/SaveBang - device_registration_params = { device_response: device_response, - name: name } + device_response = fake_device.create(challenge: challenge).to_json # rubocop:disable Rails/SaveBang + device_registration_params = { device_response: device_response, + name: name } - Webauthn::RegisterService.new( - user, device_registration_params, challenge).execute - FakeWebauthnDevice.new(page, name, fake_device) - end + Webauthn::RegisterService.new( + user, device_registration_params, challenge).execute + FakeWebauthnDevice.new(page, name, fake_device) + end - def assert_fallback_ui(page) - expect(page).to have_button('Verify code') - expect(page).to have_css('#user_otp_attempt') - expect(page).not_to have_link('Sign in via 2FA code') - expect(page).not_to have_css("#js-authenticate-token-2fa") - end - end - end + def assert_fallback_ui(page) + expect(page).to have_button('Verify code') + expect(page).to have_css('#user_otp_attempt') + expect(page).not_to have_link('Sign in via 2FA code') + expect(page).not_to have_css("#js-authenticate-token-2fa") end end end diff --git a/spec/support/helpers/features/web_ide_spec_helpers.rb b/spec/support/helpers/features/web_ide_spec_helpers.rb index 4793c9479fe..c51116b55b2 100644 --- a/spec/support/helpers/features/web_ide_spec_helpers.rb +++ b/spec/support/helpers/features/web_ide_spec_helpers.rb @@ -4,119 +4,120 @@ # # Usage: # describe "..." do -# include WebIdeSpecHelpers +# include Features::WebIdeSpecHelpers # ... # # ide_visit(project) # ide_commit -# -module WebIdeSpecHelpers - include Spec::Support::Helpers::Features::SourceEditorSpecHelpers - - # Open the IDE from anywhere by first visiting the given project's page - def ide_visit(project) - visit project_path(project) - - ide_visit_from_link - end +module Features + module WebIdeSpecHelpers + include Features::SourceEditorSpecHelpers - # Open the IDE from the current page by clicking the Web IDE link - def ide_visit_from_link(link_sel = 'Web IDE') - new_tab = window_opened_by { click_link(link_sel) } + # Open the IDE from anywhere by first visiting the given project's page + def ide_visit(project) + visit project_path(project) - switch_to_window new_tab - end + ide_visit_from_link + end - def ide_tree_body - page.find('.ide-tree-body') - end + # Open the IDE from the current page by clicking the Web IDE link + def ide_visit_from_link(link_sel = 'Web IDE') + new_tab = window_opened_by { click_link(link_sel) } - def ide_tree_actions - page.find('.ide-tree-actions') - end + switch_to_window new_tab + end - def ide_tab_selector(mode) - ".js-ide-#{mode}-mode" - end + def ide_tree_body + page.find('.ide-tree-body') + end - def ide_folder_row_open?(row) - row.matches_css?('.folder.is-open') - end + def ide_tree_actions + page.find('.ide-tree-actions') + end - # Deletes a file by traversing to `path` - # then clicking the 'Delete' action. - # - # - Throws an error if the file is not found - def ide_delete_file(path) - container = ide_traverse_to_file(path) + def ide_tab_selector(mode) + ".js-ide-#{mode}-mode" + end - click_file_action(container, 'Delete') - end + def ide_folder_row_open?(row) + row.matches_css?('.folder.is-open') + end - # Opens parent directories until the file at `path` - # is exposed. - # - # - Returns a reference to the file row at `path` - # - Throws an error if the file is not found - def ide_traverse_to_file(path) - paths = path.split('/') - container = nil + # Deletes a file by traversing to `path` + # then clicking the 'Delete' action. + # + # - Throws an error if the file is not found + def ide_delete_file(path) + container = ide_traverse_to_file(path) - paths.each_with_index do |path, index| - ide_open_file_row(container) if container - container = find_file_child(container, path, level: index) + click_file_action(container, 'Delete') end - container - end + # Opens parent directories until the file at `path` + # is exposed. + # + # - Returns a reference to the file row at `path` + # - Throws an error if the file is not found + def ide_traverse_to_file(path) + paths = path.split('/') + container = nil + + paths.each_with_index do |path, index| + ide_open_file_row(container) if container + container = find_file_child(container, path, level: index) + end + + container + end - def ide_open_file_row(row) - return if ide_folder_row_open?(row) + def ide_open_file_row(row) + return if ide_folder_row_open?(row) - row.click - end + row.click + end - def ide_set_editor_value(value) - editor_set_value(value) - end + def ide_set_editor_value(value) + editor_set_value(value) + end - def ide_commit_tab_selector - ide_tab_selector('commit') - end + def ide_commit_tab_selector + ide_tab_selector('commit') + end - def ide_commit - find(ide_commit_tab_selector).click + def ide_commit + find(ide_commit_tab_selector).click - commit_to_current_branch - end + commit_to_current_branch + end - private + private - def file_row_container(row) - row ? row.find(:xpath, '..') : ide_tree_body - end + def file_row_container(row) + row ? row.find(:xpath, '..') : ide_tree_body + end - def find_file_child(row, name, level: nil) - container = file_row_container(row) - container.find(".file-row[data-level=\"#{level}\"]", text: name) - end + def find_file_child(row, name, level: nil) + container = file_row_container(row) + container.find(".file-row[data-level=\"#{level}\"]", text: name) + end - def click_file_action(row, text) - row.hover - dropdown = row.find('.ide-new-btn') - dropdown.find('button').click - dropdown.find('button', text: text).click - end + def click_file_action(row, text) + row.hover + dropdown = row.find('.ide-new-btn') + dropdown.find('button').click + dropdown.find('button', text: text).click + end - def commit_to_current_branch(option: 'Commit to master branch', message: '') - within '.multi-file-commit-form' do - fill_in('commit-message', with: message) if message + def commit_to_current_branch(option: 'Commit to master branch', message: '') + within '.multi-file-commit-form' do + fill_in('commit-message', with: message) if message - choose(option) + choose(option) - click_button('Commit') + click_button('Commit') - wait_for_requests + wait_for_requests + end end end end diff --git a/spec/support/shared_contexts/features/integrations/integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/integrations_shared_context.rb index 9612b657093..8c52c14085b 100644 --- a/spec/support/shared_contexts/features/integrations/integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/integrations_shared_context.rb @@ -76,6 +76,8 @@ Integration.available_integration_names.each do |integration| hash.merge!(k => 'ABC1') elsif integration == 'apple_app_store' && k == :app_store_private_key_file_name hash.merge!(k => 'ssl_key.pem') + elsif integration == 'google_play' && k == :package_name + hash.merge!(k => 'com.gitlab.foo.bar') elsif integration == 'google_play' && k == :service_account_key hash.merge!(k => File.read('spec/fixtures/service_account.json')) elsif integration == 'google_play' && k == :service_account_key_file_name diff --git a/spec/support/shared_contexts/issuable/merge_request_shared_context.rb b/spec/support/shared_contexts/issuable/merge_request_shared_context.rb index b9cde12c537..35c1511c96a 100644 --- a/spec/support/shared_contexts/issuable/merge_request_shared_context.rb +++ b/spec/support/shared_contexts/issuable/merge_request_shared_context.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_context 'merge request show action' do - include Spec::Support::Helpers::Features::MergeRequestHelpers + include Features::MergeRequestHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public, :repository) } diff --git a/spec/support/shared_examples/features/2fa_shared_examples.rb b/spec/support/shared_examples/features/2fa_shared_examples.rb index b6339607d6b..13d87ea12a2 100644 --- a/spec/support/shared_examples/features/2fa_shared_examples.rb +++ b/spec/support/shared_examples/features/2fa_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'hardware device for 2fa' do |device_type| - include Spec::Support::Helpers::Features::TwoFactorHelpers + include Features::TwoFactorHelpers include Spec::Support::Helpers::ModalHelpers def register_device(device_type, **kwargs) diff --git a/spec/support/shared_examples/features/access_tokens_shared_examples.rb b/spec/support/shared_examples/features/access_tokens_shared_examples.rb index 32a7b32ac72..3c78869ffaa 100644 --- a/spec/support/shared_examples/features/access_tokens_shared_examples.rb +++ b/spec/support/shared_examples/features/access_tokens_shared_examples.rb @@ -9,7 +9,7 @@ RSpec.shared_examples 'resource access tokens missing access rights' do end RSpec.shared_examples 'resource access tokens creation' do |resource_type| - include Spec::Support::Helpers::AccessTokenHelpers + include Features::AccessTokenHelpers it 'allows creation of an access token', :aggregate_failures do name = 'My access token' diff --git a/spec/support/shared_examples/features/confidential_notes_shared_examples.rb b/spec/support/shared_examples/features/confidential_notes_shared_examples.rb index 289da025af6..cd0e8f94934 100644 --- a/spec/support/shared_examples/features/confidential_notes_shared_examples.rb +++ b/spec/support/shared_examples/features/confidential_notes_shared_examples.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.shared_examples 'confidential notes on issuables' do - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers context 'when user does not have permissions' do it 'does not show confidential note checkbox' do diff --git a/spec/support/shared_examples/features/issuable_invite_members_shared_examples.rb b/spec/support/shared_examples/features/issuable_invite_members_shared_examples.rb index 13adcfe9191..b8c6b85adb2 100644 --- a/spec/support/shared_examples/features/issuable_invite_members_shared_examples.rb +++ b/spec/support/shared_examples/features/issuable_invite_members_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'issuable invite members' do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers context 'when a privileged user can invite' do before do diff --git a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb index c2dc87b0fb0..6487e6a94c1 100644 --- a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb +++ b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'Maintainer manages access requests' do - include Spec::Support::Helpers::Features::MembersHelpers + include Features::MembersHelpers let(:user) { create(:user) } let(:maintainer) { create(:user) } diff --git a/spec/support/shared_examples/features/runners_shared_examples.rb b/spec/support/shared_examples/features/runners_shared_examples.rb index 63a0832117d..59f566f97d7 100644 --- a/spec/support/shared_examples/features/runners_shared_examples.rb +++ b/spec/support/shared_examples/features/runners_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'shows and resets runner registration token' do - include Spec::Support::Helpers::Features::RunnersHelpers + include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers before do diff --git a/spec/support/shared_examples/features/work_items_shared_examples.rb b/spec/support/shared_examples/features/work_items_shared_examples.rb index 0b8bfc4d2a2..6bc589fea8f 100644 --- a/spec/support/shared_examples/features/work_items_shared_examples.rb +++ b/spec/support/shared_examples/features/work_items_shared_examples.rb @@ -140,7 +140,7 @@ RSpec.shared_examples 'work items description' do end RSpec.shared_examples 'work items invite members' do - include Spec::Support::Helpers::Features::InviteMembersModalHelper + include Features::InviteMembersModalHelpers it 'successfully assigns the current user by searching' do # The button is only when the mouse is over the input diff --git a/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb index d8690356f81..7cbaf40721a 100644 --- a/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'close quick action' do |issuable_type| - include Spec::Support::Helpers::Features::NotesHelpers + include Features::NotesHelpers before do project.add_maintainer(maintainer) diff --git a/spec/tooling/lib/tooling/mappings/partial_to_views_mappings_spec.rb b/spec/tooling/lib/tooling/mappings/partial_to_views_mappings_spec.rb index 69dddb0ae3d..375be001bd1 100644 --- a/spec/tooling/lib/tooling/mappings/partial_to_views_mappings_spec.rb +++ b/spec/tooling/lib/tooling/mappings/partial_to_views_mappings_spec.rb @@ -61,7 +61,8 @@ RSpec.describe Tooling::Mappings::PartialToViewsMappings, feature_category: :too let(:changed_files) do [ "#{view_base_folder}/my_view.html.haml", - "#{view_base_folder}/_my_partial.html.haml" + "#{view_base_folder}/_my_partial.html.haml", + "#{view_base_folder}/_my_other_partial.html.haml" ] end diff --git a/tooling/lib/tooling/mappings/partial_to_views_mappings.rb b/tooling/lib/tooling/mappings/partial_to_views_mappings.rb index 1b36894d881..c0cf378b53b 100644 --- a/tooling/lib/tooling/mappings/partial_to_views_mappings.rb +++ b/tooling/lib/tooling/mappings/partial_to_views_mappings.rb @@ -94,7 +94,7 @@ module Tooling end def find_pattern_in_file(file, pattern) - File.read(file).scan(pattern).flatten.uniq + File.read(file).scan(pattern).flatten.compact.uniq end private |