diff options
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 32 | ||||
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 22 | ||||
-rw-r--r-- | spec/features/admin/admin_uses_repository_checks_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/clusters/eks_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/dashboard_spec.rb | 6 |
5 files changed, 56 insertions, 8 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 38f0b813183..e1df1c69351 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -130,6 +130,38 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n expect(user_internal_regex['placeholder']).to eq 'Regex pattern' end + 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) + 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 + end + end + end + it 'Change Sign-in restrictions' do page.within('.as-signin') do fill_in 'Home page URL', with: 'https://about.gitlab.com/' diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index a37210d2acc..8b7750ab4ec 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -31,6 +31,7 @@ RSpec.describe "Admin::Users" do expect(page).to have_content(current_user.last_activity_on.strftime("%e %b, %Y")) expect(page).to have_content(user.email) expect(page).to have_content(user.name) + expect(page).to have_content('Projects') expect(page).to have_button('Block') expect(page).to have_button('Deactivate') expect(page).to have_button('Delete user') @@ -48,6 +49,19 @@ RSpec.describe "Admin::Users" do end end + context 'user project count' do + before do + project = create(:project) + project.add_maintainer(current_user) + end + + it 'displays count of users projects' do + visit admin_users_path + + expect(page.find("[data-testid='user-project-count-#{current_user.id}']").text).to eq("1") + end + end + describe 'search and sort' do before do create(:user, name: 'Foo Bar', last_activity_on: 3.days.ago) @@ -606,7 +620,7 @@ RSpec.describe "Admin::Users" do end end - describe 'show user keys' do + describe 'show user keys', :js do let!(:key1) do create(:key, user: user, title: "ssh-rsa Key1", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4FIEBXGi4bPU8kzxMefudPIJ08/gNprdNTaO9BR/ndy3+58s2HCTw2xCHcsuBmq+TsAqgEidVq4skpqoTMB+Uot5Uzp9z4764rc48dZiI661izoREoKnuRQSsRqUTHg5wrLzwxlQbl1MVfRWQpqiz/5KjBC7yLEb9AbusjnWBk8wvC1bQPQ1uLAauEA7d836tgaIsym9BrLsMVnR4P1boWD3Xp1B1T/ImJwAGHvRmP/ycIqmKdSpMdJXwxcb40efWVj0Ibbe7ii9eeoLdHACqevUZi6fwfbymdow+FeqlkPoHyGg3Cu4vD/D8+8cRc7mE/zGCWcQ15Var83Tczour Key1") end @@ -629,7 +643,11 @@ RSpec.describe "Admin::Users" do expect(page).to have_content(key2.title) expect(page).to have_content(key2.key) - click_link 'Remove' + click_button 'Delete' + + page.within('.modal') do + page.click_button('Delete') + end expect(page).not_to have_content(key2.title) end diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index b8851c28531..44642983a36 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('.alert') do + page.within('.gl-alert') do expect(page.text).to match(/Last repository check \(just now\) failed/) end end diff --git a/spec/features/admin/clusters/eks_spec.rb b/spec/features/admin/clusters/eks_spec.rb index ef49aebc7c5..ad7122bf182 100644 --- a/spec/features/admin/clusters/eks_spec.rb +++ b/spec/features/admin/clusters/eks_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Instance-level AWS EKS Cluster', :js do before do visit admin_clusters_path - click_link 'Add Kubernetes cluster' + click_link 'Integrate with a cluster certificate' end context 'when user creates a cluster on AWS EKS' do diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index 4ffa5e3be0b..acb8fb54e11 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -28,11 +28,9 @@ RSpec.describe 'admin visits dashboard' do describe 'Users statistic' do let_it_be(:users_statistics) { create(:users_statistics) } + let_it_be(:users_count_label) { Gitlab.ee? ? 'Billable users 71' : 'Active users 71' } it 'shows correct amounts of users', :aggregate_failures do - expected_active_users_text = Gitlab.ee? ? 'Active users (Billable users) 71' : 'Active users 71' - - sign_in(create(:admin)) visit admin_dashboard_stats_path expect(page).to have_content('Users without a Group and Project 23') @@ -42,9 +40,9 @@ RSpec.describe 'admin visits dashboard' do expect(page).to have_content('Users with highest role Maintainer 6') expect(page).to have_content('Users with highest role Owner 5') expect(page).to have_content('Bots 2') - expect(page).to have_content(expected_active_users_text) expect(page).to have_content('Blocked users 7') expect(page).to have_content('Total users 78') + expect(page).to have_content(users_count_label) end end end |