diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/features/projects/settings | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/features/projects/settings')
-rw-r--r-- | spec/features/projects/settings/access_tokens_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/settings/monitor_settings_spec.rb (renamed from spec/features/projects/settings/operations_settings_spec.rb) | 26 | ||||
-rw-r--r-- | spec/features/projects/settings/packages_settings_spec.rb | 26 | ||||
-rw-r--r-- | spec/features/projects/settings/project_settings_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/projects/settings/registry_settings_spec.rb | 160 | ||||
-rw-r--r-- | spec/features/projects/settings/repository_settings_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb | 12 | ||||
-rw-r--r-- | spec/features/projects/settings/user_manages_project_members_spec.rb | 28 |
8 files changed, 155 insertions, 104 deletions
diff --git a/spec/features/projects/settings/access_tokens_spec.rb b/spec/features/projects/settings/access_tokens_spec.rb index 8083c851bb7..76d5d7308d1 100644 --- a/spec/features/projects/settings/access_tokens_spec.rb +++ b/spec/features/projects/settings/access_tokens_spec.rb @@ -99,7 +99,7 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do visit project_settings_access_tokens_path(personal_project) expect(page).to have_selector('#new_project_access_token') - expect(page).to have_text('You can generate an access token scoped to this project for each application to use the GitLab API.') + expect(page).to have_text('Generate project access tokens scoped to this project for your applications that need access to the GitLab API.') end end diff --git a/spec/features/projects/settings/operations_settings_spec.rb b/spec/features/projects/settings/monitor_settings_spec.rb index ca976997142..64138e0aeca 100644 --- a/spec/features/projects/settings/operations_settings_spec.rb +++ b/spec/features/projects/settings/monitor_settings_spec.rb @@ -3,25 +3,35 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > For a forked project', :js do - let(:user) { create(:user) } - let(:project) { create(:project, :repository, create_templates: :issue) } - let(:role) { :maintainer } + let_it_be(:project) { create(:project, :repository, create_templates: :issue) } + + let(:user) { project.owner} before do sign_in(user) - project.add_role(user, role) end - describe 'Sidebar > Operations' do - it 'renders the settings link in the sidebar' do + describe 'Sidebar > Monitor' do + it 'renders the menu in the sidebar' do visit project_path(project) wait_for_requests - expect(page).to have_selector('a[title="Operations"]', visible: false) + expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Monitor"]', text: 'Monitor', visible: false) + end + + context 'when feature flag sidebar_refactor is disabled' do + it 'renders the menu "Operations" in the sidebar' do + stub_feature_flags(sidebar_refactor: false) + + visit project_path(project) + wait_for_requests + + expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Operations"]', text: 'Operations', visible: false) + end end end - describe 'Settings > Operations' do + describe 'Settings > Monitor' do describe 'Incidents' do let(:create_issue) { 'Create an incident. Incidents are created for each alert triggered.' } let(:send_email) { 'Send a single email notification to Owners and Maintainers for new alerts.' } diff --git a/spec/features/projects/settings/packages_settings_spec.rb b/spec/features/projects/settings/packages_settings_spec.rb index 0b40cbee582..62f31fd027b 100644 --- a/spec/features/projects/settings/packages_settings_spec.rb +++ b/spec/features/projects/settings/packages_settings_spec.rb @@ -3,36 +3,32 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > Packages', :js do - let(:project) { create(:project) } - let(:user) { create(:user) } + let_it_be(:project) { create(:project) } + + let(:user) { project.owner } before do sign_in(user) - project.add_maintainer(user) + + stub_config(packages: { enabled: packages_enabled }) + + visit edit_project_path(project) end context 'Packages enabled in config' do - before do - allow(Gitlab.config.packages).to receive(:enabled).and_return(true) - end + let(:packages_enabled) { true } it 'displays the packages toggle button' do - visit edit_project_path(project) - - expect(page).to have_content('Packages') + expect(page).to have_button('Packages', class: 'gl-toggle') expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true) end end context 'Packages disabled in config' do - before do - allow(Gitlab.config.packages).to receive(:enabled).and_return(false) - end + let(:packages_enabled) { false } it 'does not show up in UI' do - visit edit_project_path(project) - - expect(page).not_to have_content('Packages') + expect(page).not_to have_button('Packages', class: 'gl-toggle') end end end diff --git a/spec/features/projects/settings/project_settings_spec.rb b/spec/features/projects/settings/project_settings_spec.rb index cd1c9ecde9c..71b319d192c 100644 --- a/spec/features/projects/settings/project_settings_spec.rb +++ b/spec/features/projects/settings/project_settings_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'Projects settings' do let_it_be(:project) { create(:project) } + let(:user) { project.owner } let(:panel) { find('.general-settings', match: :first) } let(:button) { panel.find('.btn.gl-button.js-settings-toggle') } diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index bc60cdd2f8e..6a2769d11fd 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -11,105 +11,125 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p let(:container_registry_enabled) { true } let(:container_registry_enabled_on_project) { true } - subject { visit project_settings_ci_cd_path(project) } + shared_examples 'an expiration policy form' do + before do + project.update!(container_registry_enabled: container_registry_enabled_on_project) + project.container_expiration_policy.update!(enabled: true) - before do - project.update!(container_registry_enabled: container_registry_enabled_on_project) - project.container_expiration_policy.update!(enabled: true) + sign_in(user) + stub_container_registry_config(enabled: container_registry_enabled) + end - sign_in(user) - stub_container_registry_config(enabled: container_registry_enabled) - end + context 'as owner' do + it 'shows available section' do + subject - context 'as owner' do - it 'shows available section' do - subject + settings_block = find('#js-registry-policies') + expect(settings_block).to have_text 'Clean up image tags' + end - settings_block = find('#js-registry-policies') - expect(settings_block).to have_text 'Clean up image tags' - end + it 'saves cleanup policy submit the form' do + subject - it 'saves cleanup policy submit the form' do - subject + within '#js-registry-policies' do + select('Every day', from: 'Run cleanup') + select('50 tags per image name', from: 'Keep the most recent:') + fill_in('Keep tags matching:', with: 'stable') + select('7 days', from: 'Remove tags older than:') + fill_in('Remove tags matching:', with: '.*-production') + + submit_button = find('[data-testid="save-button"') + expect(submit_button).not_to be_disabled + submit_button.click + end - within '#js-registry-policies' do - select('Every day', from: 'Run cleanup') - select('50 tags per image name', from: 'Keep the most recent:') - fill_in('Keep tags matching:', with: 'stable') - select('7 days', from: 'Remove tags older than:') - fill_in('Remove tags matching:', with: '.*-production') + expect(find('.gl-toast')).to have_content('Cleanup policy successfully saved.') + end - submit_button = find('[data-testid="save-button"') - expect(submit_button).not_to be_disabled - submit_button.click + it 'does not save cleanup policy submit form with invalid regex' do + subject + + within '#js-registry-policies' do + fill_in('Remove tags matching:', with: '*-production') + + submit_button = find('[data-testid="save-button"') + expect(submit_button).not_to be_disabled + submit_button.click + end + + expect(find('.gl-toast')).to have_content('Something went wrong while updating the cleanup policy.') end - toast = find('.gl-toast') - expect(toast).to have_content('Cleanup policy successfully saved.') end - it 'does not save cleanup policy submit form with invalid regex' do - subject + context 'with a project without expiration policy' do + where(:application_setting, :feature_flag, :result) do + true | true | :available_section + true | false | :available_section + false | true | :available_section + false | false | :disabled_message + end - within '#js-registry-policies' do - fill_in('Remove tags matching:', with: '*-production') + with_them do + before do + project.container_expiration_policy.destroy! + stub_feature_flags(container_expiration_policies_historic_entry: false) + stub_application_setting(container_expiration_policies_enable_historic_entries: application_setting) + stub_feature_flags(container_expiration_policies_historic_entry: project) if feature_flag + end - submit_button = find('[data-testid="save-button"') - expect(submit_button).not_to be_disabled - submit_button.click + it 'displays the expected result' do + subject + + within '#js-registry-policies' do + case result + when :available_section + expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.') + when :disabled_message + expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') + end + end + end end - toast = find('.gl-toast') - expect(toast).to have_content('Something went wrong while updating the cleanup policy.') end - end - context 'with a project without expiration policy' do - where(:application_setting, :feature_flag, :result) do - true | true | :available_section - true | false | :available_section - false | true | :available_section - false | false | :disabled_message - end + context 'when registry is disabled' do + let(:container_registry_enabled) { false } + + it 'does not exists' do + subject - with_them do - before do - project.container_expiration_policy.destroy! - stub_feature_flags(container_expiration_policies_historic_entry: false) - stub_application_setting(container_expiration_policies_enable_historic_entries: application_setting) - stub_feature_flags(container_expiration_policies_historic_entry: project) if feature_flag + expect(page).not_to have_selector('#js-registry-policies') end + end - it 'displays the expected result' do + context 'when container registry is disabled on project' do + let(:container_registry_enabled_on_project) { false } + + it 'does not exists' do subject - within '#js-registry-policies' do - case result - when :available_section - expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.') - when :disabled_message - expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled') - end - end + expect(page).not_to have_selector('#js-registry-policies') end end end - context 'when registry is disabled' do - let(:container_registry_enabled) { false } + context 'with sidebar feature flag off' do + subject { visit project_settings_ci_cd_path(project) } - it 'does not exists' do - subject - - expect(page).not_to have_selector('#js-registry-policies') + before do + stub_feature_flags(sidebar_refactor: false) end - end - context 'when container registry is disabled on project' do - let(:container_registry_enabled_on_project) { false } + it_behaves_like 'an expiration policy form' + end - it 'does not exists' do - subject + context 'with sidebar feature flag on' do + subject { visit project_settings_packages_and_registries_path(project) } - expect(page).not_to have_selector('#js-registry-policies') + before do + stub_feature_flags(sidebar_refactor: true) end + + it_behaves_like 'an expiration policy form' end end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 2f257d299d8..f420a8a76b9 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -42,6 +42,7 @@ RSpec.describe 'Projects > Settings > Repository settings' do context 'Deploy Keys', :js do let_it_be(:private_deploy_key) { create(:deploy_key, title: 'private_deploy_key', public: false) } let_it_be(:public_deploy_key) { create(:another_deploy_key, title: 'public_deploy_key', public: true) } + let(:new_ssh_key) { attributes_for(:key)[:key] } it 'get list of keys' do @@ -116,7 +117,8 @@ RSpec.describe 'Projects > Settings > Repository settings' do project.deploy_keys << private_deploy_key visit project_settings_repository_path(project) - accept_confirm { find('.deploy-key', text: private_deploy_key.title).find('[data-testid="remove-icon"]').click } + click_button 'Remove' + click_button 'Remove deploy key' expect(page).not_to have_content(private_deploy_key.title) end diff --git a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb index ebda5c9ff59..bf90e86c263 100644 --- a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb @@ -163,7 +163,8 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do click_on('Save changes') end - find('.flash-notice') + wait_for_requests + radio = find_field('project_project_setting_attributes_squash_option_default_on') expect(radio).to be_checked @@ -178,7 +179,8 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do click_on('Save changes') end - find('.flash-notice') + wait_for_requests + radio = find_field('project_project_setting_attributes_squash_option_always') expect(radio).to be_checked @@ -193,7 +195,8 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do click_on('Save changes') end - find('.flash-notice') + wait_for_requests + radio = find_field('project_project_setting_attributes_squash_option_never') expect(radio).to be_checked @@ -220,7 +223,8 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do click_on('Save changes') end - find('.flash-notice') + wait_for_requests + radio = find_field('project_project_setting_attributes_mr_default_target_self_true') expect(radio).to be_checked diff --git a/spec/features/projects/settings/user_manages_project_members_spec.rb b/spec/features/projects/settings/user_manages_project_members_spec.rb index b237e7e8ce7..be4b6d6b82d 100644 --- a/spec/features/projects/settings/user_manages_project_members_spec.rb +++ b/spec/features/projects/settings/user_manages_project_members_spec.rb @@ -38,16 +38,12 @@ RSpec.describe 'Projects > Settings > User manages project members' do end it 'imports a team from another project', :js do - stub_feature_flags(invite_members_group_modal: false) - project2.add_maintainer(user) project2.add_reporter(user_mike) visit(project_project_members_path(project)) - page.within('.invite-users-form') do - click_link('Import') - end + click_link('Import a project') select2(project2.id, from: '#source_project_id') click_button('Import project members') @@ -55,6 +51,28 @@ RSpec.describe 'Projects > Settings > User manages project members' do expect(find_member_row(user_mike)).to have_content('Reporter') end + describe 'when the :invite_members_group_modal is disabled' do + before do + stub_feature_flags(invite_members_group_modal: false) + end + + it 'imports a team from another project', :js do + project2.add_maintainer(user) + project2.add_reporter(user_mike) + + visit(project_project_members_path(project)) + + page.within('.invite-users-form') do + click_link('Import') + end + + select2(project2.id, from: '#source_project_id') + click_button('Import project members') + + expect(find_member_row(user_mike)).to have_content('Reporter') + end + end + it 'shows all members of project shared group', :js do group.add_owner(user) group.add_developer(user_dmitriy) |