diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/features/admin | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_builds_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/admin_dev_ops_report_spec.rb | 70 | ||||
-rw-r--r-- | spec/features/admin/admin_groups_spec.rb | 5 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 30 | ||||
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 68 | ||||
-rw-r--r-- | spec/features/admin/admin_uses_repository_checks_spec.rb | 2 |
6 files changed, 102 insertions, 79 deletions
diff --git a/spec/features/admin/admin_builds_spec.rb b/spec/features/admin/admin_builds_spec.rb index 85f0c44ed9c..166fde0f37a 100644 --- a/spec/features/admin/admin_builds_spec.rb +++ b/spec/features/admin/admin_builds_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin Builds' do context 'All tab' do context 'when have jobs' do - it 'shows all jobs' do + it 'shows all jobs', :js do create(:ci_build, pipeline: pipeline, status: :pending) create(:ci_build, pipeline: pipeline, status: :running) create(:ci_build, pipeline: pipeline, status: :success) @@ -24,6 +24,10 @@ RSpec.describe 'Admin Builds' do expect(page).to have_selector('.row-content-block', text: 'All jobs') expect(page.all('.build-link').size).to eq(4) expect(page).to have_button 'Stop all jobs' + + click_button 'Stop all jobs' + expect(page).to have_button 'Stop jobs' + expect(page).to have_content 'Stop all jobs?' end end diff --git a/spec/features/admin/admin_dev_ops_report_spec.rb b/spec/features/admin/admin_dev_ops_report_spec.rb index c201011cbea..3b2c9d75870 100644 --- a/spec/features/admin/admin_dev_ops_report_spec.rb +++ b/spec/features/admin/admin_dev_ops_report_spec.rb @@ -2,59 +2,65 @@ require 'spec_helper' -RSpec.describe 'DevOps Report page' do +RSpec.describe 'DevOps Report page', :js do before do sign_in(create(:admin)) end - it 'has dismissable intro callout', :js do - visit admin_dev_ops_report_path + context 'with devops_adoption feature flag disabled' do + before do + stub_feature_flags(devops_adoption: false) + end - expect(page).to have_content 'Introducing Your DevOps Report' + it 'has dismissable intro callout' do + visit admin_dev_ops_report_path - find('.js-close-callout').click + expect(page).to have_content 'Introducing Your DevOps Report' - expect(page).not_to have_content 'Introducing Your DevOps Report' - end + find('.js-close-callout').click - context 'when usage ping is disabled' do - before do - stub_application_setting(usage_ping_enabled: false) + expect(page).not_to have_content 'Introducing Your DevOps Report' end - it 'shows empty state', :js do - visit admin_dev_ops_report_path + context 'when usage ping is disabled' do + before do + stub_application_setting(usage_ping_enabled: false) + end - expect(page).to have_selector(".js-empty-state") - end + it 'shows empty state' do + visit admin_dev_ops_report_path - it 'hides the intro callout' do - visit admin_dev_ops_report_path + expect(page).to have_selector(".js-empty-state") + end - expect(page).not_to have_content 'Introducing Your DevOps Report' + it 'hides the intro callout' do + visit admin_dev_ops_report_path + + expect(page).not_to have_content 'Introducing Your DevOps Report' + end end - end - context 'when there is no data to display' do - it 'shows empty state' do - stub_application_setting(usage_ping_enabled: true) + context 'when there is no data to display' do + it 'shows empty state' do + stub_application_setting(usage_ping_enabled: true) - visit admin_dev_ops_report_path + visit admin_dev_ops_report_path - expect(page).to have_content('Data is still calculating') + expect(page).to have_content('Data is still calculating') + end end - end - context 'when there is data to display' do - it 'shows numbers for each metric' do - stub_application_setting(usage_ping_enabled: true) - create(:dev_ops_report_metric) + context 'when there is data to display' do + it 'shows numbers for each metric' do + stub_application_setting(usage_ping_enabled: true) + create(:dev_ops_report_metric) - visit admin_dev_ops_report_path + visit admin_dev_ops_report_path - expect(page).to have_content( - 'Issues created per active user 1.2 You 9.3 Lead 13.3%' - ) + expect(page).to have_content( + 'Issues created per active user 1.2 You 9.3 Lead 13.3%' + ) + end end end end diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 653a45a4bb8..96709cf8a12 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'Admin Groups' do include Select2Helper + include Spec::Support::Helpers::Features::MembersHelpers let(:internal) { Gitlab::VisibilityLevel::INTERNAL } let(:user) { create :user } @@ -11,8 +12,6 @@ RSpec.describe 'Admin Groups' do let!(:current_user) { create(:admin) } before do - stub_feature_flags(vue_group_members_list: false) - sign_in(current_user) stub_application_setting(default_group_visibility: internal) end @@ -176,7 +175,7 @@ RSpec.describe 'Admin Groups' do click_button 'Invite' - page.within '[data-qa-selector="members_list"]' do + page.within members_table do expect(page).to have_content(current_user.name) expect(page).to have_content('Developer') end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 528dfad606e..8929abc7edc 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -132,32 +132,14 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n context 'Change Sign-up restrictions' do context 'Require Admin approval for new signup setting' do - context 'when feature is enabled' do - before do - stub_feature_flags(admin_approval_for_new_user_signups: true) - end - - it 'changes the setting' do - page.within('.as-signup') do - check 'Require admin approval for new sign-ups' - click_button 'Save changes' - end - - expect(current_settings.require_admin_approval_after_user_signup).to be_truthy - expect(page).to have_content "Application settings saved successfully" - end - end - - context 'when feature is disabled' do - before do - stub_feature_flags(admin_approval_for_new_user_signups: false) + it 'changes the setting' do + page.within('.as-signup') do + check 'Require admin approval for new sign-ups' + click_button 'Save changes' end - it 'does not show the the setting' do - page.within('.as-signup') do - expect(page).not_to have_selector('.application_setting_require_admin_approval_after_user_signup') - end - end + expect(current_settings.require_admin_approval_after_user_signup).to be_truthy + expect(page).to have_content "Application settings saved successfully" end end end diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index e06e2d14f3c..97a30143a59 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -75,26 +75,12 @@ RSpec.describe "Admin::Users" do end context '`Pending approval` tab' do - context 'feature is enabled' do - before do - stub_feature_flags(admin_approval_for_new_user_signups: true) - visit admin_users_path - end - - it 'shows the `Pending approval` tab' do - expect(page).to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval')) - end + before do + visit admin_users_path end - context 'feature is disabled' do - before do - stub_feature_flags(admin_approval_for_new_user_signups: false) - visit admin_users_path - end - - it 'does not show the `Pending approval` tab' do - expect(page).not_to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval')) - end + it 'shows the `Pending approval` tab' do + expect(page).to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval')) end end end @@ -218,6 +204,32 @@ RSpec.describe "Admin::Users" do expect(page).to have_content(user.email) end end + + context 'when blocking a user' do + it 'shows confirmation and allows blocking', :js do + expect(page).to have_content(user.email) + + find("[data-testid='user-action-button-#{user.id}']").click + + within find("[data-testid='user-action-dropdown-#{user.id}']") do + find('li button', text: 'Block').click + end + + wait_for_requests + + expect(page).to have_content('Block user') + expect(page).to have_content('Blocking user has the following effects') + expect(page).to have_content('User will not be able to login') + expect(page).to have_content('Owned groups will be left') + + find('.modal-footer button', text: 'Block').click + + wait_for_requests + + expect(page).to have_content('Successfully blocked') + expect(page).not_to have_content(user.email) + end + end end describe "GET /admin/users/new" do @@ -376,6 +388,26 @@ RSpec.describe "Admin::Users" do end end + context 'when blocking the user' do + it 'shows confirmation and allows blocking', :js do + visit admin_user_path(user) + + find('button', text: 'Block user').click + + wait_for_requests + + expect(page).to have_content('Block user') + expect(page).to have_content('You can always unblock their account, their data will remain intact.') + + find('.modal-footer button', text: 'Block').click + + wait_for_requests + + expect(page).to have_content('Successfully blocked') + expect(page).to have_content('This user is blocked') + end + end + describe 'Impersonation' do let(:another_user) { create(:user) } diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index 44642983a36..0fb5124f673 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -46,7 +46,7 @@ RSpec.describe 'Admin uses repository checks', :request_store, :clean_gitlab_red ) visit_admin_project_page(project) - page.within('.gl-alert') do + page.within('[data-testid="last-repository-check-failed-alert"]') do expect(page.text).to match(/Last repository check \(just now\) failed/) end end |