diff --git a/ee/spec/features/admin/admin_audit_logs_spec.rb b/ee/spec/features/admin/admin_audit_logs_spec.rb index 16210098bde25e0ab09b9ad4d7c0f5dbd102d75b..cb6b8c24d87dac487300ce89fcb9cc321758d685 100644 --- a/ee/spec/features/admin/admin_audit_logs_spec.rb +++ b/ee/spec/features/admin/admin_audit_logs_spec.rb @@ -10,7 +10,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'unlicensed' do diff --git a/ee/spec/features/admin/admin_credentials_inventory_spec.rb b/ee/spec/features/admin/admin_credentials_inventory_spec.rb index 86dfe383cc22b6805ffcf153b7b717f65bfe1616..c3a0822258f2db6b46459215c6a03695a40f24a6 100644 --- a/ee/spec/features/admin/admin_credentials_inventory_spec.rb +++ b/ee/spec/features/admin/admin_credentials_inventory_spec.rb @@ -8,7 +8,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'unlicensed' do diff --git a/ee/spec/features/admin/admin_dashboard_spec.rb b/ee/spec/features/admin/admin_dashboard_spec.rb index cd665fbfd8c3c067bf9543f5cf6620977dda17b8..fe5d8014e4725855d01567c6c77898b543ece57e 100644 --- a/ee/spec/features/admin/admin_dashboard_spec.rb +++ b/ee/spec/features/admin/admin_dashboard_spec.rb @@ -6,7 +6,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'Users statistic' do diff --git a/ee/spec/features/admin/admin_dev_ops_reports_spec.rb b/ee/spec/features/admin/admin_dev_ops_reports_spec.rb index 880d41f4e9e2819b2fa0fe78447ac5f4d4aa2699..f9b5c9e3aa01ad6ba04aaae34005a57cd0be1de3 100644 --- a/ee/spec/features/admin/admin_dev_ops_reports_spec.rb +++ b/ee/spec/features/admin/admin_dev_ops_reports_spec.rb @@ -24,7 +24,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'with ultimate license' do diff --git a/ee/spec/features/admin/admin_emails_spec.rb b/ee/spec/features/admin/admin_emails_spec.rb index 1498036bf8cbc6a80fc07f914e5e43062e872ee0..7341c7e824a7c3caf55497cd8793181dbcf1ef2b 100644 --- a/ee/spec/features/admin/admin_emails_spec.rb +++ b/ee/spec/features/admin/admin_emails_spec.rb @@ -8,7 +8,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'when `send_emails_from_admin_area` feature is not licensed', feature_category: :system_access do diff --git a/ee/spec/features/admin/admin_groups_spec.rb b/ee/spec/features/admin/admin_groups_spec.rb index d61150aa575604b85d187feb26d0998f8587cd0c..796130e921c2dd1c7c9b199dafaae372b2054f2a 100644 --- a/ee/spec/features/admin/admin_groups_spec.rb +++ b/ee/spec/features/admin/admin_groups_spec.rb @@ -11,7 +11,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'show a group' do diff --git a/ee/spec/features/admin/admin_interacts_with_push_rules_spec.rb b/ee/spec/features/admin/admin_interacts_with_push_rules_spec.rb index f3618e1ec7632e596c1b884f166e7e8a037edbf8..ada31877596cb7a7a8c68db5afee40eb1cdcb4bb 100644 --- a/ee/spec/features/admin/admin_interacts_with_push_rules_spec.rb +++ b/ee/spec/features/admin/admin_interacts_with_push_rules_spec.rb @@ -10,7 +10,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end push_rules_with_titles = { diff --git a/ee/spec/features/admin/admin_merge_requests_approvals_spec.rb b/ee/spec/features/admin/admin_merge_requests_approvals_spec.rb index 7c0e93689cd5b5f8b6a88c8b46abb44727536f03..44f2e5c9998ee8d0f2244ca90824280b23632d09 100644 --- a/ee/spec/features/admin/admin_merge_requests_approvals_spec.rb +++ b/ee/spec/features/admin/admin_merge_requests_approvals_spec.rb @@ -11,7 +11,7 @@ before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') allow(License).to receive(:feature_available?).and_return(true) diff --git a/ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb b/ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb index b9a3d82a33c47a7717b8d3903209095ab0a0c274..ee415104c7c65b2bfc550bf7528e022fab523fc1 100644 --- a/ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb +++ b/ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb @@ -9,7 +9,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end shared_examples 'resetting compute usage' do diff --git a/ee/spec/features/admin/admin_roles_and_permissions_spec.rb b/ee/spec/features/admin/admin_roles_and_permissions_spec.rb index c5569a5ec233f135e3ac4be2d19dfde1eec394e0..4cc1b76960069caa24d5bde943c196ee55027b1f 100644 --- a/ee/spec/features/admin/admin_roles_and_permissions_spec.rb +++ b/ee/spec/features/admin/admin_roles_and_permissions_spec.rb @@ -7,7 +7,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) stub_licensed_features(custom_roles: true) end diff --git a/ee/spec/features/admin/admin_runners_spec.rb b/ee/spec/features/admin/admin_runners_spec.rb index caf4cd980adb2415d9c66565a90544a51e7daaa0..bf5ba4278140ace63f0611c6f220897f17430aa8 100644 --- a/ee/spec/features/admin/admin_runners_spec.rb +++ b/ee/spec/features/admin/admin_runners_spec.rb @@ -10,7 +10,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) wait_for_requests end diff --git a/ee/spec/features/admin/admin_sends_notification_spec.rb b/ee/spec/features/admin/admin_sends_notification_spec.rb index 1822f05330b85c8a10f0d9304f974d4721969d26..2f264e27b8d08a746e60c34df25ad3c4029372f0 100644 --- a/ee/spec/features/admin/admin_sends_notification_spec.rb +++ b/ee/spec/features/admin/admin_sends_notification_spec.rb @@ -16,7 +16,7 @@ group.add_developer(user2) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit(admin_email_path) diff --git a/ee/spec/features/admin/admin_settings_spec.rb b/ee/spec/features/admin/admin_settings_spec.rb index d541273580f0d2e916970b32ba7eda464791fc5e..c40d0139e5682b017fc489d2eae84986f387cdea 100644 --- a/ee/spec/features/admin/admin_settings_spec.rb +++ b/ee/spec/features/admin/admin_settings_spec.rb @@ -11,7 +11,7 @@ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) allow(License).to receive(:feature_available?).and_return(true) allow(Gitlab::Elastic::Helper.default).to receive(:index_exists?).and_return(true) end diff --git a/ee/spec/features/admin/admin_users_spec.rb b/ee/spec/features/admin/admin_users_spec.rb index 0f2b022eb10fd17f579fd483c7b90c77c3e5b798..49966ed76d25efca8f4c5adf63b2de84a632bd58 100644 --- a/ee/spec/features/admin/admin_users_spec.rb +++ b/ee/spec/features/admin/admin_users_spec.rb @@ -8,7 +8,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'GET /admin/users' do diff --git a/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb b/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb index f77dee309bfa754a9bfdae1bfe696f2a5e29f9f5..bc3b81edae1d5a4404017e1a3ca0a95ddb2bb050 100644 --- a/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb +++ b/ee/spec/features/admin/geo/admin_geo_nodes_spec.rb @@ -29,7 +29,7 @@ def expect_breadcrumb(text) allow(Gitlab::Geo).to receive(:license_allows?).and_return(true) admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'index' do diff --git a/ee/spec/features/admin/geo/admin_geo_replication_nav_spec.rb b/ee/spec/features/admin/geo/admin_geo_replication_nav_spec.rb index d9897b62c695f5bcc4cc88fe824d5752f50ed216..67b50b39218a7fc79a6087eddbc789f7c822eafb 100644 --- a/ee/spec/features/admin/geo/admin_geo_replication_nav_spec.rb +++ b/ee/spec/features/admin/geo/admin_geo_replication_nav_spec.rb @@ -12,7 +12,7 @@ before do stub_licensed_features(geo: true) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) stub_current_geo_node(secondary_node) stub_geo_setting(registry_replication: { enabled: true }) end diff --git a/ee/spec/features/admin/geo/admin_geo_sidebar_spec.rb b/ee/spec/features/admin/geo/admin_geo_sidebar_spec.rb index 9ef40a1011c4d1ccc5b5e6532a7febe2871b3f90..12e6f1ce8798c99d890700fc3fc708f97201f25d 100644 --- a/ee/spec/features/admin/geo/admin_geo_sidebar_spec.rb +++ b/ee/spec/features/admin/geo/admin_geo_sidebar_spec.rb @@ -14,7 +14,7 @@ stub_licensed_features(geo: true) stub_current_geo_node(primary_node) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end shared_examples 'active sidebar link' do |link_name| diff --git a/ee/spec/features/admin/groups/admin_changes_plan_spec.rb b/ee/spec/features/admin/groups/admin_changes_plan_spec.rb index c6f7cfbfcea9928cd491485a21d81152755430e9..b256a69cb1cf622be519d963c897628e89acd5a8 100644 --- a/ee/spec/features/admin/groups/admin_changes_plan_spec.rb +++ b/ee/spec/features/admin/groups/admin_changes_plan_spec.rb @@ -12,7 +12,7 @@ allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'for group namespace' do diff --git a/ee/spec/features/admin/groups/admin_sets_group_repo_storage_limit_spec.rb b/ee/spec/features/admin/groups/admin_sets_group_repo_storage_limit_spec.rb index f67c5d5fbc70df8b05571318a9b66b47d006e04d..9b5583b072add4d80d162098b521af80317ca2ba 100644 --- a/ee/spec/features/admin/groups/admin_sets_group_repo_storage_limit_spec.rb +++ b/ee/spec/features/admin/groups/admin_sets_group_repo_storage_limit_spec.rb @@ -8,7 +8,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'saves and displays the value' do diff --git a/ee/spec/features/admin/groups/admin_subscription_alerts_spec.rb b/ee/spec/features/admin/groups/admin_subscription_alerts_spec.rb index 9f26d3759fd837039acb356b6dbcbc78ae5e70d5..4c6d194a74c2138dd891003527e3b099fbc05dd8 100644 --- a/ee/spec/features/admin/groups/admin_subscription_alerts_spec.rb +++ b/ee/spec/features/admin/groups/admin_subscription_alerts_spec.rb @@ -12,7 +12,7 @@ stub_feature_flags(namespace_storage_limit_show_preenforcement_banner: false) sign_in(admin) - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'for group namespace' do diff --git a/ee/spec/features/admin/licenses/admin_adds_license_spec.rb b/ee/spec/features/admin/licenses/admin_adds_license_spec.rb index 09477fd0ceda82c0a96e3c4a1bb60750b87d3f02..4e22da03324d83c427c54a7c8ebd70f326cf7b80 100644 --- a/ee/spec/features/admin/licenses/admin_adds_license_spec.rb +++ b/ee/spec/features/admin/licenses/admin_adds_license_spec.rb @@ -12,7 +12,7 @@ # (supposed to be) in-memory record in `Gitlab::CurrentSettings.in_memory_application_settings` stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'default state' do diff --git a/ee/spec/features/admin/licenses/show_user_count_threshold_spec.rb b/ee/spec/features/admin/licenses/show_user_count_threshold_spec.rb index 5f0514321fadb7d3234b689ae72dba26c2b29d97..89bbca2090360b5e891e00ed92fffa6be11773eb 100644 --- a/ee/spec/features/admin/licenses/show_user_count_threshold_spec.rb +++ b/ee/spec/features/admin/licenses/show_user_count_threshold_spec.rb @@ -46,7 +46,7 @@ context 'in admin area' do before do - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end let(:visit_path) { admin_root_path } diff --git a/ee/spec/features/admin/subscriptions/admin_views_subscription_spec.rb b/ee/spec/features/admin/subscriptions/admin_views_subscription_spec.rb index 69bf382983231b5b3d7f908c09ef8d0543899280..58aa03518466c2db0a053a2ccc4375e67dcd203a 100644 --- a/ee/spec/features/admin/subscriptions/admin_views_subscription_spec.rb +++ b/ee/spec/features/admin/subscriptions/admin_views_subscription_spec.rb @@ -10,7 +10,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end shared_examples 'an "Export license usage file" button' do diff --git a/ee/spec/features/admin/users/users_spec.rb b/ee/spec/features/admin/users/users_spec.rb index fd2ec877b58da0b7798a815179100c53c7cf1f6f..66d5d04d488390a96a134c3f868c9d1bfa4c8d06 100644 --- a/ee/spec/features/admin/users/users_spec.rb +++ b/ee/spec/features/admin/users/users_spec.rb @@ -11,7 +11,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'GET /admin/users/edit' do diff --git a/ee/spec/features/ci_shared_runner_settings_spec.rb b/ee/spec/features/ci_shared_runner_settings_spec.rb index f0fac13cb029821bb4c4a69c3ee95299a5968593..8f2cb9dc58da6982f1b8748f6db31a731699ea17 100644 --- a/ee/spec/features/ci_shared_runner_settings_spec.rb +++ b/ee/spec/features/ci_shared_runner_settings_spec.rb @@ -12,7 +12,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'without global shared runners quota' do diff --git a/ee/spec/features/clusters/cluster_detail_page_spec.rb b/ee/spec/features/clusters/cluster_detail_page_spec.rb index c14be0a0afe49772f6c59d10519f26291705945f..3b6691ea45de6797f9b3045311a3b370bbc4791d 100644 --- a/ee/spec/features/clusters/cluster_detail_page_spec.rb +++ b/ee/spec/features/clusters/cluster_detail_page_spec.rb @@ -53,7 +53,7 @@ let(:cluster) { create(:cluster, :provided_by_gcp, :instance) } before do - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end it 'shows the environments tab' do diff --git a/ee/spec/features/geo_node_spec.rb b/ee/spec/features/geo_node_spec.rb index 168c914b67bf735fc5d1485be619d62d5a15487a..34638a94faebfc18839d1ab5672887d7c57c95f1 100644 --- a/ee/spec/features/geo_node_spec.rb +++ b/ee/spec/features/geo_node_spec.rb @@ -42,7 +42,7 @@ stub_licensed_features(geo: true) sign_in(admin_user) - enable_admin_mode!(admin_user) + gitlab_enable_admin_mode_sign_in(admin_user) end describe 'Geo Sites admin screen' do diff --git a/ee/spec/features/groups/roles_and_permissions_spec.rb b/ee/spec/features/groups/roles_and_permissions_spec.rb index 17b7c61d0d75c2e3d9acb38c708f4bfddfe3b116..9cbcbca1b5c8d6536828dba3fc9317d3dac4e27c 100644 --- a/ee/spec/features/groups/roles_and_permissions_spec.rb +++ b/ee/spec/features/groups/roles_and_permissions_spec.rb @@ -8,7 +8,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) stub_licensed_features(custom_roles: true) end diff --git a/ee/spec/features/subscriptions/expiring_subscription_message_spec.rb b/ee/spec/features/subscriptions/expiring_subscription_message_spec.rb index 7c8d9259e284c0a79b9398129e922a85eae3636e..a8711552f54a48cf06c9964eb141cdd0405dc466 100644 --- a/ee/spec/features/subscriptions/expiring_subscription_message_spec.rb +++ b/ee/spec/features/subscriptions/expiring_subscription_message_spec.rb @@ -22,7 +22,7 @@ end sign_in(admin) - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'with a license with no expiration' do diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb index 9c425f8350870a0ac451f5a2cd9fbc5c3c5a27b6..5e98d2ffcf3b404a4458d78a902c5549d7582e0a 100644 --- a/spec/features/admin/admin_abuse_reports_spec.rb +++ b/spec/features/admin/admin_abuse_reports_spec.rb @@ -17,7 +17,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_abuse_reports_path end diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index ec63e43d1838dce58f531d7b6f20f58aa48653b9..2a9bff55dce75da1b0132c69cb8ac8d1264c3e4b 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -12,7 +12,7 @@ it 'create new appearance' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path fill_in 'appearance_title', with: 'MyCompany' @@ -39,7 +39,7 @@ it 'preview sign-in page appearance' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path click_link "Sign-in page" @@ -53,7 +53,7 @@ it 'preview new project page appearance', :js do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path click_link "New project page" @@ -64,7 +64,7 @@ context 'Custom system header and footer' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'when system header and footer messages are empty' do @@ -102,7 +102,7 @@ it 'custom new project page', :js do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit new_project_path click_link 'Create blank project' @@ -112,7 +112,7 @@ context 'Profile page with custom profile image guidelines' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines, please :smile:!' click_button 'Update appearance settings' @@ -128,7 +128,7 @@ it 'appearance logo' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_logo, logo_fixture) @@ -141,7 +141,7 @@ it 'appearance pwa icon' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_pwa_icon, logo_fixture) @@ -154,7 +154,7 @@ it 'header logos' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_header_logo, logo_fixture) @@ -167,7 +167,7 @@ it 'Favicon' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_favicon, logo_fixture) diff --git a/spec/features/admin/admin_browse_spam_logs_spec.rb b/spec/features/admin/admin_browse_spam_logs_spec.rb index 1f89232759c5ea00507c49aceb99588be8d71b7b..f781e2adf0748d9c2a30bf4971b2c1709baf07cd 100644 --- a/spec/features/admin/admin_browse_spam_logs_spec.rb +++ b/spec/features/admin/admin_browse_spam_logs_spec.rb @@ -8,7 +8,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'browse spam logs' do diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb index d6d021aeafc5f9345ff8addd6c3d7f0d2d0cf888..f9510ef296ab54273117e5ee232e6a0053d7136d 100644 --- a/spec/features/admin/admin_deploy_keys_spec.rb +++ b/spec/features/admin/admin_deploy_keys_spec.rb @@ -12,7 +12,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'show all public deploy keys' do diff --git a/spec/features/admin/admin_dev_ops_reports_spec.rb b/spec/features/admin/admin_dev_ops_reports_spec.rb index e820ae866a168176fd90210ee3ddec58fa2efa22..99d43e6b0dae5773477c84cd41eaf9f802f97f82 100644 --- a/spec/features/admin/admin_dev_ops_reports_spec.rb +++ b/spec/features/admin/admin_dev_ops_reports_spec.rb @@ -6,7 +6,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'without licensed feature devops adoption' do diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb index 039968025a92c97beab9d89edccaa4e6040ab563..76620b935578ac44cbe47773a07672ff48d2c964 100644 --- a/spec/features/admin/admin_disables_git_access_protocol_spec.rb +++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb @@ -12,7 +12,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'with HTTP disabled' do diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index cb3c897387259e4d57cfec6893efd287bd851322..eed20d449cdd42b9f62e081cd34eabb6a387e957 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -8,7 +8,7 @@ it 'successfully', :js do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) user = create(:user, :two_factor) edit_user(user) @@ -27,7 +27,7 @@ it 'for a user without 2FA enabled' do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) user = create(:user) edit_user(user) diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 283caddab6a9e731dc389f34cfaa6c9ca3e5286b..f071da1835a321fe5b4f49030fe64d0d0972fd72 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -15,7 +15,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) stub_application_setting(default_group_visibility: internal) end diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index fa91159c5f56cfe89b499fc975ce56012caebc7a..66014e676d58970b6df7d67a89736c38d54c6234 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -10,7 +10,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe '#show' do diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index 146c83dbeeeff445e9657909d79421631f12c19a..0a537e65b99b3c1b23ec70dfde86de9ffee5cc57 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -9,7 +9,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'show list of hook logs' do diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 9bdb7ce000fb16b785e547f870cf1d02a20b54fb..2aec5baf3514fbc5e229b17a2636dcc34ef6ee0c 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -9,7 +9,7 @@ before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end describe 'GET /admin/hooks' do diff --git a/spec/features/admin/admin_jobs_spec.rb b/spec/features/admin/admin_jobs_spec.rb index fc775c180ff2fde57d0af3515bd9d570a1f60ad4..b3e21d023544561646396a527588b9f475252821 100644 --- a/spec/features/admin/admin_jobs_spec.rb +++ b/spec/features/admin/admin_jobs_spec.rb @@ -8,7 +8,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'GET /admin/jobs' do diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index 2fe68363062cc51c834907be2b4b9438a912dc86..47dc8577037aa4435ee0d0b8c396821b2abfedda 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -11,7 +11,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'list' do diff --git a/spec/features/admin/admin_manage_applications_spec.rb b/spec/features/admin/admin_manage_applications_spec.rb index 3e351af612148059e1585455c928b8b04d199c35..b4c77e802a843b7b0fb0c2f20cc143caa4ff1f7c 100644 --- a/spec/features/admin/admin_manage_applications_spec.rb +++ b/spec/features/admin/admin_manage_applications_spec.rb @@ -10,7 +10,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end include_examples 'manage applications' diff --git a/spec/features/admin/admin_mode/login_spec.rb b/spec/features/admin/admin_mode/login_spec.rb index 5298407deb349df4b6a257be9d5342a02648498c..5e4935ee4b1e3ee045a1b3e343d9da3bf668dee0 100644 --- a/spec/features/admin/admin_mode/login_spec.rb +++ b/spec/features/admin/admin_mode/login_spec.rb @@ -24,7 +24,7 @@ def enter_code(code) repeated_otp = user.current_otp enter_code(repeated_otp) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) @@ -41,7 +41,7 @@ def enter_code(code) expect(page).to have_content('Enter verification code') enter_code(user.current_otp) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) end diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index beac36e28c52aa3ba2ed13ad26d8ad2e8805b192..584151726a69e53e0b04cb7c166a4a5eb4f99c75 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -12,7 +12,7 @@ # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See # this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851 sign_in(user) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) visit admin_root_path end diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb index f0cea425bb78e478b3c8f7a13909a7fed6311bb7..124c43eef9d6c587ee6bddcb5a00bdb8ae72f559 100644 --- a/spec/features/admin/admin_mode/workers_spec.rb +++ b/spec/features/admin/admin_mode/workers_spec.rb @@ -34,7 +34,7 @@ context 'when admin mode enabled', :delete do before do - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end it 'can delete user', :js do @@ -67,6 +67,6 @@ def execute_jobs_signed_out(user) Sidekiq::Worker.drain_all sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end end diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index 29eb24fa9b8ba331f7d5234830b8600cedf9100d..2a655cdb1f492efc4a78a7ff58214c077e21a1de 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -69,7 +69,7 @@ context 'when in admin_mode' do before do - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end it 'contains link to leave admin mode' do diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 978b21764310167a1996835df44558300b43326d..b793299e253334cd7a07618d4007f52f813aaa69 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -14,7 +14,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'when membership is set to expire', :js do diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 2b4ceb05f00111021fe40b0b297454281e4799e1..653458710e3c990af98b891500a6a894da29c03e 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -11,7 +11,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "Admin Runners page", :js do diff --git a/spec/features/admin/admin_search_settings_spec.rb b/spec/features/admin/admin_search_settings_spec.rb index c20a50cf218f45e433a7ac86f4efe4001ce2aca8..3254bf7573852c2a99d428e387d85be413067238 100644 --- a/spec/features/admin/admin_search_settings_spec.rb +++ b/spec/features/admin/admin_search_settings_spec.rb @@ -8,7 +8,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'in appearances page' do diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb index 43b920c657c1542863cf60a2942f193bdd756823..ae307b8038c1a84c25cb692cafc2b46efb318b1c 100644 --- a/spec/features/admin/admin_sees_background_migrations_spec.rb +++ b/spec/features/admin/admin_sees_background_migrations_spec.rb @@ -18,7 +18,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'can navigate to background migrations', :js do diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb index 07f90d247cd7936f8e32a9c5f158968fb268e890..d977735daf8098e9f1545b985899d28abe2a22a4 100644 --- a/spec/features/admin/admin_sees_project_statistics_spec.rb +++ b/spec/features/admin/admin_sees_project_statistics_spec.rb @@ -7,7 +7,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) visit admin_project_path(project) end diff --git a/spec/features/admin/admin_sees_projects_statistics_spec.rb b/spec/features/admin/admin_sees_projects_statistics_spec.rb index cc6ccbab0a07238949e0cc7904fa48baccd589df..3363a67ea9009c612fcc2b0418f1e43faec35413 100644 --- a/spec/features/admin/admin_sees_projects_statistics_spec.rb +++ b/spec/features/admin/admin_sees_projects_statistics_spec.rb @@ -10,7 +10,7 @@ create(:project, :repository) { |project| project.statistics.destroy! } sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) visit admin_projects_path end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index d1fdbfc5329f33e7788d5a04bc9d0bd334b25911..77707a67d580d585537574929951916d65bc3c8f 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -13,7 +13,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'General page' do diff --git a/spec/features/admin/admin_system_info_spec.rb b/spec/features/admin/admin_system_info_spec.rb index f285fefe6db9f3b02f675fc397c3225d43970bce..71a0b82993200a4c149ad5149e5d85501909d4b2 100644 --- a/spec/features/admin/admin_system_info_spec.rb +++ b/spec/features/admin/admin_system_info_spec.rb @@ -6,7 +6,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'GET /admin/system_info' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 7cfe0cdbc814fd8ac16008cc49e1518e3b15de05..543dc2cc2a62918a4f0d89c5546798d8e9eee184 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -11,7 +11,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "token creation" do diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index f09c1a59b0dd84c82a5edb05fd11052567ca91c1..9ab5b1fd3bb8758cbc7ee70f1005d2bac377746b 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -7,7 +7,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'Tabs' do diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index a628344bfeb1b220bc38afc909064b1ba26ae786..05232de35e584987aa92eccffe63436ea9fd1f1c 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -25,7 +25,7 @@ context 'when admin mode is enabled' do before do - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'to trigger a single check', :js do diff --git a/spec/features/admin/broadcast_messages_spec.rb b/spec/features/admin/broadcast_messages_spec.rb index 16651ffa07e87e29177d586cffae8132bff7da1d..e4a2e31ee1cc02429d4661b2a991a722d11e207c 100644 --- a/spec/features/admin/broadcast_messages_spec.rb +++ b/spec/features/admin/broadcast_messages_spec.rb @@ -7,7 +7,7 @@ it 'previews, creates and edits a broadcast message' do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) # create visit admin_broadcast_messages_path diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index 9e8f513881528d128caf4de2c92254e2e057c9c9..06f9c531e7459bcb3c13ae14a5a89af6af529c6d 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -8,7 +8,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'counting forks', :js, feature_category: :source_code_management do diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index b7e7a037ffcbe014aab7ba66ca275299761f42d9..d6f53fc6ca4884f449de8f3be03324b28cafabb8 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -11,7 +11,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user, use_ui: true) + gitlab_enable_admin_mode_sign_in(current_user, use_mock_admin_mode: false) end describe 'GET /admin/users/:id' do diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 20cedda626bfe84f220dc5da7b6715bd2fcf9dda..d2f3b0e8e40d848c9e12f9eb424acbb2293f6c3d 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -12,7 +12,7 @@ before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'GET /admin/users', :js do diff --git a/spec/features/admin_variables_spec.rb b/spec/features/admin_variables_spec.rb index 0fc0ae9e199fe8aa4d75dbb0e2560112b5311259..caa94209e50513b8eaec4340e413fe1c1ab01886 100644 --- a/spec/features/admin_variables_spec.rb +++ b/spec/features/admin_variables_spec.rb @@ -11,7 +11,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit page_path wait_for_requests diff --git a/spec/features/boards/keyboard_shortcut_spec.rb b/spec/features/boards/keyboard_shortcut_spec.rb index d4777fa671c55ee1faacd5044476c51ae4f0efc4..6f03f6db3ab30db782c1f4590d0f7a5cdc7aeeed 100644 --- a/spec/features/boards/keyboard_shortcut_spec.rb +++ b/spec/features/boards/keyboard_shortcut_spec.rb @@ -11,7 +11,7 @@ admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_path(project) end @@ -30,7 +30,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_path(project) end diff --git a/spec/features/broadcast_messages_spec.rb b/spec/features/broadcast_messages_spec.rb index 867ed3c3acb2a302f922943c366177ac02865f47..f887242384cf32dfd41735e3a0b615385bdc1896 100644 --- a/spec/features/broadcast_messages_spec.rb +++ b/spec/features/broadcast_messages_spec.rb @@ -121,7 +121,7 @@ stub_const('Gitlab::Cache::JsonCaches::JsonKeyed::STRATEGY_KEY_COMPONENTS', original_strategy_value) admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_broadcast_messages_path diff --git a/spec/features/clusters/cluster_detail_page_spec.rb b/spec/features/clusters/cluster_detail_page_spec.rb index 78ac752a375e0416ab4f4b37630ff82266686932..31dec5e38dafe6a6f60abc2e2d257c7f23f19bfa 100644 --- a/spec/features/clusters/cluster_detail_page_spec.rb +++ b/spec/features/clusters/cluster_detail_page_spec.rb @@ -145,7 +145,7 @@ let(:cluster) { create(:cluster, :provided_by_gcp, :instance) } before do - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end it_behaves_like 'show page' do diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 523ef8990bbeeb9ff75ebbf2d105c9c844d7093d..7fbd6c4e235e74055a04b5381d5f89b9b5c0faa9 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -12,7 +12,7 @@ allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) wait_for_requests diff --git a/spec/features/gitlab_experiments_spec.rb b/spec/features/gitlab_experiments_spec.rb index 0d0afa801c852412e610fcb3df917b7d34f5a9c2..facf4994c44d986bf43247669dbbba02d883041e 100644 --- a/spec/features/gitlab_experiments_spec.rb +++ b/spec/features/gitlab_experiments_spec.rb @@ -12,7 +12,7 @@ before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) stub_experiments(null_hypothesis: :candidate) end diff --git a/spec/features/groups/clusters/user_spec.rb b/spec/features/groups/clusters/user_spec.rb index 24552daa11bb60e81a67b48016526e5f49dc54b0..9089fba1886933263bf25cd30db51cf5dce365e4 100644 --- a/spec/features/groups/clusters/user_spec.rb +++ b/spec/features/groups/clusters/user_spec.rb @@ -130,7 +130,7 @@ gitlab_sign_out gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit group_clusters_path(group) end diff --git a/spec/features/groups/members/list_members_spec.rb b/spec/features/groups/members/list_members_spec.rb index b6e0deb2e7335472d725fc8b5a213f2c0f4a4ab4..b16d61a5fe4473afd6650d72280b479befa79c4e 100644 --- a/spec/features/groups/members/list_members_spec.rb +++ b/spec/features/groups/members/list_members_spec.rb @@ -66,7 +66,7 @@ it 'shows 2FA badge to admins' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit group_group_members_path(group) diff --git a/spec/features/help_dropdown_spec.rb b/spec/features/help_dropdown_spec.rb index 89040ec9ab6734715fb2195fda87f94f493e882a..3e4c0bc55fe3d2090c5df4d6f9a1c0813439affe 100644 --- a/spec/features/help_dropdown_spec.rb +++ b/spec/features/help_dropdown_spec.rb @@ -27,7 +27,7 @@ context "when severity is #{severity}" do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) allow_next_instance_of(VersionCheck) do |instance| allow(instance).to receive(:response).and_return({ "severity" => severity }) diff --git a/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb b/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb index f52520313b2f5981010caf32fe881bd121a78a35..7e33946f713753c3061af2a52f51a5bdc407e5e5 100644 --- a/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb +++ b/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb @@ -11,7 +11,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit(project_merge_requests_path(project)) end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index e7e419a4c602ef580c784b5b1b82dac9bd3e587b..c223053606bb02985334852ce8184c7e8cec2898 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -110,7 +110,7 @@ before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) visit general_admin_application_settings_path end diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index bc4d64dad2138ffb6f5a9424d21f3a9b1ba93aa4..067963e06e00c2c4c64698486d2508937aa7a941 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -120,7 +120,7 @@ gitlab_sign_out gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_clusters_path(project) end diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 5f1bc4f86c1a19af99257c8124b9791ab50167d9..c6a770cee9ea50812b6e161a68930ea2c146e3eb 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -153,7 +153,7 @@ before do non_member.update_attribute(:admin, true) sign_in(non_member) - enable_admin_mode!(non_member) + gitlab_enable_admin_mode_sign_in(non_member) end it 'renders 404 if feature is disabled' do diff --git a/spec/features/projects/members/manage_members_spec.rb b/spec/features/projects/members/manage_members_spec.rb index 2ab0e63d840690110a7680cea0635268d5363983..3423c636c2b1be633b6813d52824103c021285fc 100644 --- a/spec/features/projects/members/manage_members_spec.rb +++ b/spec/features/projects/members/manage_members_spec.rb @@ -265,7 +265,7 @@ it 'shows 2FA badge to admins' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit_members_page diff --git a/spec/features/projects/user_views_empty_project_spec.rb b/spec/features/projects/user_views_empty_project_spec.rb index 7dc3dd1da1e1682b2cbe4bd78cb2829c40b2c14c..ed34b109d29bcf428809c544e754dd90c701f209 100644 --- a/spec/features/projects/user_views_empty_project_spec.rb +++ b/spec/features/projects/user_views_empty_project_spec.rb @@ -43,7 +43,7 @@ context 'when admin mode is enabled' do before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end it_behaves_like 'allowing push to default branch' diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index c29323cba27645fee8fff23ecf5259833fec5118..4110563020433c9b00072f6cee61443efd14ad00 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -82,7 +82,7 @@ context 'logged in as admin' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "explicit protected branches" do diff --git a/spec/features/usage_stats_consent_spec.rb b/spec/features/usage_stats_consent_spec.rb index 5436018250db866b0d1551e5d10e9881f8a1a2c3..ebf1cd9e1439b5f723b539ffa1062216be81a833 100644 --- a/spec/features/usage_stats_consent_spec.rb +++ b/spec/features/usage_stats_consent_spec.rb @@ -19,7 +19,7 @@ end gitlab_sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end shared_examples 'dismissible banner' do |button_text| diff --git a/spec/features/user_settings/active_sessions_spec.rb b/spec/features/user_settings/active_sessions_spec.rb index bc0693d79e1f820b6d59cbca930af602bd56b35b..5d1d4bc64908889c2b263ad2448a39faf2976f51 100644 --- a/spec/features/user_settings/active_sessions_spec.rb +++ b/spec/features/user_settings/active_sessions_spec.rb @@ -47,7 +47,7 @@ ) gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_user_path(user) diff --git a/spec/support/helpers/admin_mode_helpers.rb b/spec/support/helpers/admin_mode_helpers.rb index 8b71552f9285cbbc6964d4a8c7c3097d5799ecd9..a6e31791127dbbf6e7f18237038f89a64e8afe69 100644 --- a/spec/support/helpers/admin_mode_helpers.rb +++ b/spec/support/helpers/admin_mode_helpers.rb @@ -5,30 +5,17 @@ module AdminModeHelper # Administrators are logged in by default in user mode and have to switch to admin # mode for accessing any administrative functionality. This helper lets a user - # access the admin area in two different ways: - # - # * Fast (use_ui: false) and suitable form the most use cases: fakes calls and grants - # access to the admin area without requiring a second authentication step (provided the - # user is an admin) - # * Slow (use_ui: true): visits the admin UI and enters the users password. A second - # authentication step may be needed. + # be in admin mode without requiring a second authentication step (provided + # the user is an admin) # # See also tag :enable_admin_mode in spec/spec_helper.rb for a spec-wide # alternative - def enable_admin_mode!(user, use_ui: false) - if use_ui - visit new_admin_session_path - fill_in 'user_password', with: user.password - click_button 'Enter admin mode' - - wait_for_requests - else - fake_user_mode = instance_double(Gitlab::Auth::CurrentUserMode) + def enable_admin_mode!(user) + fake_user_mode = instance_double(Gitlab::Auth::CurrentUserMode) - allow(Gitlab::Auth::CurrentUserMode).to receive(:new).and_call_original + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).and_call_original - allow(Gitlab::Auth::CurrentUserMode).to receive(:new).with(user).and_return(fake_user_mode) - allow(fake_user_mode).to receive(:admin_mode?).and_return(user&.admin?) - end + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).with(user).and_return(fake_user_mode) + allow(fake_user_mode).to receive(:admin_mode?).and_return(user&.admin?) end end diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index ff1c528d94a9237242915086d8cf06163e322d79..0cdddeaa84adc1e30fd6789846f1d2a4692e414c 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -49,6 +49,18 @@ def gitlab_sign_in(user_or_role, **kwargs) @current_user = user end + def gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: true) + if use_mock_admin_mode + enable_admin_mode!(user) + else + visit new_admin_session_path + fill_in 'user_password', with: user.password + click_button 'Enter admin mode' + + wait_for_requests + end + end + def gitlab_sign_in_via(provider, user, uid, saml_response = nil) mock_auth_hash_with_saml_xml(provider, uid, user.email, saml_response) visit new_user_session_path diff --git a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb index 678199a35eac1302a24dcc57953ee177fe1bc998..c740917cec45d3dbdcfed62cdb36a375c4267c38 100644 --- a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb @@ -7,7 +7,7 @@ before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end def visit_instance_integrations diff --git a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb index d21e69b72e1c080059f80dd9b5b6a7bf3ed4e2a8..4921676a0656ec92cb8beac75d6bb5398b581db9 100644 --- a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb +++ b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb @@ -9,7 +9,7 @@ before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'shows groups where the admin has no direct membership' do