diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-24 18:12:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-24 18:12:41 +0300 |
commit | 40a4f37126bb1a1dd6b6f4b3c0ebb414a3e3908a (patch) | |
tree | ff6b0774cbd1ab71b69d9e9bf9fa0e0b3d1ad799 /spec/features/admin | |
parent | a19e3ec8e8545d5a6b275bab3e5ea8b0cc707449 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_jobs_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 102 |
2 files changed, 34 insertions, 70 deletions
diff --git a/spec/features/admin/admin_jobs_spec.rb b/spec/features/admin/admin_jobs_spec.rb index b125974532b..b3e21d02354 100644 --- a/spec/features/admin/admin_jobs_spec.rb +++ b/spec/features/admin/admin_jobs_spec.rb @@ -132,7 +132,7 @@ RSpec.describe 'Admin Jobs', :js, feature_category: :continuous_integration do within_testid('jobs-table') do expect(page).to have_selector('[data-testid="jobs-table-row"]', count: 1) - expect(find_by_testid('ci-badge-text')).to have_content('Failed') + expect(find_by_testid('ci-icon-text')).to have_content('Failed') end end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 1b10ea81333..aae41cab21f 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -666,28 +666,47 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do expect(find_field('Allow access to members of the following group').value).to be_nil end - it 'loads togglable usage ping payload on click', :js do - allow(Gitlab::Usage::ServicePingReport).to receive(:for).and_return({ uuid: '12345678', hostname: '127.0.0.1' }) + context 'Service usage data', :with_license do + before do + stub_usage_data_connections + stub_database_flavor_check + end - stub_usage_data_connections - stub_database_flavor_check + context 'when service data cached' do + before_all do + create(:raw_usage_data) + end - page.within('#js-usage-settings') do - expected_payload_content = /(?=.*"uuid")(?=.*"hostname")/m + it 'loads usage ping payload on click', :js do + expected_payload_content = /(?=.*"test")/m - expect(page).not_to have_content expected_payload_content + expect(page).not_to have_content expected_payload_content - click_button('Preview payload') + click_button('Preview payload') - wait_for_requests + wait_for_requests + + expect(page).to have_button 'Hide payload' + expect(page).to have_content expected_payload_content + end - expect(page).to have_selector '.js-service-ping-payload' - expect(page).to have_button 'Hide payload' - expect(page).to have_content expected_payload_content + it 'generates usage ping payload on button click', :js do + expect_next_instance_of(Admin::ApplicationSettingsController) do |instance| + expect(instance).to receive(:usage_data).and_call_original + end + + click_button('Download payload') + + wait_for_requests + end + end - click_button('Hide payload') + context 'when service data not cached' do + it 'renders missing cache information' do + visit metrics_and_profiling_admin_application_settings_path - expect(page).not_to have_content expected_payload_content + expect(page).to have_text('Service Ping payload not found in the application cache') + end end end end @@ -998,61 +1017,6 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do end end end - - context 'Service usage data page', :with_license do - before do - stub_usage_data_connections - stub_database_flavor_check - end - - context 'when service data cached', :use_clean_rails_memory_store_caching do - let(:usage_data) { { uuid: "1111", hostname: "localhost", counts: { issue: 0 } }.deep_stringify_keys } - - before do - # We are mocking Gitlab::Usage::ServicePingReport because this dataset generation - # takes a very long time, and is not what we're testing in this context. - # - # See https://gitlab.com/gitlab-org/gitlab/-/issues/414929 - allow(Gitlab::UsageData).to receive(:data).and_return(usage_data) - allow(Gitlab::Usage::ServicePingReport).to receive(:with_instrumentation_classes) - .with(usage_data, :with_value).and_return(usage_data) - - visit usage_data_admin_application_settings_path - visit service_usage_data_admin_application_settings_path - end - - it 'loads usage ping payload on click', :js do - expected_payload_content = /(?=.*"uuid")(?=.*"hostname")/m - - expect(page).not_to have_content expected_payload_content - - click_button('Preview payload') - - wait_for_requests - - expect(page).to have_button 'Hide payload' - expect(page).to have_content expected_payload_content - end - - it 'generates usage ping payload on button click', :js do - expect_next_instance_of(Admin::ApplicationSettingsController) do |instance| - expect(instance).to receive(:usage_data).and_call_original - end - - click_button('Download payload') - - wait_for_requests - end - end - - context 'when service data not cached' do - it 'renders missing cache information' do - visit service_usage_data_admin_application_settings_path - - expect(page).to have_text('Service Ping payload not found in the application cache') - end - end - end end context 'application setting :admin_mode is disabled' do |