diff options
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_disables_two_factor_spec.rb | 7 | ||||
-rw-r--r-- | spec/features/admin/admin_groups_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/admin/admin_hook_logs_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/admin/admin_hooks_spec.rb | 7 | ||||
-rw-r--r-- | spec/features/admin/admin_labels_spec.rb | 9 | ||||
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 91 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/admin/admin_users_impersonation_tokens_spec.rb | 5 | ||||
-rw-r--r-- | spec/features/admin/admin_uses_repository_checks_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/users/user_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/admin/users/users_spec.rb | 10 |
11 files changed, 110 insertions, 67 deletions
diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index f65e85b4cb6..4463dbb1eb0 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -3,8 +3,9 @@ require 'spec_helper' RSpec.describe 'Admin disables 2FA for a user' do + include Spec::Support::Helpers::ModalHelpers + it 'successfully', :js do - stub_feature_flags(bootstrap_confirmation_modals: false) admin = create(:admin) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) @@ -12,9 +13,11 @@ RSpec.describe 'Admin disables 2FA for a user' do edit_user(user) page.within('.two-factor-status') do - accept_confirm { click_link 'Disable' } + click_link 'Disable' end + accept_gl_confirm(button_text: 'Disable') + page.within('.two-factor-status') do expect(page).to have_content 'Disabled' expect(page).not_to have_button 'Disable' diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 90dde7340d5..2d541a34f62 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'Admin Groups' do end end - describe 'create a group' do + describe 'create a group', :js do describe 'with expected fields' do it 'renders from as expected', :aggregate_failures do visit new_admin_group_path @@ -60,8 +60,7 @@ RSpec.describe 'Admin Groups' do expect(page).to have_current_path admin_group_path(Group.find_by(path: path_component)), ignore_query: true content = page.find('#content-body') - h3_texts = content.all('h3').collect(&:text).join("\n") - expect(h3_texts).to match group_name + expect(page).to have_content group_name li_texts = content.all('li').collect(&:text).join("\n") expect(li_texts).to match group_name expect(li_texts).to match path_component @@ -76,7 +75,7 @@ RSpec.describe 'Admin Groups' do expect_selected_visibility(internal) end - it 'when entered in group name, it auto filled the group path', :js do + it 'when entered in group name, it auto filled the group path' do visit admin_groups_path click_link "New group" group_name = 'gitlab' @@ -85,7 +84,7 @@ RSpec.describe 'Admin Groups' do expect(path_field.value).to eq group_name end - it 'auto populates the group path with the group name', :js do + it 'auto populates the group path with the group name' do visit admin_groups_path click_link "New group" group_name = 'my gitlab project' @@ -94,7 +93,7 @@ RSpec.describe 'Admin Groups' do expect(path_field.value).to eq 'my-gitlab-project' end - it 'when entering in group path, group name does not change anymore', :js do + it 'when entering in group path, group name does not change anymore' do visit admin_groups_path click_link "New group" group_path = 'my-gitlab-project' diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index fd51fd71fea..6caf2b24555 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -41,4 +41,18 @@ RSpec.describe 'Admin::HookLogs' do expect(page).to have_current_path(edit_admin_hook_path(system_hook), ignore_query: true) end + + context 'response data is too large' do + let(:hook_log) { create(:web_hook_log, web_hook: system_hook, request_data: WebHookLog::OVERSIZE_REQUEST_DATA) } + + it 'shows request data as too large and disables retry function' do + visit(admin_hook_hook_log_path(system_hook, hook_log)) + + expect(page).to have_content('Request data is too large') + expect(page).not_to have_button( + _('Resent request'), + disabled: true, class: 'has-tooltip', title: _("Request data is too large") + ) + end + end end diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 388ab02d8e8..901315752d6 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Admin::Hooks' do + include Spec::Support::Helpers::ModalHelpers + let(:user) { create(:admin) } before do @@ -79,7 +81,6 @@ 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 @@ -87,7 +88,7 @@ RSpec.describe 'Admin::Hooks' do it 'from hooks list page' do visit admin_hooks_path - accept_confirm { click_link 'Delete' } + accept_gl_confirm(button_text: 'Delete webhook') { click_link 'Delete' } expect(page).not_to have_content(hook_url) end @@ -95,7 +96,7 @@ RSpec.describe 'Admin::Hooks' do visit admin_hooks_path click_link 'Edit' - accept_confirm { click_link 'Delete' } + accept_gl_confirm(button_text: 'Delete webhook') { click_link 'Delete' } expect(page).not_to have_content(hook_url) end end diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index ba0870a53ae..fa5c94aa66e 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -16,7 +16,6 @@ RSpec.describe 'admin issues labels' do describe 'list' do before do - stub_feature_flags(bootstrap_confirmation_modals: false) visit admin_labels_path end @@ -38,11 +37,9 @@ RSpec.describe 'admin issues labels' do end it 'deletes all labels', :js do - page.within '.labels' do - page.all('.js-remove-label').each do |remove| - accept_confirm { remove.click } - wait_for_requests - end + page.all('.labels .js-remove-label').each do |remove| + accept_gl_confirm(button_text: 'Delete label') { remove.click } + wait_for_requests end wait_for_requests diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index e1a1e2bbb2d..d312965f6cf 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -115,13 +115,17 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content("runner-bar") end - it 'shows no runner when description does not match' do - input_filtered_search_keys('runner-baz') + context 'when description does not match' do + before do + input_filtered_search_keys('runner-baz') + end - expect(page).to have_link('All 0') - expect(page).to have_link('Instance 0') + it_behaves_like 'shows no runners found' - expect(page).to have_text 'No runners found' + it 'shows no runner' do + expect(page).to have_link('All 0') + expect(page).to have_link('Instance 0') + end end end @@ -190,14 +194,6 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-never-contacted' end - it 'shows no runner when status does not match' do - input_filtered_search_filter_is_only('Status', 'Stale') - - expect(page).to have_link('All 0') - - expect(page).to have_text 'No runners found' - end - it 'shows correct runner when status is selected and search term is entered' do input_filtered_search_filter_is_only('Status', 'Online') input_filtered_search_keys('runner-1') @@ -225,6 +221,18 @@ RSpec.describe "Admin Runners" do expect(page).to have_selector '.badge', text: 'never contacted' end end + + context 'when status does not match' do + before do + input_filtered_search_filter_is_only('Status', 'Stale') + end + + it_behaves_like 'shows no runners found' + + it 'shows no runner' do + expect(page).to have_link('All 0') + end + end end describe 'filter by type' do @@ -273,21 +281,6 @@ RSpec.describe "Admin Runners" do end end - it 'shows no runner when type does not match' do - visit admin_runners_path - - 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' - - expect(page).to have_text 'No runners found' - end - it 'shows correct runner when type is selected and search term is entered' do create(:ci_runner, :project, description: 'runner-2-project', projects: [project]) @@ -327,6 +320,24 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-group' expect(page).not_to have_content 'runner-paused-project' end + + context 'when type does not match' do + before do + visit admin_runners_path + page.within('[data-testid="runner-type-tabs"]') do + click_on 'Instance' + + expect(page).to have_link('Instance', class: 'active') + end + end + + it_behaves_like 'shows no runners found' + + it 'shows no runner' do + expect(page).not_to have_content 'runner-project' + expect(page).not_to have_content 'runner-group' + end + end end describe 'filter by tag' do @@ -358,15 +369,6 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-red' end - it 'shows no runner when tag does not match' do - visit admin_runners_path - - input_filtered_search_filter_is_only('Tags', 'green') - - expect(page).not_to have_content 'runner-blue' - expect(page).to have_text 'No runners found' - end - it 'shows correct runner when tag is selected and search term is entered' do create(:ci_runner, :instance, description: 'runner-2-blue', tag_list: ['blue']) @@ -384,6 +386,19 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-blue' expect(page).not_to have_content 'runner-red' end + + context 'when tag does not match' do + before do + visit admin_runners_path + input_filtered_search_filter_is_only('Tags', 'green') + end + + it_behaves_like 'shows no runners found' + + it 'shows no runner' do + expect(page).not_to have_content 'runner-blue' + end + end end it 'sorts by last contact date' do @@ -419,7 +434,7 @@ RSpec.describe "Admin Runners" do visit admin_runners_path end - it_behaves_like "shows no runners" + it_behaves_like 'shows no runners registered' it 'shows tabs with total counts equal to 0' do expect(page).to have_link('All 0') diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 79b3f049047..8843e13026b 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -61,7 +61,7 @@ RSpec.describe 'Admin updates settings' do expect(current_settings.import_sources).to be_empty page.within('.as-visibility-access') do - check "Repo by URL" + check "Repository by URL" click_button 'Save changes' end @@ -280,6 +280,18 @@ RSpec.describe 'Admin updates settings' do expect(current_settings.gitpod_enabled).to be(true) end end + + context 'GitLab for Jira App settings' do + it 'changes the setting' do + page.within('#js-jira_connect-settings') do + fill_in 'Jira Connect Application ID', with: '1234' + click_button 'Save changes' + end + + expect(current_settings.jira_connect_application_key).to eq('1234') + expect(page).to have_content "Application settings saved successfully" + end + end end context 'Integrations page' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 15bc2318022..7e57cffc791 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Admin > Users > Impersonation Tokens', :js do + include Spec::Support::Helpers::ModalHelpers + let(:admin) { create(:admin) } let!(:user) { create(:user) } @@ -74,10 +76,9 @@ 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" } + accept_gl_confirm(button_text: 'Revoke') { click_on "Revoke" } expect(page).to have_selector(".settings-message") expect(no_personal_access_tokens_message).to have_text("This user has no active impersonation tokens.") diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index 4e6aae7c46f..2dffef93600 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -4,11 +4,11 @@ require 'spec_helper' RSpec.describe 'Admin uses repository checks', :request_store do include StubENV + include Spec::Support::Helpers::ModalHelpers let(:admin) { create(:admin) } before do - stub_feature_flags(bootstrap_confirmation_modals: false) stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) end @@ -57,7 +57,9 @@ RSpec.describe 'Admin uses repository checks', :request_store do expect(RepositoryCheck::ClearWorker).to receive(:perform_async) - accept_confirm { find(:link, 'Clear all repository checks').send_keys(:return) } + accept_gl_confirm(button_text: 'Clear repository checks') do + find(:link, 'Clear all repository checks').send_keys(:return) + end expect(page).to have_content('Started asynchronous removal of all repository check states.') end diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index 7e8dee9cc0b..18bb03f4617 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -10,7 +10,6 @@ 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 @@ -354,7 +353,7 @@ RSpec.describe 'Admin::Users::User' do expect(page).to have_content("Secondary email: #{secondary_email.email}") - accept_confirm { find("#remove_email_#{secondary_email.id}").click } + accept_gl_confirm { find("#remove_email_#{secondary_email.id}").click } expect(page).not_to have_content(secondary_email.email) end diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index a05e1531949..e5df6cc0fd3 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -10,7 +10,6 @@ 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 @@ -492,9 +491,7 @@ RSpec.describe 'Admin::Users' do within(:css, '.gl-mb-3 + .card') do click_link group.name end - within(:css, 'h3.page-title') do - expect(page).to have_content "Group: #{group.name}" - end + expect(page).to have_content "Group: #{group.name}" expect(page).to have_content project.name end @@ -506,8 +503,11 @@ RSpec.describe 'Admin::Users' do it 'allows group membership to be revoked', :js do page.within(first('.group_member')) do - accept_confirm { find('.btn[data-testid="remove-user"]').click } + find('.btn[data-testid="remove-user"]').click end + + accept_gl_confirm(button_text: 'Remove') + wait_for_requests expect(page).not_to have_selector('.group_member') |