Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-25 06:11:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-25 06:11:36 +0300
commita85b67d51ad8895284babce73736437f9f41304b (patch)
tree2c10b0b635edac30f03aa6bd5cafba7750984c82 /spec/features/admin
parente4d18499293fbc9510a87611acb7d9787a581b78 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/admin_hooks_spec.rb6
-rw-r--r--spec/features/admin/admin_mode/logout_spec.rb15
-rw-r--r--spec/features/admin/admin_mode/workers_spec.rb6
-rw-r--r--spec/features/admin/admin_mode_spec.rb47
-rw-r--r--spec/features/admin/admin_sees_background_migrations_spec.rb16
-rw-r--r--spec/features/admin/admin_settings_spec.rb14
-rw-r--r--spec/features/admin/users/user_spec.rb22
7 files changed, 54 insertions, 72 deletions
diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb
index a5acba1fe4a..2aec5baf351 100644
--- a/spec/features/admin/admin_hooks_spec.rb
+++ b/spec/features/admin/admin_hooks_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Admin::Hooks', feature_category: :webhooks do
include Spec::Support::Helpers::ModalHelpers
- let_it_be(:user) { create(:admin, :no_super_sidebar) }
+ let_it_be(:user) { create(:admin) }
before do
sign_in(user)
@@ -13,10 +13,10 @@ RSpec.describe 'Admin::Hooks', feature_category: :webhooks do
end
describe 'GET /admin/hooks' do
- it 'is ok' do
+ it 'is ok', :js do
visit admin_root_path
- page.within '.nav-sidebar' do
+ within_testid('super-sidebar') do
click_on 'System Hooks', match: :first
end
diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb
index 5d9106fea02..7a33256e7a8 100644
--- a/spec/features/admin/admin_mode/logout_spec.rb
+++ b/spec/features/admin/admin_mode/logout_spec.rb
@@ -5,9 +5,8 @@ require 'spec_helper'
RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do
include TermsHelper
include UserLoginHelper
- include Features::TopNavSpecHelpers
- let(:user) { create(:admin, :no_super_sidebar) }
+ let(:user) { create(:admin) }
before do
# TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See
@@ -22,11 +21,9 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do
expect(page).to have_current_path root_path, ignore_query: true
- open_top_nav
+ click_button 'Search or go to…'
- within_top_nav do
- expect(page).to have_link(href: new_admin_session_path)
- end
+ expect(page).to have_link(href: new_admin_session_path)
end
it 'disable shows flash notice' do
@@ -45,11 +42,9 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do
expect(page).to have_current_path root_path, ignore_query: true
- open_top_nav
+ click_button 'Search or go to…'
- within_top_nav do
- expect(page).to have_link(href: new_admin_session_path)
- end
+ expect(page).to have_link(href: new_admin_session_path)
end
end
end
diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb
index 2a862c750d7..124c43eef9d 100644
--- a/spec/features/admin/admin_mode/workers_spec.rb
+++ b/spec/features/admin/admin_mode/workers_spec.rb
@@ -6,8 +6,8 @@ require 'spec_helper'
RSpec.describe 'Admin mode for workers', :request_store, feature_category: :system_access do
include Features::AdminUsersHelpers
- let(:user) { create(:user, :no_super_sidebar) }
- let(:user_to_delete) { create(:user, :no_super_sidebar) }
+ let(:user) { create(:user) }
+ let(:user_to_delete) { create(:user) }
before do
sign_in(user)
@@ -22,7 +22,7 @@ RSpec.describe 'Admin mode for workers', :request_store, feature_category: :syst
end
context 'as an admin user' do
- let(:user) { create(:admin, :no_super_sidebar) }
+ let(:user) { create(:admin) }
context 'when admin mode disabled' do
it 'cannot delete user', :js do
diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb
index edfa58567ad..b1b44ce143f 100644
--- a/spec/features/admin/admin_mode_spec.rb
+++ b/spec/features/admin/admin_mode_spec.rb
@@ -4,10 +4,9 @@ require 'spec_helper'
RSpec.describe 'Admin mode', :js, feature_category: :shared do
include MobileHelpers
- include Features::TopNavSpecHelpers
include StubENV
- let(:admin) { create(:admin, :no_super_sidebar) }
+ let(:admin) { create(:admin) }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
@@ -21,20 +20,16 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do
context 'when not in admin mode' do
it 'has no leave admin mode button' do
visit new_admin_session_path
- open_top_nav
+ open_search_modal
- page.within('.navbar-sub-nav') do
- expect(page).not_to have_link(href: destroy_admin_session_path)
- end
+ expect(page).not_to have_link(href: destroy_admin_session_path)
end
it 'can open pages not in admin scope' do
visit new_admin_session_path
- open_top_nav_projects
+ open_search_modal
- within_top_nav do
- click_link('View all projects')
- end
+ click_link('View all my projects')
expect(page).to have_current_path(dashboard_projects_path)
end
@@ -78,29 +73,23 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do
end
it 'contains link to leave admin mode' do
- open_top_nav
+ open_search_modal
- within_top_nav do
- expect(page).to have_link(href: destroy_admin_session_path)
- end
+ expect(page).to have_link(href: destroy_admin_session_path)
end
it 'can leave admin mode using main dashboard link' do
gitlab_disable_admin_mode
- open_top_nav
+ open_search_modal
- within_top_nav do
- expect(page).to have_link(href: new_admin_session_path)
- end
+ expect(page).to have_link(href: new_admin_session_path)
end
it 'can open pages not in admin scope' do
- open_top_nav_projects
+ open_search_modal
- within_top_nav do
- click_link('View all projects')
- end
+ click_link('View all my projects')
expect(page).to have_current_path(dashboard_projects_path)
end
@@ -108,7 +97,7 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do
context 'nav bar' do
it 'shows admin dashboard links on bigger screen' do
visit root_dashboard_path
- open_top_nav
+ open_search_modal
expect(page).to have_link(text: 'Admin', href: admin_root_path, visible: true)
expect(page).to have_link(text: 'Leave admin mode', href: destroy_admin_session_path, visible: true)
@@ -123,11 +112,9 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do
it 'can leave admin mode' do
gitlab_disable_admin_mode
- open_top_nav
+ open_search_modal
- within_top_nav do
- expect(page).to have_link(href: new_admin_session_path)
- end
+ expect(page).to have_link(href: new_admin_session_path)
end
end
end
@@ -141,10 +128,14 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do
it 'shows no admin mode buttons in navbar' do
visit admin_root_path
- open_top_nav
+ open_search_modal
expect(page).not_to have_link(href: new_admin_session_path)
expect(page).not_to have_link(href: destroy_admin_session_path)
end
end
+
+ def open_search_modal
+ click_button 'Search or go to…'
+ end
end
diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb
index 7423e74bf3a..ae307b8038c 100644
--- a/spec/features/admin/admin_sees_background_migrations_spec.rb
+++ b/spec/features/admin/admin_sees_background_migrations_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe "Admin > Admin sees background migrations", feature_category: :database do
include ListboxHelpers
- let_it_be(:admin) { create(:admin, :no_super_sidebar) }
+ let_it_be(:admin) { create(:admin) }
let(:job_class) { Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJob }
let_it_be(:active_migration) { create(:batched_background_migration, :active, table_name: 'active') }
@@ -21,16 +21,18 @@ RSpec.describe "Admin > Admin sees background migrations", feature_category: :da
gitlab_enable_admin_mode_sign_in(admin)
end
- it 'can navigate to background migrations' do
+ it 'can navigate to background migrations', :js do
visit admin_root_path
- within '.nav-sidebar' do
- link = find_link 'Background Migrations'
+ within_testid('super-sidebar') do
+ click_on 'Monitoring'
+ click_on 'Background Migrations'
+ end
- link.click
+ expect(page).to have_current_path(admin_background_migrations_path)
- expect(page).to have_current_path(admin_background_migrations_path)
- expect(link).to have_ancestor(:css, 'li.active')
+ within_testid('super-sidebar') do
+ expect(page).to have_css('a[aria-current="page"]', text: 'Background Migrations')
end
end
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index aae41cab21f..dbdc0a03404 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
include TermsHelper
include UsageDataHelpers
- let_it_be(:admin) { create(:admin, :no_super_sidebar) }
+ let_it_be(:admin) { create(:admin) }
context 'application setting :admin_mode is enabled', :request_store do
before do
@@ -990,15 +990,14 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
end
end
- context 'Nav bar' do
+ context 'Nav bar', :js do
it 'shows default help links in nav' do
default_support_url = "https://#{ApplicationHelper.promo_host}/get-help/"
visit root_dashboard_path
- find('.header-help-dropdown-toggle').click
-
- page.within '.header-help' do
+ within_testid('super-sidebar') do
+ click_on 'Help'
expect(page).to have_link(text: 'Help', href: help_path)
expect(page).to have_link(text: 'Support', href: default_support_url)
end
@@ -1010,9 +1009,8 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do
visit root_dashboard_path
- find('.header-help-dropdown-toggle').click
-
- page.within '.header-help' do
+ within_testid('super-sidebar') do
+ click_on 'Help'
expect(page).to have_link(text: 'Support', href: new_support_url)
end
end
diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb
index 7dc329e6909..fbf11063f7c 100644
--- a/spec/features/admin/users/user_spec.rb
+++ b/spec/features/admin/users/user_spec.rb
@@ -6,8 +6,8 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
include Features::AdminUsersHelpers
include Spec::Support::Helpers::ModalHelpers
- let_it_be(:user) { create(:omniauth_user, :no_super_sidebar, provider: 'twitter', extern_uid: '123456') }
- let_it_be(:current_user) { create(:admin, :no_super_sidebar) }
+ let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') }
+ let_it_be(:current_user) { create(:admin) }
before do
sign_in(current_user)
@@ -145,7 +145,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
end
describe 'Impersonation' do
- let_it_be(:another_user) { create(:user, :no_super_sidebar) }
+ let_it_be(:another_user) { create(:user) }
context 'before impersonating' do
subject { visit admin_user_path(user_to_visit) }
@@ -257,15 +257,13 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
visit admin_user_path(another_user)
end
- it 'logs in as the user when impersonate is clicked' do
+ it 'logs in as the user when impersonate is clicked', :js do
subject
- find('[data-testid="user-dropdown"]').click
-
- expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eql(another_user.username)
+ expect(page).to have_button("#{another_user.name} user’s menu")
end
- it 'sees impersonation log out icon' do
+ it 'sees impersonation log out icon', :js do
subject
icon = first('[data-testid="incognito-icon"]')
@@ -306,8 +304,8 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
end
end
- context 'ending impersonation' do
- subject { find(:css, 'li.impersonation a').click }
+ context 'ending impersonation', :js do
+ subject { click_on 'Stop impersonating' }
before do
visit admin_user_path(another_user)
@@ -317,9 +315,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do
it 'logs out of impersonated user back to original user' do
subject
- find('[data-testid="user-dropdown"]').click
-
- expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eq(current_user.username)
+ expect(page).to have_button("#{current_user.name} user’s menu")
end
it 'is redirected back to the impersonated users page in the admin after stopping' do