diff options
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_abuse_reports_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/admin/admin_mode/login_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/admin/admin_mode/logout_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_mode_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 34 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 9 | ||||
-rw-r--r-- | spec/features/admin/users/user_spec.rb | 2 |
7 files changed, 25 insertions, 46 deletions
diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb index 973988560b3..5e98d2ffcf3 100644 --- a/spec/features/admin/admin_abuse_reports_spec.rb +++ b/spec/features/admin/admin_abuse_reports_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do + include Features::SortingHelpers + let_it_be(:user) { create(:user) } let_it_be(:admin) { create(:admin) } @@ -79,7 +81,7 @@ RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do expect(report_rows[1].text).to include(report_text(open_report2)) # updated_at asc - sort_by 'Updated date' + sort_by 'Updated date', from: 'Created date' expect(report_rows[0].text).to include(report_text(open_report2)) expect(report_rows[1].text).to include(report_text(open_report)) @@ -120,7 +122,7 @@ RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do expect(report_rows[1].text).to include(report_text(open_report2)) # created_at desc - sort_by 'Created date' + sort_by 'Created date', from: 'Number of Reports' expect(report_rows[0].text).to include(report_text(open_report2)) expect(report_rows[1].text).to include(aggregated_report_text(open_report, 2)) @@ -131,7 +133,7 @@ RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do expect(report_rows[0].text).to include(aggregated_report_text(open_report, 2)) expect(report_rows[1].text).to include(report_text(open_report2)) - sort_by 'Updated date' + sort_by 'Updated date', from: 'Created date' # updated_at asc expect(report_rows[0].text).to include(report_text(open_report2)) @@ -193,14 +195,10 @@ RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do select_tokens(*tokens, submit: true, input_text: 'Filter reports') end - def sort_by(sort) + def sort_by(sort, from: 'Number of Reports') page.within('.vue-filtered-search-bar-container .sort-dropdown-container') do - page.find('.gl-dropdown-toggle').click - - page.within('.dropdown-menu') do - click_button sort - wait_for_requests - end + pajamas_sort_by sort, from: from + wait_for_requests end end end diff --git a/spec/features/admin/admin_mode/login_spec.rb b/spec/features/admin/admin_mode/login_spec.rb index 72c7083f459..f2262464386 100644 --- a/spec/features/admin/admin_mode/login_spec.rb +++ b/spec/features/admin/admin_mode/login_spec.rb @@ -30,7 +30,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do repeated_otp = user.current_otp enter_code(repeated_otp) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) @@ -47,7 +47,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do expect(page).to have_content('Enter verification code') enter_code(user.current_otp) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) end diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index 7a33256e7a8..584151726a6 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See # this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851 sign_in(user) - gitlab_enable_admin_mode_sign_in(user) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) visit admin_root_path end diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index b1b44ce143f..2a655cdb1f4 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -69,7 +69,7 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do context 'when in admin_mode' do before do - gitlab_enable_admin_mode_sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end it 'contains link to leave admin mode' do diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 750f5f8d4b9..653458710e3 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe "Admin Runners", feature_category: :runner_fleet do +RSpec.describe "Admin Runners", feature_category: :fleet_visibility do + include Features::SortingHelpers include Features::RunnersHelpers include Spec::Support::Helpers::ModalHelpers @@ -11,8 +12,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do before do sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) - - wait_for_requests end describe "Admin Runners page", :js do @@ -21,7 +20,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do let_it_be(:namespace) { create(:namespace) } let_it_be(:project) { create(:project, namespace: namespace, creator: user) } - describe "runners creation" do + describe "runners creation and registration" do before do visit admin_runners_path end @@ -29,12 +28,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do it 'shows a create button' do expect(page).to have_link s_('Runner|New instance runner'), href: new_admin_runner_path end - end - - describe "runners registration" do - before do - visit admin_runners_path - end it_behaves_like "shows and resets runner registration token" do let(:dropdown_text) { s_('Runners|Register an instance runner') } @@ -50,11 +43,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do visit admin_runners_path end - it_behaves_like 'shows runner in list' do - let(:runner) { instance_runner } - end - - it_behaves_like 'shows runner details from list' do + it_behaves_like 'shows runner summary and navigates to details' do let(:runner) { instance_runner } let(:runner_page_path) { admin_runner_path(instance_runner) } end @@ -404,11 +393,8 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do it_behaves_like 'shows no runners found' - it 'shows active tab with no runner' do + it 'shows active tab' do expect(page).to have_link('Instance', class: 'active') - - expect(page).not_to have_content 'runner-project' - expect(page).not_to have_content 'runner-group' end end end @@ -443,10 +429,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end it_behaves_like 'shows no runners found' - - it 'shows no runner' do - expect(page).not_to have_content 'runner-blue' - end end it 'shows correct runner when tag is selected and search term is entered' do @@ -480,8 +462,7 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do end end - click_on 'Created date' # Open "sort by" dropdown - click_on 'Last contact' + pajamas_sort_by 'Last contact', from: 'Created date' click_on 'Sort direction: Descending' within_testid('runner-list') do @@ -602,8 +583,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do before do visit edit_admin_runner_path(project_runner) - - wait_for_requests end it_behaves_like 'submits edit runner form' do @@ -633,7 +612,6 @@ RSpec.describe "Admin Runners", feature_category: :runner_fleet do context 'when a runner is updated', :js do before do click_on _('Save changes') - wait_for_requests end it 'show success alert and redirects to runner page' do diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 4e0198b1f2b..77707a67d58 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'General page' do @@ -261,7 +261,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do expect(page).to have_content "Application settings saved successfully" end - it 'terms of Service' do + it 'terms of Service', :js do # Already have the admin accept terms, so they don't need to accept in this spec. _existing_terms = create(:term) accept_terms(admin) @@ -274,7 +274,10 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do expect(current_settings.enforce_terms).to be(true) expect(current_settings.terms).to eq 'Be nice!' - expect(page).to have_content 'Application settings saved successfully' + + click_button 'Accept terms' + + expect(page).to have_current_path(general_admin_application_settings_path, ignore_query: true) end it 'modify oauth providers' do diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index b8dc725c17f..d0110b3e013 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do before do sign_in(current_user) - gitlab_enable_admin_mode_sign_in(current_user) + gitlab_enable_admin_mode_sign_in(current_user, use_mock_admin_mode: false) end describe 'GET /admin/users/:id' do |