diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/features/admin | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/features/admin')
-rw-r--r-- | spec/features/admin/admin_appearance_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/admin/admin_hook_logs_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/admin/admin_jobs_spec.rb (renamed from spec/features/admin/admin_builds_spec.rb) | 20 | ||||
-rw-r--r-- | spec/features/admin/admin_mode/login_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_projects_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_serverless_domains_spec.rb | 89 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 66 |
7 files changed, 69 insertions, 118 deletions
diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index cd148642b90..cb69eac8035 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -34,6 +34,10 @@ RSpec.describe 'Admin Appearance' do visit admin_application_settings_appearances_path click_link "Sign-in page" + expect(find('#login')).to be_disabled + expect(find('#password')).to be_disabled + expect(find('button')).to be_disabled + expect_custom_sign_in_appearance(appearance) end diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index 3f63bf9a15c..837cab49bd4 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -17,8 +17,8 @@ RSpec.describe 'Admin::HookLogs' do hook_log visit edit_admin_hook_path(system_hook) - expect(page).to have_content('Recent Deliveries') - expect(page).to have_content(hook_log.url) + expect(page).to have_content('Recent events') + expect(page).to have_link('View details', href: admin_hook_hook_log_path(system_hook, hook_log)) end it 'show hook log details' do diff --git a/spec/features/admin/admin_builds_spec.rb b/spec/features/admin/admin_jobs_spec.rb index 42827dd5b49..36822f89c12 100644 --- a/spec/features/admin/admin_builds_spec.rb +++ b/spec/features/admin/admin_jobs_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' -RSpec.describe 'Admin Builds' do +RSpec.describe 'Admin Jobs' do before do admin = create(:admin) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) end - describe 'GET /admin/builds' do + describe 'GET /admin/jobs' do let(:pipeline) { create(:ci_pipeline) } context 'All tab' do @@ -22,7 +22,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path - expect(page).to have_selector('.nav-links li.active', text: 'All') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'All') expect(page).to have_selector('.row-content-block', text: 'All jobs') expect(page.all('.build-link').size).to eq(4) expect(page).to have_button 'Stop all jobs' @@ -37,7 +37,7 @@ RSpec.describe 'Admin Builds' do it 'shows a message' do visit admin_jobs_path - expect(page).to have_selector('.nav-links li.active', text: 'All') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'All') expect(page).to have_content 'No jobs to show' expect(page).not_to have_button 'Stop all jobs' end @@ -54,7 +54,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :pending) - expect(page).to have_selector('.nav-links li.active', text: 'Pending') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Pending') expect(page.find('.build-link')).to have_content(build1.id) expect(page.find('.build-link')).not_to have_content(build2.id) expect(page.find('.build-link')).not_to have_content(build3.id) @@ -69,7 +69,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :pending) - expect(page).to have_selector('.nav-links li.active', text: 'Pending') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Pending') expect(page).to have_content 'No jobs to show' expect(page).not_to have_button 'Stop all jobs' end @@ -86,7 +86,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :running) - expect(page).to have_selector('.nav-links li.active', text: 'Running') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Running') expect(page.find('.build-link')).to have_content(build1.id) expect(page.find('.build-link')).not_to have_content(build2.id) expect(page.find('.build-link')).not_to have_content(build3.id) @@ -101,7 +101,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :running) - expect(page).to have_selector('.nav-links li.active', text: 'Running') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Running') expect(page).to have_content 'No jobs to show' expect(page).not_to have_button 'Stop all jobs' end @@ -117,7 +117,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :finished) - expect(page).to have_selector('.nav-links li.active', text: 'Finished') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Finished') expect(page.find('.build-link')).not_to have_content(build1.id) expect(page.find('.build-link')).not_to have_content(build2.id) expect(page.find('.build-link')).to have_content(build3.id) @@ -131,7 +131,7 @@ RSpec.describe 'Admin Builds' do visit admin_jobs_path(scope: :finished) - expect(page).to have_selector('.nav-links li.active', text: 'Finished') + expect(page).to have_selector('[data-testid="jobs-tabs"] a.active', text: 'Finished') expect(page).to have_content 'No jobs to show' expect(page).to have_button 'Stop all jobs' end diff --git a/spec/features/admin/admin_mode/login_spec.rb b/spec/features/admin/admin_mode/login_spec.rb index 5b2dfdb2941..c8ee6c14499 100644 --- a/spec/features/admin/admin_mode/login_spec.rb +++ b/spec/features/admin/admin_mode/login_spec.rb @@ -121,7 +121,7 @@ RSpec.describe 'Admin Mode Login' do end context 'when logging in via omniauth' do - let(:user) { create(:omniauth_user, :admin, :two_factor, extern_uid: 'my-uid', provider: 'saml')} + let(:user) { create(:omniauth_user, :admin, :two_factor, extern_uid: 'my-uid', provider: 'saml', password_automatically_set: false)} let(:mock_saml_response) do File.read('spec/fixtures/authentication/saml_response.xml') end diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 15def00f354..a50ef34d327 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -96,7 +96,7 @@ RSpec.describe "Admin::Projects" do visit admin_project_path(project) click_button 'Search for Namespace' - click_link 'group: web' + click_button 'group: web' click_button 'Transfer' expect(page).to have_content("Web / #{project.name}") diff --git a/spec/features/admin/admin_serverless_domains_spec.rb b/spec/features/admin/admin_serverless_domains_spec.rb deleted file mode 100644 index 0312e82e1ba..00000000000 --- a/spec/features/admin/admin_serverless_domains_spec.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Admin Serverless Domains', :js do - let(:sample_domain) { build(:pages_domain) } - - before do - allow(Gitlab.config.pages).to receive(:enabled).and_return(true) - admin = create(:admin) - sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) - end - - it 'add domain with certificate' do - visit admin_serverless_domains_path - - fill_in 'pages_domain[domain]', with: 'foo.com' - fill_in 'pages_domain[user_provided_certificate]', with: sample_domain.certificate - fill_in 'pages_domain[user_provided_key]', with: sample_domain.key - click_button 'Add domain' - - expect(current_path).to eq admin_serverless_domains_path - - expect(page).to have_field('pages_domain[domain]', with: 'foo.com') - expect(page).to have_field('serverless_domain_dns', with: /^\*\.foo\.com CNAME /) - expect(page).to have_field('serverless_domain_verification', with: /^_gitlab-pages-verification-code.foo.com TXT /) - expect(page).not_to have_field('pages_domain[user_provided_certificate]') - expect(page).not_to have_field('pages_domain[user_provided_key]') - - expect(page).to have_content 'Unverified' - expect(page).to have_content '/CN=test-certificate' - end - - it 'update domain certificate' do - visit admin_serverless_domains_path - - fill_in 'pages_domain[domain]', with: 'foo.com' - fill_in 'pages_domain[user_provided_certificate]', with: sample_domain.certificate - fill_in 'pages_domain[user_provided_key]', with: sample_domain.key - click_button 'Add domain' - - expect(current_path).to eq admin_serverless_domains_path - - expect(page).not_to have_field('pages_domain[user_provided_certificate]') - expect(page).not_to have_field('pages_domain[user_provided_key]') - - click_button 'Replace' - - expect(page).to have_field('pages_domain[user_provided_certificate]') - expect(page).to have_field('pages_domain[user_provided_key]') - - fill_in 'pages_domain[user_provided_certificate]', with: sample_domain.certificate - fill_in 'pages_domain[user_provided_key]', with: sample_domain.key - - click_button 'Save changes' - - expect(page).to have_content 'Domain was successfully updated' - expect(page).to have_content '/CN=test-certificate' - end - - context 'when domain exists' do - let!(:domain) { create(:pages_domain, :instance_serverless) } - - it 'displays a modal when attempting to delete a domain' do - visit admin_serverless_domains_path - - click_button 'Delete domain' - - page.within '#modal-delete-domain' do - expect(page).to have_content "You are about to delete #{domain.domain} from your instance." - expect(page).to have_link('Delete domain') - end - end - - it 'displays a modal with disabled button if unable to delete a domain' do - create(:serverless_domain_cluster, pages_domain: domain) - - visit admin_serverless_domains_path - - click_button 'Delete domain' - - page.within '#modal-delete-domain' do - expect(page).to have_content "You must disassociate #{domain.domain} from all clusters it is attached to before deletion." - expect(page).to have_link('Delete domain') - end - end - end -end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index b25fc9f257a..1c50a7f891f 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -314,12 +314,14 @@ RSpec.describe 'Admin updates settings' do check 'Default to Auto DevOps pipeline for all projects' fill_in 'application_setting_auto_devops_domain', with: 'domain.com' uncheck 'Keep the latest artifacts for all jobs in the latest successful pipelines' + uncheck 'Enable pipeline suggestion banner' click_button 'Save changes' end expect(current_settings.auto_devops_enabled?).to be true expect(current_settings.auto_devops_domain).to eq('domain.com') expect(current_settings.keep_latest_artifact).to be false + expect(current_settings.suggest_pipeline_enabled).to be false expect(page).to have_content "Application settings saved successfully" end @@ -450,14 +452,14 @@ RSpec.describe 'Admin updates settings' do visit reporting_admin_application_settings_path page.within('.as-spam') do - fill_in 'reCAPTCHA Site Key', with: 'key' - fill_in 'reCAPTCHA Private Key', with: 'key' + fill_in 'reCAPTCHA site key', with: 'key' + fill_in 'reCAPTCHA private key', with: 'key' check 'Enable reCAPTCHA' check 'Enable reCAPTCHA for login' - fill_in 'IPs per user', with: 15 + fill_in 'IP addresses per user', with: 15 check 'Enable Spam Check via external API endpoint' fill_in 'URL of the external Spam Check endpoint', with: 'grpc://www.example.com/spamcheck' - fill_in 'Spam Check API Key', with: 'SPAM_CHECK_API_KEY' + fill_in 'Spam Check API key', with: 'SPAM_CHECK_API_KEY' click_button 'Save changes' end @@ -602,18 +604,54 @@ RSpec.describe 'Admin updates settings' do expect(current_settings.issues_create_limit).to eq(0) end - it 'changes Files API rate limits settings' do - visit network_admin_application_settings_path + shared_examples 'regular throttle rate limit settings' do + it 'changes rate limit settings' do + visit network_admin_application_settings_path - page.within('[data-testid="files-limits-settings"]') do - check 'Enable unauthenticated API request rate limit' - fill_in 'Max unauthenticated API requests per period per IP', with: 10 - click_button 'Save changes' + page.within(".#{selector}") do + check 'Enable unauthenticated API request rate limit' + fill_in 'Maximum unauthenticated API requests per rate limit period per IP', with: 12 + fill_in 'Unauthenticated API rate limit period in seconds', with: 34 + + check 'Enable authenticated API request rate limit' + fill_in 'Maximum authenticated API requests per rate limit period per user', with: 56 + fill_in 'Authenticated API rate limit period in seconds', with: 78 + + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + + expect(current_settings).to have_attributes( + "throttle_unauthenticated_#{fragment}_enabled" => true, + "throttle_unauthenticated_#{fragment}_requests_per_period" => 12, + "throttle_unauthenticated_#{fragment}_period_in_seconds" => 34, + "throttle_authenticated_#{fragment}_enabled" => true, + "throttle_authenticated_#{fragment}_requests_per_period" => 56, + "throttle_authenticated_#{fragment}_period_in_seconds" => 78 + ) end + end - expect(page).to have_content "Application settings saved successfully" - expect(current_settings.throttle_unauthenticated_files_api_enabled).to be true - expect(current_settings.throttle_unauthenticated_files_api_requests_per_period).to eq(10) + context 'Package Registry API rate limits' do + let(:selector) { 'as-packages-limits' } + let(:fragment) { :packages_api } + + include_examples 'regular throttle rate limit settings' + end + + context 'Files API rate limits' do + let(:selector) { 'as-files-limits' } + let(:fragment) { :files_api } + + include_examples 'regular throttle rate limit settings' + end + + context 'Deprecated API rate limits' do + let(:selector) { 'as-deprecated-limits' } + let(:fragment) { :deprecated_api } + + include_examples 'regular throttle rate limit settings' end end @@ -623,8 +661,6 @@ RSpec.describe 'Admin updates settings' do end it 'change Help page' do - stub_feature_flags(help_page_documentation_redirect: true) - new_support_url = 'http://example.com/help' new_documentation_url = 'https://docs.gitlab.com' |