diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/features/admin | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_broadcast_messages_spec.rb | 98 | ||||
-rw-r--r-- | spec/features/admin/admin_groups_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/admin/admin_projects_spec.rb | 7 | ||||
-rw-r--r-- | spec/features/admin/admin_sees_background_migrations_spec.rb | 31 | ||||
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/dashboard_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/admin/users/users_spec.rb | 6 |
7 files changed, 35 insertions, 134 deletions
diff --git a/spec/features/admin/admin_broadcast_messages_spec.rb b/spec/features/admin/admin_broadcast_messages_spec.rb deleted file mode 100644 index a6bbdd70fc3..00000000000 --- a/spec/features/admin/admin_broadcast_messages_spec.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Admin Broadcast Messages', feature_category: :onboarding do - before do - admin = create(:admin) - sign_in(admin) - stub_feature_flags(vue_broadcast_messages: false) - gitlab_enable_admin_mode_sign_in(admin) - create( - :broadcast_message, - :expired, - message: 'Migration to new server', - target_access_levels: [Gitlab::Access::DEVELOPER] - ) - visit admin_broadcast_messages_path - end - - it 'see broadcast messages list' do - expect(page).to have_content 'Migration to new server' - end - - it 'creates a customized broadcast banner message' do - fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**' - fill_in 'broadcast_message_target_path', with: '*/user_onboarded' - select 'light-indigo', from: 'broadcast_message_theme' - select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i' - check 'Guest' - check 'Owner' - click_button 'Add broadcast message' - - expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true - expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' - expect(page).to have_content 'Guest, Owner' - expect(page).to have_content '*/user_onboarded' - expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST' - expect(page).to have_selector %(.light-indigo[role=alert]) - end - - it 'creates a customized broadcast notification message' do - fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**' - fill_in 'broadcast_message_target_path', with: '*/user_onboarded' - select 'Notification', from: 'broadcast_message_broadcast_type' - select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i' - check 'Reporter' - check 'Developer' - check 'Maintainer' - click_button 'Add broadcast message' - - expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true - expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' - expect(page).to have_content 'Reporter, Developer, Maintainer' - expect(page).to have_content '*/user_onboarded' - expect(page).to have_content 'Notification' - expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST' - end - - it 'edit an existing broadcast message' do - click_link 'Edit' - fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW' - check 'Reporter' - click_button 'Update broadcast message' - - expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true - expect(page).to have_content 'Application update RIGHT NOW' - - page.within('.table-responsive') do - expect(page).to have_content 'Reporter, Developer' - end - end - - it 'remove an existing broadcast message' do - click_link 'Remove' - - expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true - expect(page).not_to have_content 'Migration to new server' - end - - it 'updates a preview of a customized broadcast banner message', :js do - fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:" - - page.within('.js-broadcast-banner-message-preview') do - expect(page).to have_selector('strong', text: 'Markdown') - expect(page).to have_emoji('tada') - end - end - - it 'updates a preview of a customized broadcast notification message', :js do - fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:" - select 'Notification', from: 'broadcast_message_broadcast_type' - - page.within('#broadcast-message-preview') do - expect(page).to have_selector('strong', text: 'Markdown') - expect(page).to have_emoji('tada') - end - end -end diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index c36a742af6b..119e09f9b09 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -204,6 +204,17 @@ RSpec.describe 'Admin Groups', feature_category: :subgroups do expect(page).to have_content(new_admin_note_text) end + + it 'hides removed note' do + group = create(:group, :private) + group.create_admin_note(note: 'A note by an administrator') + + visit admin_group_edit_path(group) + fill_in 'group_admin_note_attributes_note', with: '' + click_button 'Save changes' + + expect(page).not_to have_content(s_('Admin|Admin notes')) + end end describe 'add user into a group', :js do @@ -258,9 +269,12 @@ RSpec.describe 'Admin Groups', feature_category: :subgroups do expect(page).to have_content('Developer') end - find_member_row(current_user).click_button(title: 'Leave') + show_actions_for_username(current_user) + click_button _('Leave group') - accept_gl_confirm(button_text: 'Leave') + within_modal do + click_button _('Leave') + end wait_for_all_requests diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 0cb813c40f4..3c7eba2cc97 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -151,12 +151,11 @@ RSpec.describe "Admin::Projects", feature_category: :projects do expect(find_member_row(current_user)).to have_content('Developer') - page.within find_member_row(current_user) do - click_button 'Leave' - end + show_actions_for_username(current_user) + click_button _('Leave group') within_modal do - click_button('Leave') + click_button _('Leave') end expect(page).to have_current_path(dashboard_projects_path, ignore_query: true, url: false) diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb index e1746dad196..4b8636da6b4 100644 --- a/spec/features/admin/admin_sees_background_migrations_spec.rb +++ b/spec/features/admin/admin_sees_background_migrations_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe "Admin > Admin sees background migrations", feature_category: :database do + include ListboxHelpers + let_it_be(:admin) { create(:admin) } let(:job_class) { Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJob } @@ -204,7 +206,7 @@ RSpec.describe "Admin > Admin sees background migrations", feature_category: :da it 'does not render the database listbox' do visit admin_background_migrations_path - expect(page).not_to have_selector('[data-testid="database-listbox"]') + expect(page).not_to have_button('main') end end @@ -215,41 +217,26 @@ RSpec.describe "Admin > Admin sees background migrations", feature_category: :da allow(Gitlab::Database).to receive(:db_config_names).and_return(%w[main ci]) end - it 'does render the database listbox' do - visit admin_background_migrations_path - - expect(page).to have_selector('[data-testid="database-listbox"]') - end - - it 'defaults to main when no parameter is passed' do + it 'renders the database listbox' do visit admin_background_migrations_path - listbox = page.find('[data-testid="database-listbox"]') - - expect(listbox).to have_text('main') + expect(page).to have_button('main') end it 'shows correct database when a parameter is passed' do visit admin_background_migrations_path(database: 'ci') - listbox = page.find('[data-testid="database-listbox"]') - - expect(listbox).to have_text('ci') + expect(page).to have_button('ci') end it 'updates the path to correct database when clicking on listbox option' do visit admin_background_migrations_path - listbox = page.find('[data-testid="database-listbox"]') - expect(listbox).to have_text('main') - - listbox.find('button').click - listbox.find('li', text: 'ci').click - wait_for_requests + click_button 'main' + select_listbox_item('ci') expect(page).to have_current_path(admin_background_migrations_path(database: 'ci')) - listbox = page.find('[data-testid="database-listbox"]') - expect(listbox).to have_text('ci') + expect(page).to have_button('ci') end end end diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 1f40f1f1bce..ca08bc9e577 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -69,13 +69,9 @@ RSpec.describe "Admin::Users", feature_category: :user_management do expect(page).not_to have_content(message) end - context 'with no license and service ping disabled' do + context 'with no license and service ping disabled', :without_license do before do stub_application_setting(usage_ping_enabled: false) - - if Gitlab.ee? - allow(License).to receive(:current).and_return(nil) - end end it 'renders registration features CTA' do diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index baca60134b9..06f9c531e74 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -49,8 +49,7 @@ RSpec.describe 'admin visits dashboard' do end expect(page).to have_content('Blocked users 7') - expect(page).to have_content('Total users 78') - expect(page).to have_content('Active users 71') + expect(page).to have_content('Total users (active users + blocked users) 78') end end diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 4b49e8f4bc6..975af84969d 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do expect(page).to have_content(current_user.email) expect(page).to have_content(current_user.name) - expect(page).to have_content(current_user.created_at.strftime('%e %b, %Y')) + expect(page).to have_content(current_user.created_at.strftime('%b %d, %Y')) expect(page).to have_content(user.email) expect(page).to have_content(user.name) expect(page).to have_content('Projects') @@ -367,6 +367,8 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do .to eq(Gitlab.config.gitlab.default_projects_limit) expect(user.can_create_group) .to eq(Gitlab::CurrentSettings.can_create_group) + expect(user.private_profile) + .to eq(Gitlab::CurrentSettings.user_defaults_to_private_profile) end it 'creates user with valid data' do @@ -564,6 +566,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do fill_in 'user_password', with: 'AValidPassword1' fill_in 'user_password_confirmation', with: 'AValidPassword1' choose 'user_access_level_admin' + check 'Private profile' click_button 'Save changes' end @@ -577,6 +580,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do expect(user.name).to eq('Big Bang') expect(user.admin?).to be_truthy expect(user.password_expires_at).to be <= Time.zone.now + expect(user.private_profile).to eq(true) end end |