diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/features/projects/settings | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) | |
download | gitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/features/projects/settings')
5 files changed, 116 insertions, 58 deletions
diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index ff28d59ed08..9468540736f 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration policy', :js do +RSpec.describe 'Project > Settings > Packages & Registries > Container registry tag expiration policy', :js do let_it_be(:user) { create(:user) } let_it_be(:project, reload: true) { create(:project, namespace: user.namespace) } @@ -23,14 +23,15 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'shows available section' do subject - settings_block = find('[data-testid="registry-settings-app"]') + settings_block = find('[data-testid="container-expiration-policy-project-settings"]') expect(settings_block).to have_text 'Clean up image tags' end it 'saves cleanup policy submit the form' do subject - within '[data-testid="registry-settings-app"]' do + within '[data-testid="container-expiration-policy-project-settings"]' do + click_button('Expand') select('Every day', from: 'Run cleanup') select('50 tags per image name', from: 'Keep the most recent:') fill_in('Keep tags matching:', with: 'stable') @@ -48,7 +49,8 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'does not save cleanup policy submit form with invalid regex' do subject - within '[data-testid="registry-settings-app"]' do + within '[data-testid="container-expiration-policy-project-settings"]' do + click_button('Expand') fill_in('Remove tags matching:', with: '*-production') submit_button = find('[data-testid="save-button"') @@ -73,7 +75,8 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'displays the related section' do subject - within '[data-testid="registry-settings-app"]' do + within '[data-testid="container-expiration-policy-project-settings"]' do + click_button('Expand') expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.') end end @@ -87,7 +90,8 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'does not display the related section' do subject - within '[data-testid="registry-settings-app"]' do + within '[data-testid="container-expiration-policy-project-settings"]' do + click_button('Expand') expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') end end @@ -100,7 +104,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'does not exists' do subject - expect(page).not_to have_selector('[data-testid="registry-settings-app"]') + expect(page).not_to have_selector('[data-testid="container-expiration-policy-project-settings"]') end end @@ -110,7 +114,7 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p it 'does not exists' do subject - expect(page).not_to have_selector('[data-testid="registry-settings-app"]') + expect(page).not_to have_selector('[data-testid="container-expiration-policy-project-settings"]') end end end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 72ada356225..ddfed73e2ca 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -179,7 +179,6 @@ RSpec.describe 'Projects > Settings > Repository settings' do expect(page).to have_css(".js-mirror-url-hidden[value=\"#{ssh_url}\"]", visible: false) select 'SSH public key', from: 'Authentication method' - select_direction Sidekiq::Testing.fake! do diff --git a/spec/features/projects/settings/secure_files_settings_spec.rb b/spec/features/projects/settings/secure_files_settings_spec.rb deleted file mode 100644 index c7c9cafc420..00000000000 --- a/spec/features/projects/settings/secure_files_settings_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Secure Files Settings' do - let_it_be(:maintainer) { create(:user) } - let_it_be(:project) { create(:project, creator_id: maintainer.id) } - - before_all do - project.add_maintainer(maintainer) - end - - context 'when the :ci_secure_files feature flag is enabled' do - before do - stub_feature_flags(ci_secure_files: true) - - sign_in(user) - visit project_settings_ci_cd_path(project) - end - - context 'authenticated user with admin permissions' do - let(:user) { maintainer } - - it 'shows the secure files settings' do - expect(page).to have_content('Secure Files') - end - end - end - - context 'when the :ci_secure_files feature flag is disabled' do - before do - stub_feature_flags(ci_secure_files: false) - - sign_in(user) - visit project_settings_ci_cd_path(project) - end - - context 'authenticated user with admin permissions' do - let(:user) { maintainer } - - it 'does not shows the secure files settings' do - expect(page).not_to have_content('Secure Files') - end - end - end -end diff --git a/spec/features/projects/settings/secure_files_spec.rb b/spec/features/projects/settings/secure_files_spec.rb new file mode 100644 index 00000000000..ee38acf1953 --- /dev/null +++ b/spec/features/projects/settings/secure_files_spec.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Secure Files', :js do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + stub_feature_flags(ci_secure_files_read_only: false) + project.add_maintainer(user) + sign_in(user) + end + + context 'when the :ci_secure_files feature flag is enabled' do + before do + stub_feature_flags(ci_secure_files: true) + + visit project_settings_ci_cd_path(project) + end + + context 'authenticated user with admin permissions' do + it 'shows the secure files settings' do + expect(page).to have_content('Secure Files') + end + end + end + + context 'when the :ci_secure_files feature flag is disabled' do + before do + stub_feature_flags(ci_secure_files: false) + + visit project_settings_ci_cd_path(project) + end + + context 'authenticated user with admin permissions' do + it 'does not shows the secure files settings' do + expect(page).not_to have_content('Secure Files') + end + end + end + + it 'user sees the Secure Files list component' do + visit project_settings_ci_cd_path(project) + + within '#js-secure-files' do + expect(page).to have_content('There are no secure files yet.') + end + end + + it 'prompts the user to confirm before deleting a file' do + file = create(:ci_secure_file, project: project) + + visit project_settings_ci_cd_path(project) + + within '#js-secure-files' do + expect(page).to have_content(file.name) + + find('button.btn-danger-secondary').click + end + + expect(page).to have_content("Delete #{file.name}?") + + click_on('Delete secure file') + + visit project_settings_ci_cd_path(project) + + within '#js-secure-files' do + expect(page).not_to have_content(file.name) + end + end + + it 'displays an uploaded file in the file list' do + visit project_settings_ci_cd_path(project) + + within '#js-secure-files' do + expect(page).to have_content('There are no secure files yet.') + + page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do + click_button 'Upload File' + end + + expect(page).to have_content('upload-keystore.jks') + end + end + + it 'displays an error when a duplicate file upload is attempted' do + create(:ci_secure_file, project: project, name: 'upload-keystore.jks') + visit project_settings_ci_cd_path(project) + + within '#js-secure-files' do + expect(page).to have_content('upload-keystore.jks') + + page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do + click_button 'Upload File' + end + + expect(page).to have_content('A file with this name already exists.') + end + end +end diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index becb30c02b7..fc78b5b5769 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -16,7 +16,7 @@ RSpec.describe 'Projects > Settings > Visibility settings', :js do visibility_select_container = find('.project-visibility-setting') expect(visibility_select_container.find('select').value).to eq project.visibility_level.to_s - expect(visibility_select_container).to have_content 'The project can be accessed by anyone, regardless of authentication.' + expect(visibility_select_container).to have_content 'Accessible by anyone, regardless of authentication.' end it 'project visibility description updates on change' do @@ -25,7 +25,7 @@ RSpec.describe 'Projects > Settings > Visibility settings', :js do visibility_select.select('Private') expect(visibility_select.value).to eq '0' - expect(visibility_select_container).to have_content 'Access must be granted explicitly to each user.' + expect(visibility_select_container).to have_content 'Only accessible by project members. Membership must be explicitly granted to each user.' end context 'merge requests select' do @@ -86,7 +86,7 @@ RSpec.describe 'Projects > Settings > Visibility settings', :js do visibility_select_container = find('.project-visibility-setting') expect(visibility_select_container).to have_selector 'select[name="project[visibility_level]"]:disabled' - expect(visibility_select_container).to have_content 'The project can be accessed by anyone, regardless of authentication.' + expect(visibility_select_container).to have_content 'Accessible by anyone, regardless of authentication.' end context 'disable email notifications' do |