From 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Nov 2021 13:16:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-5-stable-ee --- spec/features/admin/admin_appearance_spec.rb | 2 +- spec/features/admin/admin_deploy_keys_spec.rb | 28 +++-- .../admin/admin_disables_two_factor_spec.rb | 1 + spec/features/admin/admin_groups_spec.rb | 1 + spec/features/admin/admin_hooks_spec.rb | 1 + spec/features/admin/admin_labels_spec.rb | 1 + .../admin/admin_manage_applications_spec.rb | 1 + spec/features/admin/admin_runners_spec.rb | 113 ++++++++++++++++++--- .../admin/admin_sees_project_statistics_spec.rb | 2 +- spec/features/admin/admin_settings_spec.rb | 8 +- .../admin/admin_users_impersonation_tokens_spec.rb | 1 + .../admin/admin_uses_repository_checks_spec.rb | 1 + spec/features/admin/clusters/eks_spec.rb | 2 +- spec/features/admin/users/user_spec.rb | 1 + spec/features/admin/users/users_spec.rb | 7 +- 15 files changed, 139 insertions(+), 31 deletions(-) (limited to 'spec/features/admin') diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index cb69eac8035..0785c736cfb 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -94,7 +94,7 @@ RSpec.describe 'Admin Appearance' do sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) visit new_project_path - find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage + click_link 'Create blank project' expect_custom_new_project_appearance(appearance) end diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb index c326d0fd741..53caf0fac33 100644 --- a/spec/features/admin/admin_deploy_keys_spec.rb +++ b/spec/features/admin/admin_deploy_keys_spec.rb @@ -3,11 +3,13 @@ require 'spec_helper' RSpec.describe 'admin deploy keys' do + let_it_be(:admin) { create(:admin) } + let!(:deploy_key) { create(:deploy_key, public: true) } let!(:another_deploy_key) { create(:another_deploy_key, public: true) } before do - admin = create(:admin) + stub_feature_flags(admin_deploy_keys_vue: false) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) end @@ -15,7 +17,7 @@ RSpec.describe 'admin deploy keys' do it 'show all public deploy keys' do visit admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content(deploy_key.title) expect(page).to have_content(another_deploy_key.title) end @@ -26,7 +28,7 @@ RSpec.describe 'admin deploy keys' do visit admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content(write_key.project.full_name) end end @@ -46,7 +48,7 @@ RSpec.describe 'admin deploy keys' do expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content('laptop') end end @@ -64,7 +66,7 @@ RSpec.describe 'admin deploy keys' do expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content('new-title') end end @@ -79,9 +81,23 @@ RSpec.describe 'admin deploy keys' do find('tr', text: deploy_key.title).click_link('Remove') expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).not_to have_content(deploy_key.title) end end end + + context 'when `admin_deploy_keys_vue` feature flag is enabled', :js do + before do + stub_feature_flags(admin_deploy_keys_vue: true) + + visit admin_deploy_keys_path + end + + it 'renders the Vue app', :aggregate_failures do + expect(page).to have_content('Public deploy keys') + expect(page).to have_selector('[data-testid="deploy-keys-list"]') + expect(page).to have_link('New deploy key', href: new_admin_deploy_key_path) + end + end end diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index 1f34c4ed17c..f65e85b4cb6 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'Admin disables 2FA for a user' do it 'successfully', :js do + stub_feature_flags(bootstrap_confirmation_modals: false) admin = create(:admin) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 8315b8f44b0..8d4e7a7442c 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -252,6 +252,7 @@ RSpec.describe 'Admin Groups' do describe 'admin remove themself from a group', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/222342' do it 'removes admin from the group' do + stub_feature_flags(bootstrap_confirmation_modals: false) group.add_user(current_user, Gitlab::Access::DEVELOPER) visit group_group_members_path(group) diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index a501efd82ed..32e4d18227e 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -79,6 +79,7 @@ RSpec.describe 'Admin::Hooks' do let(:hook_url) { generate(:url) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) create(:system_hook, url: hook_url) end diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index 08d81906d9f..65de1160cfd 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -14,6 +14,7 @@ RSpec.describe 'admin issues labels' do describe 'list' do before do + stub_feature_flags(bootstrap_confirmation_modals: false) visit admin_labels_path end diff --git a/spec/features/admin/admin_manage_applications_spec.rb b/spec/features/admin/admin_manage_applications_spec.rb index b6437fce540..4cf290293bd 100644 --- a/spec/features/admin/admin_manage_applications_spec.rb +++ b/spec/features/admin/admin_manage_applications_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe 'admin manage applications' do let_it_be(:new_application_path) { new_admin_application_path } let_it_be(:applications_path) { admin_applications_path } + let_it_be(:index_path) { admin_applications_path } before do admin = create(:admin) diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 8053be89ffc..7e2751daefa 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -24,40 +24,37 @@ RSpec.describe "Admin Runners" do visit admin_runners_path - expect(page).to have_text "Set up a shared runner manually" + expect(page).to have_text "Register an instance runner" expect(page).to have_text "Runners currently online: 1" end - it 'with an instance runner shows an instance badge and no project count' do + it 'with an instance runner shows an instance badge' do runner = create(:ci_runner, :instance) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'shared' - expect(page).to have_text 'n/a' end end - it 'with a group runner shows a group badge and no project count' do + it 'with a group runner shows a group badge' do runner = create(:ci_runner, :group, groups: [group]) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'group' - expect(page).to have_text 'n/a' end end - it 'with a project runner shows a project badge and project count' do + it 'with a project runner shows a project badge' do runner = create(:ci_runner, :project, projects: [project]) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'specific' - expect(page).to have_text '1' end end @@ -69,6 +66,13 @@ RSpec.describe "Admin Runners" do visit admin_runners_path end + it 'runner types tabs have total counts and can be selected' do + expect(page).to have_link('All 2') + expect(page).to have_link('Instance 2') + expect(page).to have_link('Group 0') + expect(page).to have_link('Project 0') + end + it 'shows runners' do expect(page).to have_content("runner-foo") expect(page).to have_content("runner-bar") @@ -137,6 +141,19 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' end + + it 'shows correct runner when type is selected and search term is entered' do + create(:ci_runner, :instance, description: 'runner-connected', contacted_at: Time.now) + create(:ci_runner, :instance, description: 'runner-not-connected', contacted_at: nil) + + visit admin_runners_path + + # use the string "Not" to avoid using space and trigger an early selection + input_filtered_search_filter_is_only('Status', 'Not') + + expect(page).not_to have_content 'runner-connected' + expect(page).to have_content 'runner-not-connected' + end end describe 'filter by type' do @@ -145,13 +162,25 @@ RSpec.describe "Admin Runners" do create(:ci_runner, :group, description: 'runner-group', groups: [group]) end + it '"All" tab is selected by default' do + visit admin_runners_path + + page.within('[data-testid="runner-type-tabs"]') do + expect(page).to have_link('All', class: 'active') + end + end + it 'shows correct runner when type matches' do visit admin_runners_path expect(page).to have_content 'runner-project' expect(page).to have_content 'runner-group' - input_filtered_search_filter_is_only('Type', 'project') + page.within('[data-testid="runner-type-tabs"]') do + click_on('Project') + + expect(page).to have_link('Project', class: 'active') + end expect(page).to have_content 'runner-project' expect(page).not_to have_content 'runner-group' @@ -160,7 +189,11 @@ RSpec.describe "Admin Runners" do it 'shows no runner when type does not match' do visit admin_runners_path - input_filtered_search_filter_is_only('Type', 'instance') + page.within('[data-testid="runner-type-tabs"]') do + click_on 'Instance' + + expect(page).to have_link('Instance', class: 'active') + end expect(page).not_to have_content 'runner-project' expect(page).not_to have_content 'runner-group' @@ -173,7 +206,9 @@ RSpec.describe "Admin Runners" do visit admin_runners_path - input_filtered_search_filter_is_only('Type', 'project') + page.within('[data-testid="runner-type-tabs"]') do + click_on 'Project' + end expect(page).to have_content 'runner-project' expect(page).to have_content 'runner-2-project' @@ -185,6 +220,26 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-2-project' expect(page).not_to have_content 'runner-group' end + + it 'maintains the same filter when switching between runner types' do + create(:ci_runner, :project, description: 'runner-paused-project', active: false, projects: [project]) + + visit admin_runners_path + + input_filtered_search_filter_is_only('Status', 'Active') + + expect(page).to have_content 'runner-project' + expect(page).to have_content 'runner-group' + expect(page).not_to have_content 'runner-paused-project' + + page.within('[data-testid="runner-type-tabs"]') do + click_on 'Project' + end + + expect(page).to have_content 'runner-project' + expect(page).not_to have_content 'runner-group' + expect(page).not_to have_content 'runner-paused-project' + end end describe 'filter by tag' do @@ -267,29 +322,55 @@ RSpec.describe "Admin Runners" do end it 'has all necessary texts including no runner message' do - expect(page).to have_text "Set up a shared runner manually" + expect(page).to have_text "Register an instance runner" expect(page).to have_text "Runners currently online: 0" expect(page).to have_text 'No runners found' end end - describe 'runners registration token' do + describe 'runners registration' do let!(:token) { Gitlab::CurrentSettings.runners_registration_token } before do visit admin_runners_path + + click_on 'Register an instance runner' + end + + describe 'show registration instructions' do + before do + click_on 'Show runner installation and registration instructions' + + wait_for_requests + end + + it 'opens runner installation modal' do + expect(page).to have_text "Install a runner" + + expect(page).to have_text "Environment" + expect(page).to have_text "Architecture" + expect(page).to have_text "Download and install binary" + end + + it 'dismisses runner installation modal' do + page.within('[role="dialog"]') do + click_button('Close', match: :first) + end + + expect(page).not_to have_text "Install a runner" + end end it 'has a registration token' do click_on 'Click to reveal' - expect(page.find('[data-testid="registration-token"]')).to have_content(token) + expect(page.find('[data-testid="token-value"]')).to have_content(token) end describe 'reset registration token' do - let(:page_token) { find('[data-testid="registration-token"]').text } + let(:page_token) { find('[data-testid="token-value"]').text } before do - click_button 'Reset registration token' + click_on 'Reset registration token' page.accept_alert @@ -297,6 +378,8 @@ RSpec.describe "Admin Runners" do end it 'changes registration token' do + click_on 'Register an instance runner' + click_on 'Click to reveal' expect(page_token).not_to eq token end diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb index 3433cc01b8e..9d9217c4574 100644 --- a/spec/features/admin/admin_sees_project_statistics_spec.rb +++ b/spec/features/admin/admin_sees_project_statistics_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "Admin > Admin sees project statistics" do let(:project) { create(:project, :repository) } it "shows project statistics" do - expect(page).to have_content("Storage: 0 Bytes (Repository: 0 Bytes / Wikis: 0 Bytes / Build Artifacts: 0 Bytes / LFS: 0 Bytes / Snippets: 0 Bytes / Packages: 0 Bytes / Uploads: 0 Bytes)") + expect(page).to have_content("Storage: 0 Bytes (Repository: 0 Bytes / Wikis: 0 Bytes / Build Artifacts: 0 Bytes / Pipeline Artifacts: 0 Bytes / LFS: 0 Bytes / Snippets: 0 Bytes / Packages: 0 Bytes / Uploads: 0 Bytes)") end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 1c50a7f891f..0a39baca259 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -491,22 +491,22 @@ RSpec.describe 'Admin updates settings' do group = create(:group) page.within('.as-performance-bar') do - check 'Allow non-administrators to access to the performance bar' + check 'Allow non-administrators access to the performance bar' fill_in 'Allow access to members of the following group', with: group.path click_on 'Save changes' end expect(page).to have_content "Application settings saved successfully" - expect(find_field('Allow non-administrators to access to the performance bar')).to be_checked + expect(find_field('Allow non-administrators access to the performance bar')).to be_checked expect(find_field('Allow access to members of the following group').value).to eq group.path page.within('.as-performance-bar') do - uncheck 'Allow non-administrators to access to the performance bar' + uncheck 'Allow non-administrators access to the performance bar' click_on 'Save changes' end expect(page).to have_content 'Application settings saved successfully' - expect(find_field('Allow non-administrators to access to the performance bar')).not_to be_checked + expect(find_field('Allow non-administrators access to the performance bar')).not_to be_checked expect(find_field('Allow access to members of the following group').value).to be_nil end diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index ed8ea84fbf8..6643ebe82e6 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -74,6 +74,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do let!(:impersonation_token) { create(:personal_access_token, :impersonation, user: user) } it "allows revocation of an active impersonation token" do + stub_feature_flags(bootstrap_confirmation_modals: false) visit admin_user_impersonation_tokens_path(user_id: user.username) accept_confirm { click_on "Revoke" } diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index 0e448446085..c13313609b5 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -8,6 +8,7 @@ RSpec.describe 'Admin uses repository checks', :request_store do let(:admin) { create(:admin) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) end diff --git a/spec/features/admin/clusters/eks_spec.rb b/spec/features/admin/clusters/eks_spec.rb index a1bac720349..bb2678de2ae 100644 --- a/spec/features/admin/clusters/eks_spec.rb +++ b/spec/features/admin/clusters/eks_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'Instance-level AWS EKS Cluster', :js do before do visit admin_clusters_path - click_link 'Integrate with a cluster certificate' + click_link 'Connect with a certificate' end context 'when user creates a cluster on AWS EKS' do diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index 624bfde7359..73477fb93dd 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -9,6 +9,7 @@ RSpec.describe 'Admin::Users::User' do let_it_be(:current_user) { create(:admin) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(current_user) gitlab_enable_admin_mode_sign_in(current_user) end diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 119b01ff552..fa943245fcb 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -9,6 +9,7 @@ RSpec.describe 'Admin::Users' do let_it_be(:current_user) { create(:admin) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(current_user) gitlab_enable_admin_mode_sign_in(current_user) end @@ -164,7 +165,7 @@ RSpec.describe 'Admin::Users' do visit admin_users_path - page.within('.filter-two-factor-enabled small') do + page.within('.filter-two-factor-enabled .gl-tab-counter-badge') do expect(page).to have_content('1') end end @@ -181,7 +182,7 @@ RSpec.describe 'Admin::Users' do it 'counts users who have not enabled 2FA' do visit admin_users_path - page.within('.filter-two-factor-disabled small') do + page.within('.filter-two-factor-disabled .gl-tab-counter-badge') do expect(page).to have_content('2') # Including admin end end @@ -200,7 +201,7 @@ RSpec.describe 'Admin::Users' do visit admin_users_path - page.within('.filter-blocked-pending-approval small') do + page.within('.filter-blocked-pending-approval .gl-tab-counter-badge') do expect(page).to have_content('2') end end -- cgit v1.2.1